Skip to content

Commit 6ea5ac4

Browse files
committed
Core - Remove ICookieManager.SetSupportedSchemes
- The method was removed upstream. - New properties have been added to CefSettings and RequestContextSettings **Breaking Change** Resolves #3497
1 parent 0522530 commit 6ea5ac4

File tree

10 files changed

+127
-31
lines changed

10 files changed

+127
-31
lines changed

CefSharp.Core.Runtime/CefSettingsBase.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,39 @@ namespace CefSharp
376376
void set(uint32 value) { _cefSettings->background_color = value; }
377377
}
378378

379+
/// <summary>
380+
/// Comma delimited list of schemes supported by the associated
381+
/// ICookieManager. If CookieableSchemesExcludeDefaults is false the
382+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
383+
/// Specifying a CookieableSchemesList value and setting
384+
/// CookieableSchemesExcludeDefaults to true will disable all loading
385+
/// and saving of cookies for this manager. Can be overridden
386+
/// for individual RequestContext instances via the
387+
/// RequestContextSettings.CookieableSchemesList and
388+
/// RequestContextSettings.CookieableSchemesExcludeDefaults values.
389+
/// </summary>
390+
property String^ CookieableSchemesList
391+
{
392+
String^ get() { return StringUtils::ToClr(_cefSettings->cookieable_schemes_list); }
393+
void set(String^ value) { StringUtils::AssignNativeFromClr(_cefSettings->cookieable_schemes_list, value); }
394+
}
395+
396+
/// <summary>
397+
/// If CookieableSchemesExcludeDefaults is false the
398+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
399+
/// Specifying a CookieableSchemesList value and setting
400+
/// CookieableSchemesExcludeDefaults to true will disable all loading
401+
/// and saving of cookies for this manager. Can be overridden
402+
/// for individual RequestContext instances via the
403+
/// RequestContextSettings.CookieableSchemesList and
404+
/// RequestContextSettings.CookieableSchemesExcludeDefaults values.
405+
/// </summary>
406+
property bool CookieableSchemesExcludeDefaults
407+
{
408+
bool get() { return _cefSettings->cookieable_schemes_exclude_defaults == 1; }
409+
void set(bool value) { _cefSettings->cookieable_schemes_exclude_defaults = value; }
410+
}
411+
379412
/// <summary>
380413
/// GUID string used for identifying the application. This is passed to the system AV function for scanning downloaded files. By
381414
/// default, the GUID will be an empty string and the file will be treated as an untrusted file when the GUID is empty.

CefSharp.Core.Runtime/CookieManager.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ namespace CefSharp
5959
return _cookieManager->SetCookie(StringUtils::ToNative(url), c, wrapper);
6060
}
6161

