mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-31 11:35:19 +01:00
73082fd2ce
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.
53 lines
2.0 KiB
C++
53 lines
2.0 KiB
C++
// Copyright 2019 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h"
|
|
|
|
#include "libcef/browser/chrome/chrome_context_menu_handler.h"
|
|
#include "libcef/browser/context.h"
|
|
#include "libcef/browser/file_dialog_runner.h"
|
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
|
#include "libcef/browser/permission_prompt.h"
|
|
|
|
#include "base/task/thread_pool.h"
|
|
#include "chrome/browser/profiles/profile.h"
|
|
|
|
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
|
|
|
ChromeBrowserMainExtraPartsCef::~ChromeBrowserMainExtraPartsCef() = default;
|
|
|
|
void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
|
|
bool is_initial_profile) {
|
|
if (!is_initial_profile) {
|
|
return;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
|
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
{base::TaskPriority::BEST_EFFORT,
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
|
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
{base::TaskPriority::USER_VISIBLE,
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
|
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
{base::TaskPriority::USER_BLOCKING,
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
|
|
|
scheme::RegisterWebUIControllerFactory();
|
|
context_menu::RegisterMenuCreatedCallback();
|
|
file_dialog_runner::RegisterFactory();
|
|
permission_prompt::RegisterCreateCallback();
|
|
}
|