2013-10-23 21:30:47 +02:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions (c) 2011 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_browser_process_stub.h"
|
|
|
|
|
2016-08-04 14:37:53 +02:00
|
|
|
#include "libcef/browser/browser_context_impl.h"
|
2016-07-18 23:22:22 +02:00
|
|
|
#include "libcef/browser/chrome_profile_manager_stub.h"
|
|
|
|
#include "libcef/browser/thread_util.h"
|
|
|
|
#include "libcef/common/cef_switches.h"
|
|
|
|
|
|
|
|
#include "base/command_line.h"
|
2016-11-07 20:14:09 +01:00
|
|
|
#include "chrome/browser/net/chrome_net_log_helper.h"
|
2016-07-18 23:22:22 +02:00
|
|
|
#include "chrome/browser/printing/print_job_manager.h"
|
2016-11-07 20:14:09 +01:00
|
|
|
#include "components/net_log/chrome_net_log.h"
|
|
|
|
#include "content/public/common/content_switches.h"
|
2013-10-23 21:30:47 +02:00
|
|
|
#include "ui/message_center/message_center.h"
|
|
|
|
|
|
|
|
ChromeBrowserProcessStub::ChromeBrowserProcessStub()
|
2016-07-18 23:22:22 +02:00
|
|
|
: initialized_(false),
|
2016-11-07 20:14:09 +01:00
|
|
|
context_initialized_(false),
|
2016-07-18 23:22:22 +02:00
|
|
|
shutdown_(false),
|
|
|
|
locale_("en-US") {
|
2016-08-04 14:37:53 +02:00
|
|
|
chrome::SetBrowserContextIncognitoHelper(this);
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ChromeBrowserProcessStub::~ChromeBrowserProcessStub() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK((!initialized_ && !context_initialized_) || shutdown_);
|
2013-10-23 21:30:47 +02:00
|
|
|
g_browser_process = NULL;
|
2016-08-04 14:37:53 +02:00
|
|
|
chrome::SetBrowserContextIncognitoHelper(nullptr);
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
void ChromeBrowserProcessStub::Initialize(
|
|
|
|
const base::CommandLine& command_line) {
|
2016-07-18 23:22:22 +02:00
|
|
|
DCHECK(!initialized_);
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(!context_initialized_);
|
|
|
|
DCHECK(!shutdown_);
|
|
|
|
|
|
|
|
base::FilePath net_log_path;
|
|
|
|
if (command_line.HasSwitch(switches::kLogNetLog))
|
|
|
|
net_log_path = command_line.GetSwitchValuePath(switches::kLogNetLog);
|
|
|
|
net_log_.reset(new net_log::ChromeNetLog(
|
|
|
|
net_log_path, GetNetCaptureModeFromCommandLine(command_line),
|
|
|
|
command_line.GetCommandLineString(), std::string()));
|
|
|
|
|
|
|
|
initialized_ = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::OnContextInitialized() {
|
|
|
|
CEF_REQUIRE_UIT();
|
|
|
|
DCHECK(initialized_);
|
|
|
|
DCHECK(!context_initialized_);
|
2016-07-18 23:22:22 +02:00
|
|
|
DCHECK(!shutdown_);
|
|
|
|
|
|
|
|
// Must be created after the NotificationService.
|
|
|
|
print_job_manager_.reset(new printing::PrintJobManager());
|
|
|
|
profile_manager_.reset(new ChromeProfileManagerStub());
|
|
|
|
event_router_forwarder_ = new extensions::EventRouterForwarder();
|
|
|
|
|
2016-11-07 20:14:09 +01:00
|
|
|
context_initialized_ = true;
|
2016-07-18 23:22:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::Shutdown() {
|
|
|
|
CEF_REQUIRE_UIT();
|
|
|
|
DCHECK(initialized_);
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(context_initialized_);
|
2016-07-18 23:22:22 +02:00
|
|
|
DCHECK(!shutdown_);
|
|
|
|
|
|
|
|
// Wait for the pending print jobs to finish. Don't do this later, since
|
|
|
|
// this might cause a nested message loop to run, and we don't want pending
|
|
|
|
// tasks to run once teardown has started.
|
|
|
|
print_job_manager_->Shutdown();
|
|
|
|
print_job_manager_.reset(NULL);
|
|
|
|
|
|
|
|
profile_manager_.reset();
|
|
|
|
event_router_forwarder_ = nullptr;
|
|
|
|
|
|
|
|
shutdown_ = true;
|
|
|
|
}
|
|
|
|
|
2013-10-23 21:30:47 +02:00
|
|
|
void ChromeBrowserProcessStub::ResourceDispatcherHostCreated() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::EndSession() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
};
|
|
|
|
|
2015-11-10 21:18:16 +01:00
|
|
|
metrics_services_manager::MetricsServicesManager*
|
|
|
|
ChromeBrowserProcessStub::GetMetricsServicesManager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2014-06-12 22:28:58 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-04 19:53:40 +02:00
|
|
|
metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-04-04 18:50:38 +02:00
|
|
|
rappor::RapporService* ChromeBrowserProcessStub::rappor_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2014-04-04 18:50:38 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 21:30:47 +02:00
|
|
|
IOThread* ChromeBrowserProcessStub::io_thread() {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(context_initialized_);
|
2016-07-18 23:22:22 +02:00
|
|
|
return profile_manager_.get();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
PrefService* ChromeBrowserProcessStub::local_state() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(context_initialized_);
|
|
|
|
return profile_manager_->GetLastUsedProfile(
|
|
|
|
profile_manager_->user_data_dir())->GetPrefs();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
net::URLRequestContextGetter*
|
|
|
|
ChromeBrowserProcessStub::system_request_context() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
variations::VariationsService*
|
2013-10-23 21:30:47 +02:00
|
|
|
ChromeBrowserProcessStub::variations_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BrowserProcessPlatformPart* ChromeBrowserProcessStub::platform_part() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
extensions::EventRouterForwarder*
|
|
|
|
ChromeBrowserProcessStub::extension_event_router_forwarder() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(context_initialized_);
|
2016-07-18 23:22:22 +02:00
|
|
|
return event_router_forwarder_.get();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
NotificationUIManager* ChromeBrowserProcessStub::notification_ui_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-05-25 01:35:43 +02:00
|
|
|
NotificationPlatformBridge*
|
|
|
|
ChromeBrowserProcessStub::notification_platform_bridge() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-05-25 01:35:43 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 21:30:47 +02:00
|
|
|
message_center::MessageCenter* ChromeBrowserProcessStub::message_center() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
policy::BrowserPolicyConnector*
|
|
|
|
ChromeBrowserProcessStub::browser_policy_connector() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
IconManager* ChromeBrowserProcessStub::icon_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-08-31 13:25:56 +02:00
|
|
|
GpuProfileCache* ChromeBrowserProcessStub::gpu_profile_cache() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
|
|
|
|
const std::string& ip,
|
2016-01-06 20:20:54 +01:00
|
|
|
uint16_t port) {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-03-16 03:55:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::CreateDevToolsAutoOpener() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ChromeBrowserProcessStub::IsShuttingDown() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
printing::PrintJobManager* ChromeBrowserProcessStub::print_job_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(context_initialized_);
|
2016-07-18 23:22:22 +02:00
|
|
|
return print_job_manager_.get();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printing::PrintPreviewDialogController*
|
|
|
|
ChromeBrowserProcessStub::print_preview_dialog_controller() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
printing::BackgroundPrintingManager*
|
|
|
|
ChromeBrowserProcessStub::background_printing_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
IntranetRedirectDetector*
|
|
|
|
ChromeBrowserProcessStub::intranet_redirect_detector() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string &ChromeBrowserProcessStub::GetApplicationLocale() {
|
|
|
|
DCHECK(!locale_.empty());
|
|
|
|
return locale_;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::SetApplicationLocale(const std::string& locale) {
|
|
|
|
locale_ = locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
DownloadStatusUpdater* ChromeBrowserProcessStub::download_status_updater() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
DownloadRequestLimiter* ChromeBrowserProcessStub::download_request_limiter() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BackgroundModeManager* ChromeBrowserProcessStub::background_mode_manager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeBrowserProcessStub::set_background_mode_manager_for_test(
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<BackgroundModeManager> manager) {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusTray* ChromeBrowserProcessStub::status_tray() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-12-09 17:10:16 +01:00
|
|
|
safe_browsing::SafeBrowsingService*
|
|
|
|
ChromeBrowserProcessStub::safe_browsing_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
safe_browsing::ClientSideDetectionService*
|
|
|
|
ChromeBrowserProcessStub::safe_browsing_detection_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-07-06 21:34:09 +02:00
|
|
|
subresource_filter::RulesetService*
|
|
|
|
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-07-06 21:34:09 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 21:30:47 +02:00
|
|
|
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
|
|
|
void ChromeBrowserProcessStub::StartAutoupdateTimer() {
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
|
2016-11-07 20:14:09 +01:00
|
|
|
DCHECK(initialized_);
|
|
|
|
return net_log_.get();
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
2014-02-05 21:35:45 +01:00
|
|
|
component_updater::ComponentUpdateService*
|
|
|
|
ChromeBrowserProcessStub::component_updater() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-10-14 17:56:41 +02:00
|
|
|
return NULL;
|
2013-10-23 21:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-05 21:35:45 +01:00
|
|
|
component_updater::PnaclComponentInstaller*
|
|
|
|
ChromeBrowserProcessStub::pnacl_component_installer() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-03-04 02:00:13 +01:00
|
|
|
component_updater::SupervisedUserWhitelistInstaller*
|
|
|
|
ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2015-03-04 02:00:13 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 21:30:47 +02:00
|
|
|
MediaFileSystemRegistry*
|
|
|
|
ChromeBrowserProcessStub::media_file_system_registry() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ChromeBrowserProcessStub::created_local_state() const {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(ENABLE_WEBRTC)
|
|
|
|
WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2013-10-23 21:30:47 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|
2014-05-29 19:15:34 +02:00
|
|
|
|
2014-06-12 22:28:58 +02:00
|
|
|
network_time::NetworkTimeTracker*
|
|
|
|
ChromeBrowserProcessStub::network_time_tracker() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2014-06-12 22:28:58 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gcm::GCMDriver* ChromeBrowserProcessStub::gcm_driver() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2014-05-29 19:15:34 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2015-07-24 02:06:56 +02:00
|
|
|
|
2016-03-16 03:55:59 +01:00
|
|
|
shell_integration::DefaultWebClientState
|
2015-08-14 16:41:08 +02:00
|
|
|
ChromeBrowserProcessStub::CachedDefaultWebClientState() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-03-16 03:55:59 +01:00
|
|
|
return shell_integration::UNKNOWN_DEFAULT;
|
2015-08-14 16:41:08 +02:00
|
|
|
}
|
2015-10-09 17:23:12 +02:00
|
|
|
|
|
|
|
memory::TabManager* ChromeBrowserProcessStub::GetTabManager() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2015-10-09 17:23:12 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
2016-08-04 14:37:53 +02:00
|
|
|
|
2016-10-21 21:52:29 +02:00
|
|
|
PhysicalWebDataSource* ChromeBrowserProcessStub::GetPhysicalWebDataSource() {
|
2016-11-07 20:14:09 +01:00
|
|
|
NOTREACHED();
|
2016-10-21 21:52:29 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-08-04 14:37:53 +02:00
|
|
|
content::BrowserContext*
|
|
|
|
ChromeBrowserProcessStub::GetBrowserContextRedirectedInIncognito(
|
|
|
|
content::BrowserContext* context) {
|
|
|
|
return CefBrowserContextImpl::GetForContext(context).get();
|
|
|
|
}
|
|
|
|
|
|
|
|
content::BrowserContext*
|
|
|
|
ChromeBrowserProcessStub::GetBrowserContextOwnInstanceInIncognito(
|
|
|
|
content::BrowserContext* context) {
|
|
|
|
return GetBrowserContextRedirectedInIncognito(context);
|
|
|
|
}
|