62-
void CookieManager::SetSupportedSchemes(cli::array<String^>^ schemes, bool includeDefaults, ICompletionCallback^ callback)
63-
{
64-
ThrowIfDisposed();
65-
66-
CefRefPtr<CefCompletionCallback> wrapper = callback == nullptr ? NULL : new CefCompletionCallbackAdapter(callback);
67-
68-
_cookieManager->SetSupportedSchemes(StringUtils::ToNative(schemes), includeDefaults, wrapper);
69-
}
70-
7162
bool CookieManager::VisitAllCookies(ICookieVisitor^ visitor)
7263
{
7364
ThrowIfDisposed();

CefSharp.Core.Runtime/CookieManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ namespace CefSharp
4949

5050
virtual bool DeleteCookies(String^ url, String^ name, IDeleteCookiesCallback^ callback);
5151
virtual bool SetCookie(String^ url, Cookie^ cookie, ISetCookieCallback^ callback);
52-
virtual void SetSupportedSchemes(cli::array<String^>^ schemes, bool includeDefaults, ICompletionCallback^ callback);
5352
virtual bool VisitAllCookies(ICookieVisitor^ visitor);
5453
virtual bool VisitUrlCookies(String^ url, bool includeHttpOnly, ICookieVisitor^ visitor);
5554
virtual bool FlushStore(ICompletionCallback^ callback);

CefSharp.Core.Runtime/RequestContextSettings.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,35 @@ namespace CefSharp
113113
bool get() { return _settings->ignore_certificate_errors == 1; }
114114
void set(bool value) { _settings->ignore_certificate_errors = value; }
115115
}
116+
117+
/// <summary>
118+
/// Comma delimited list of schemes supported by the associated
119+
/// ICookieManager. If CookieableSchemesExcludeDefaults is false the
120+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
121+
/// Specifying a CookieableSchemesList value and setting
122+
/// CookieableSchemesExcludeDefaults to true will disable all loading
123+
/// and saving of cookies for this manager. This value will be ignored if
124+
/// <see cref="CachePath"/> matches the <see cref="CefSettingsBase.CachePath"/> value.
125+
/// </summary>
126+
property String^ CookieableSchemesList
127+
{
128+
String^ get() { return StringUtils::ToClr(_settings->cookieable_schemes_list); }
129+
void set(String^ value) { StringUtils::AssignNativeFromClr(_settings->cookieable_schemes_list, value); }
130+
}
131+
132+
/// <summary>
133+
/// If CookieableSchemesExcludeDefaults is false the
134+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
135+
/// Specifying a CookieableSchemesList value and setting
136+
/// CookieableSchemesExcludeDefaults to true will disable all loading
137+
/// and saving of cookies for this manager. This value will be ignored if
138+
/// <see cref="CachePath"/> matches the <see cref="CefSettingsBase.CachePath"/> value.
139+
/// </summary>
140+
property bool CookieableSchemesExcludeDefaults
141+
{
142+
bool get() { return _settings->cookieable_schemes_exclude_defaults == 1; }
143+
void set(bool value) { _settings->cookieable_schemes_exclude_defaults = value; }
144+
}
116145
};
117146
}
118147
}

CefSharp.Core/CefSettingsBase.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,39 @@ public UInt32 BackgroundColor
343343
set { settings.BackgroundColor = value; }
344344
}
345345

346+
/// <summary>
347+
/// Comma delimited list of schemes supported by the associated
348+
/// ICookieManager. If CookieableSchemesExcludeDefaults is false the
349+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
350+
/// Specifying a CookieableSchemesList value and setting
351+
/// CookieableSchemesExcludeDefaults to true will disable all loading
352+
/// and saving of cookies for this manager. Can be overridden
353+
/// for individual RequestContext instances via the
354+
/// RequestContextSettings.CookieableSchemesList and
355+
/// RequestContextSettings.CookieableSchemesExcludeDefaults values.
356+
/// </summary>
357+
public string CookieableSchemesList
358+
{
359+
get { return settings.CookieableSchemesList; }
360+
set { settings.CookieableSchemesList = value; }
361+
}
362+
363+
/// <summary>
364+
/// If CookieableSchemesExcludeDefaults is false the
365+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
366+
/// Specifying a CookieableSchemesList value and setting
367+
/// CookieableSchemesExcludeDefaults to true will disable all loading
368+
/// and saving of cookies for this manager. Can be overridden
369+
/// for individual RequestContext instances via the
370+
/// RequestContextSettings.CookieableSchemesList and
371+
/// RequestContextSettings.CookieableSchemesExcludeDefaults values.
372+
/// </summary>
373+
public bool CookieableSchemesExcludeDefaults
374+
{
375+
get { return settings.CookieableSchemesExcludeDefaults; }
376+
set { settings.CookieableSchemesExcludeDefaults = value; }
377+
}
378+
346379
/// <summary>
347380
/// GUID string used for identifying the application. This is passed to the system AV function for scanning downloaded files. By
348381
/// default, the GUID will be an empty string and the file will be treated as an untrusted file when the GUID is empty.

