diff --git a/CefSharp.Core/CefSharp.Core.vcxproj b/CefSharp.Core/CefSharp.Core.vcxproj
index b2459d153..058a60c59 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj
+++ b/CefSharp.Core/CefSharp.Core.vcxproj
@@ -287,6 +287,7 @@
+
diff --git a/CefSharp.Core/CefSharp.Core.vcxproj.filters b/CefSharp.Core/CefSharp.Core.vcxproj.filters
index da41c2301..9d79edf0c 100644
--- a/CefSharp.Core/CefSharp.Core.vcxproj.filters
+++ b/CefSharp.Core/CefSharp.Core.vcxproj.filters
@@ -217,6 +217,9 @@
Header Files
+
+ Header Files
+
diff --git a/CefSharp.Core/RequestContext.h b/CefSharp.Core/RequestContext.h
index 762baf4be..6cbdffcbf 100644
--- a/CefSharp.Core/RequestContext.h
+++ b/CefSharp.Core/RequestContext.h
@@ -6,6 +6,7 @@
#include "Stdafx.h"
#include "Internals\MCefRefPtr.h"
+#include "RequestContextSettings.h"
#include "include\cef_request_context.h"
using namespace CefSharp;
@@ -14,14 +15,17 @@ namespace CefSharp
{
public ref class RequestContext
{
+ private:
MCefRefPtr _requestContext;
-
public:
- RequestContext(String^ cachePath, bool persistSessionCookies)
+ RequestContext()
{
CefRequestContextSettings settings;
- settings.persist_session_cookies = persistSessionCookies;
- StringUtils::AssignNativeFromClr(settings.cache_path, cachePath);
+ _requestContext = CefRequestContext::CreateContext(settings, NULL);
+ }
+
+ RequestContext(RequestContextSettings^ settings)
+ {
_requestContext = CefRequestContext::CreateContext(settings, NULL);
}
diff --git a/CefSharp.Core/RequestContextSettings.h b/CefSharp.Core/RequestContextSettings.h
new file mode 100644
index 000000000..c6107ed9a
--- /dev/null
+++ b/CefSharp.Core/RequestContextSettings.h
@@ -0,0 +1,67 @@
+// Copyright © 2010-2015 The CefSharp Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+#pragma once
+
+#include "Stdafx.h"
+#include "Internals/StringUtils.h"
+#include "include\cef_request_context.h"
+
+using namespace CefSharp::Internals;
+
+namespace CefSharp
+{
+ ///
+ /// RequestContextSettings
+ ///
+ public ref class RequestContextSettings
+ {
+ private:
+ CefRequestContextSettings* _settings;
+
+ public:
+ RequestContextSettings() : _settings(new CefRequestContextSettings())
+ {
+ }
+
+ !RequestContextSettings()
+ {
+ delete _settings;
+ }
+
+ ~RequestContextSettings()
+ {
+ this->!RequestContextSettings();
+ }
+
+ property bool PersistSessionCookies
+ {
+ bool get() { return _settings->persist_session_cookies; }
+ void set(bool value) { _settings->persist_session_cookies = value; }
+ }
+
+ property String^ CachePath
+ {
+ String^ get() { return StringUtils::ToClr(_settings->cache_path); }
+ void set(String^ value) { StringUtils::AssignNativeFromClr(_settings->cache_path, value); }
+ }
+
+ property String^ AcceptLanguageList
+ {
+ String^ get() { return StringUtils::ToClr(_settings->accept_language_list); }
+ void set(String^ value) { StringUtils::AssignNativeFromClr(_settings->accept_language_list, value); }
+ }
+
+ property bool IgnoreCertificateErrors
+ {
+ bool get() { return _settings->ignore_certificate_errors; }
+ void set(bool value) { _settings->ignore_certificate_errors = value; }
+ }
+
+ operator CefRequestContextSettings()
+ {
+ return *_settings;
+ }
+ };
+}
\ No newline at end of file
diff --git a/CefSharp.OffScreen.Example/Program.cs b/CefSharp.OffScreen.Example/Program.cs
index 4c191bbcc..b01fbcc10 100644
--- a/CefSharp.OffScreen.Example/Program.cs
+++ b/CefSharp.OffScreen.Example/Program.cs
@@ -38,9 +38,11 @@ namespace CefSharp.OffScreen.Example
private static async void MainAsync(string cachePath, double zoomLevel)
{
var browserSettings = new BrowserSettings();
+ var requestContextSettings = new RequestContextSettings();
+ requestContextSettings.CachePath = cachePath;
// Create the offscreen Chromium browser.
- using(var requestContext = new RequestContext(cachePath, false))
+ using(var requestContext = new RequestContext(requestContextSettings))
using (var browser = new ChromiumWebBrowser(TestUrl, browserSettings, requestContext))
{
browser.FrameLoadStart += (s, argsi) =>