diff options
author | Marshall Greenblatt <magreenblatt@gmail.com> | 2023-02-17 14:08:00 -0500 |
---|---|---|
committer | Marshall Greenblatt <magreenblatt@gmail.com> | 2023-02-17 16:04:28 -0500 |
commit | b7ba0b9a66f72d63b5035c159956eb4bc21fa8b2 (patch) | |
tree | e52821d315e6f5fad5e1c2ab2b447cc38af506aa | |
parent | 719fe7691b1a4113d55c01df7453fb9763d9365a (diff) | |
download | cef-b7ba0b9a66f72d63b5035c159956eb4bc21fa8b2.tar.gz |
chrome: Make primary user profile the default global context (see issue #3444)
Chrome is always loading the primary user profile by default, so with this
change the CEF behavior more accurately reflects reality. Incognito contexts
can still be created explicitly via CefRequestContext::CreateContext.
Prior to this change, the default for the global context was an Incognito
profile based on the primary user profile. That caused request interception
to be bypassed in WillCreateURLLoaderFactory for profiles associated with
the "New window" and "New incognito window" commands. Those profiles, while
also being (or based on) the primary user profile, did not match the specific
Incognito profile assigned to the default global context.
After this change, the "New window" and "New incognito window" commands will
match the default global context when executed on a browser that was created
using the primary user profile.
-rw-r--r-- | libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc index a069d7aa..87aa49fa 100644 --- a/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc +++ b/libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc @@ -11,6 +11,7 @@ #include "libcef/browser/permission_prompt.h" #include "base/task/thread_pool.h" +#include "chrome/browser/profiles/profile.h" ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default; @@ -25,6 +26,9 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile, CefRequestContextSettings settings; CefContext::Get()->PopulateGlobalRequestContextSettings(&settings); + // Use the existing path for the initial profile. + CefString(&settings.cache_path) = profile->GetPath().value(); + // Create the global RequestContext. global_request_context_ = CefRequestContextImpl::CreateGlobalRequestContext(settings); |