CefSharp.Core/RequestContextSettings.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,34 @@ public bool IgnoreCertificateErrors
8484
get { return settings.IgnoreCertificateErrors; }
8585
set { settings.IgnoreCertificateErrors = value; }
8686
}
87+
88+
/// <summary>
89+
/// Comma delimited list of schemes supported by the associated
90+
/// ICookieManager. If CookieableSchemesExcludeDefaults is false the
91+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
92+
/// Specifying a CookieableSchemesList value and setting
93+
/// CookieableSchemesExcludeDefaults to true will disable all loading
94+
/// and saving of cookies for this manager. This value will be ignored if
95+
/// <see cref="CachePath"/> matches the <see cref="CefSettingsBase.CachePath"/> value.
96+
/// </summary>
97+
public string CookieableSchemesList
98+
{
99+
get { return settings.CookieableSchemesList; }
100+
set { settings.CookieableSchemesList = value; }
101+
}
102+
103+
/// <summary>
104+
/// If CookieableSchemesExcludeDefaults is false the
105+
/// default schemes ("http", "https", "ws" and "wss") will also be supported.
106+
/// Specifying a CookieableSchemesList value and setting
107+
/// CookieableSchemesExcludeDefaults to true will disable all loading
108+
/// and saving of cookies for this manager. This value will be ignored if
109+
/// <see cref="CachePath"/> matches the <see cref="CefSettingsBase.CachePath"/> value.
110+
/// </summary>
111+
public bool CookieableSchemesExcludeDefaults
112+
{
113+
get { return settings.CookieableSchemesExcludeDefaults; }
114+
set { settings.CookieableSchemesExcludeDefaults = value; }
115+
}
87116
}
88117
}

CefSharp.Example/CefExample.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public static void Init(CefSettingsBase settings, IBrowserProcessHandler browser
183183
#endif
184184
}
185185

186+
settings.CookieableSchemesList = "custom";
187+
186188
settings.RegisterScheme(new CefCustomScheme
187189
{
188190
SchemeName = CefSharpSchemeHandlerFactory.SchemeName,

CefSharp.Example/Handlers/BrowserProcessHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void IBrowserProcessHandler.OnContextInitialized()
2424
{
2525
//The Global CookieManager has been initialized, you can now set cookies
2626
var cookieManager = Cef.GetGlobalCookieManager();
27-
cookieManager.SetSupportedSchemes(new string[] { "custom" }, true);
27+
2828
if (cookieManager.SetCookie("custom://cefsharp/home.html", new Cookie
2929
{
3030
Name = "CefSharpTestCookie",

CefSharp/ICookieManager.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,6 @@ public interface ICookieManager : IDisposable
3636
/// <returns>Returns false if an invalid URL is specified or if cookies cannot be accessed.</returns>
3737
bool SetCookie(string url, Cookie cookie, ISetCookieCallback callback = null);
3838

39-
/// <summary>
40-
/// Set the schemes supported by this manager. Calling this method with an empty <paramref name="schemes"/> value and <paramref name="includeDefaults"/>
41-
/// set to false will disable all loading and saving of cookies for this manager. Must be called before any cookies are accessed.
42-
/// </summary>
43-
/// <param name="schemes">The list of supported schemes.</param>
44-
/// <param name="includeDefaults">If true the default schemes ("http", "https", "ws" and "wss") will also be supported. Calling this method with an empty schemes value and includeDefaults
45-
/// set to false will disable all loading and saving of cookies for this manager</param>
46-
/// <param name="callback">If non-NULL it will be executed asynchronously on the CEF UI thread after the change has been applied.</param>
47-
void SetSupportedSchemes(string[] schemes, bool includeDefaults, ICompletionCallback callback = null);
48-
4939
/// <summary>
5040
/// Visit all cookies on the UI thread. The returned cookies are ordered by longest path, then by earliest creation date.
5141
/// </summary>

CefSharp/Internals/CookieManagerDecorator.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ bool ICookieManager.SetCookie(string url, Cookie cookie, ISetCookieCallback call
8383
throw new InvalidOperationException(NotInitialziedExceptionMsg);
8484
}
8585

86-
void ICookieManager.SetSupportedSchemes(string[] schemes, bool includeDefaults, ICompletionCallback callback)
87-
{
88-
if (managerReady)
89-
{
90-
manager.SetSupportedSchemes(schemes, includeDefaults, callback);
91-
}
92-
93-
throw new InvalidOperationException(NotInitialziedExceptionMsg);
94-
}
95-
9686
bool ICookieManager.VisitAllCookies(ICookieVisitor visitor)
9787
{
9888
if (managerReady)

0 commit comments

Comments
 (0)