2020-06-24 22:34:12 -04:00
|
|
|
// 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"
|
|
|
|
|
2021-04-08 19:15:51 -04:00
|
|
|
#include "libcef/browser/chrome/chrome_context_menu_handler.h"
|
2020-07-03 22:51:17 -04:00
|
|
|
#include "libcef/browser/context.h"
|
2022-04-15 15:55:23 -04:00
|
|
|
#include "libcef/browser/file_dialog_runner.h"
|
2021-02-15 18:24:28 -05:00
|
|
|
#include "libcef/browser/net/chrome_scheme_handler.h"
|
2022-07-07 10:01:24 +00:00
|
|
|
#include "libcef/browser/permission_prompt.h"
|
2020-07-03 22:51:17 -04:00
|
|
|
|
2021-04-20 18:52:34 -04:00
|
|
|
#include "base/task/thread_pool.h"
|
2020-06-24 22:34:12 -04:00
|
|
|
|
|
|
|
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
|
|
|
|
|
|
|
|
ChromeBrowserMainExtraPartsCef::~ChromeBrowserMainExtraPartsCef() = default;
|
|
|
|
|
2022-01-25 15:26:51 -05:00
|
|
|
void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
|
|
|
|
bool is_initial_profile) {
|
|
|
|
if (!is_initial_profile)
|
|
|
|
return;
|
|
|
|
|
2020-07-03 22:51:17 -04:00
|
|
|
CefRequestContextSettings settings;
|
|
|
|
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
|
|
|
|
|
|
|
// Create the global RequestContext.
|
|
|
|
global_request_context_ =
|
|
|
|
CefRequestContextImpl::CreateGlobalRequestContext(settings);
|
|
|
|
}
|
|
|
|
|
2020-09-24 21:40:47 -04:00
|
|
|
void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
|
2021-04-20 18:52:34 -04:00
|
|
|
background_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
|
|
{base::TaskPriority::BEST_EFFORT,
|
2020-06-24 22:34:12 -04:00
|
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
2021-04-20 18:52:34 -04:00
|
|
|
user_visible_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
|
|
{base::TaskPriority::USER_VISIBLE,
|
2020-06-24 22:34:12 -04:00
|
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
2021-04-20 18:52:34 -04:00
|
|
|
user_blocking_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
|
|
|
|
{base::TaskPriority::USER_BLOCKING,
|
2020-06-24 22:34:12 -04:00
|
|
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
2021-02-15 18:24:28 -05:00
|
|
|
|
|
|
|
scheme::RegisterWebUIControllerFactory();
|
2021-04-08 19:15:51 -04:00
|
|
|
context_menu::RegisterMenuCreatedCallback();
|
2022-04-15 15:55:23 -04:00
|
|
|
file_dialog_runner::RegisterFactory();
|
2022-07-07 10:01:24 +00:00
|
|
|
permission_prompt::RegisterCreateCallback();
|
2020-06-24 22:34:12 -04:00
|
|
|
}
|