refactor: more cleanup of chromium_src (#15424)
This commit is contained in:
parent
c422011d58
commit
a19d20cfb8
13 changed files with 54 additions and 301 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "atom/browser/atom_paths.h"
|
||||
#include "atom/browser/atom_web_ui_controller_factory.h"
|
||||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/browser_process_impl.h"
|
||||
#include "atom/browser/io_thread.h"
|
||||
#include "atom/browser/javascript_environment.h"
|
||||
#include "atom/browser/media/media_capture_devices_dispatcher.h"
|
||||
|
@ -34,7 +35,6 @@
|
|||
#include "base/path_service.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/browser/browser_process_impl.h"
|
||||
#include "chrome/browser/icon_manager.h"
|
||||
#include "chrome/browser/net/chrome_net_log_helper.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
|
|
220
atom/browser/browser_process_impl.cc
Normal file
220
atom/browser/browser_process_impl.cc
Normal file
|
@ -0,0 +1,220 @@
|
|||
// Copyright (c) 2012 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 "atom/browser/browser_process_impl.h"
|
||||
|
||||
#include "chrome/browser/printing/print_job_manager.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
BrowserProcessImpl::BrowserProcessImpl() : print_job_manager_(nullptr) {
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
print_job_manager_.reset(new printing::PrintJobManager());
|
||||
#endif
|
||||
g_browser_process = this;
|
||||
}
|
||||
|
||||
BrowserProcessImpl::~BrowserProcessImpl() {
|
||||
g_browser_process = nullptr;
|
||||
}
|
||||
|
||||
bool BrowserProcessImpl::IsShuttingDown() {
|
||||
return false;
|
||||
}
|
||||
|
||||
metrics_services_manager::MetricsServicesManager*
|
||||
BrowserProcessImpl::GetMetricsServicesManager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
metrics::MetricsService* BrowserProcessImpl::metrics_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* BrowserProcessImpl::rappor_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProfileManager* BrowserProcessImpl::profile_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrefService* BrowserProcessImpl::local_state() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* BrowserProcessImpl::system_request_context() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
BrowserProcessImpl::shared_url_loader_factory() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
variations::VariationsService* BrowserProcessImpl::variations_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BrowserProcessPlatformPart* BrowserProcessImpl::platform_part() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extensions::EventRouterForwarder*
|
||||
BrowserProcessImpl::extension_event_router_forwarder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NotificationUIManager* BrowserProcessImpl::notification_ui_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NotificationPlatformBridge* BrowserProcessImpl::notification_platform_bridge() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IOThread* BrowserProcessImpl::io_thread() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SystemNetworkContextManager*
|
||||
BrowserProcessImpl::system_network_context_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
network::NetworkQualityTracker* BrowserProcessImpl::network_quality_tracker() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WatchDogThread* BrowserProcessImpl::watchdog_thread() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::ChromeBrowserPolicyConnector*
|
||||
BrowserProcessImpl::browser_policy_connector() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::PolicyService* BrowserProcessImpl::policy_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IconManager* BrowserProcessImpl::icon_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpuModeManager* BrowserProcessImpl::gpu_mode_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
printing::PrintPreviewDialogController*
|
||||
BrowserProcessImpl::print_preview_dialog_controller() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
printing::BackgroundPrintingManager*
|
||||
BrowserProcessImpl::background_printing_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IntranetRedirectDetector* BrowserProcessImpl::intranet_redirect_detector() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DownloadStatusUpdater* BrowserProcessImpl::download_status_updater() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BackgroundModeManager* BrowserProcessImpl::background_mode_manager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StatusTray* BrowserProcessImpl::status_tray() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
safe_browsing::SafeBrowsingService*
|
||||
BrowserProcessImpl::safe_browsing_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
safe_browsing::ClientSideDetectionService*
|
||||
BrowserProcessImpl::safe_browsing_detection_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
subresource_filter::ContentRulesetService*
|
||||
BrowserProcessImpl::subresource_filter_ruleset_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
optimization_guide::OptimizationGuideService*
|
||||
BrowserProcessImpl::optimization_guide_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
net_log::ChromeNetLog* BrowserProcessImpl::net_log() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
component_updater::ComponentUpdateService*
|
||||
BrowserProcessImpl::component_updater() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
BrowserProcessImpl::supervised_user_whitelist_installer() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MediaFileSystemRegistry* BrowserProcessImpl::media_file_system_registry() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebRtcLogUploader* BrowserProcessImpl::webrtc_log_uploader() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
network_time::NetworkTimeTracker* BrowserProcessImpl::network_time_tracker() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gcm::GCMDriver* BrowserProcessImpl::gcm_driver() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::TabManager* BrowserProcessImpl::GetTabManager() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
shell_integration::DefaultWebClientState
|
||||
BrowserProcessImpl::CachedDefaultWebClientState() {
|
||||
return shell_integration::UNKNOWN_DEFAULT;
|
||||
}
|
||||
|
||||
prefs::InProcessPrefServiceFactory* BrowserProcessImpl::pref_service_factory()
|
||||
const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::NetworkConnectionTracker*
|
||||
BrowserProcessImpl::network_connection_tracker() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
|
||||
locale_ = locale;
|
||||
}
|
||||
|
||||
const std::string& BrowserProcessImpl::GetApplicationLocale() {
|
||||
return locale_;
|
||||
}
|
||||
|
||||
printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
|
||||
return print_job_manager_.get();
|
||||
}
|
107
atom/browser/browser_process_impl.h
Normal file
107
atom/browser/browser_process_impl.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Copyright (c) 2012 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.
|
||||
|
||||
// This interface is for managing the global services of the application. Each
|
||||
// service is lazily created when requested the first time. The service getters
|
||||
// will return NULL if the service is not available, so callers must check for
|
||||
// this condition.
|
||||
|
||||
#ifndef ATOM_BROWSER_BROWSER_PROCESS_IMPL_H_
|
||||
#define ATOM_BROWSER_BROWSER_PROCESS_IMPL_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
namespace printing {
|
||||
class PrintJobManager;
|
||||
}
|
||||
|
||||
// Empty definition for std::unique_ptr
|
||||
class BackgroundModeManager {};
|
||||
|
||||
// NOT THREAD SAFE, call only from the main thread.
|
||||
// These functions shouldn't return NULL unless otherwise noted.
|
||||
class BrowserProcessImpl : public BrowserProcess {
|
||||
public:
|
||||
BrowserProcessImpl();
|
||||
~BrowserProcessImpl() override;
|
||||
|
||||
void ResourceDispatcherHostCreated() override {}
|
||||
void EndSession() override {}
|
||||
void FlushLocalStateAndReply(base::OnceClosure reply) override {}
|
||||
bool IsShuttingDown() override;
|
||||
|
||||
metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
|
||||
override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
PrefService* local_state() override;
|
||||
net::URLRequestContextGetter* system_request_context() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
|
||||
override;
|
||||
variations::VariationsService* variations_service() override;
|
||||
BrowserProcessPlatformPart* platform_part() override;
|
||||
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
|
||||
NotificationUIManager* notification_ui_manager() override;
|
||||
NotificationPlatformBridge* notification_platform_bridge() override;
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
network::NetworkQualityTracker* network_quality_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
|
||||
policy::PolicyService* policy_service() override;
|
||||
IconManager* icon_manager() override;
|
||||
GpuModeManager* gpu_mode_manager() override;
|
||||
printing::PrintPreviewDialogController* print_preview_dialog_controller()
|
||||
override;
|
||||
printing::BackgroundPrintingManager* background_printing_manager() override;
|
||||
IntranetRedirectDetector* intranet_redirect_detector() override;
|
||||
DownloadStatusUpdater* download_status_updater() override;
|
||||
DownloadRequestLimiter* download_request_limiter() override;
|
||||
BackgroundModeManager* background_mode_manager() override;
|
||||
StatusTray* status_tray() override;
|
||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
safe_browsing::ClientSideDetectionService* safe_browsing_detection_service()
|
||||
override;
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter_ruleset_service() override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
override;
|
||||
net_log::ChromeNetLog* net_log() override;
|
||||
component_updater::ComponentUpdateService* component_updater() override;
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
supervised_user_whitelist_installer() override;
|
||||
MediaFileSystemRegistry* media_file_system_registry() override;
|
||||
WebRtcLogUploader* webrtc_log_uploader() override;
|
||||
network_time::NetworkTimeTracker* network_time_tracker() override;
|
||||
gcm::GCMDriver* gcm_driver() override;
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
|
||||
override;
|
||||
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
|
||||
content::NetworkConnectionTracker* network_connection_tracker() override;
|
||||
void CreateDevToolsProtocolHandler() override {}
|
||||
void CreateDevToolsAutoOpener() override {}
|
||||
void set_background_mode_manager_for_test(
|
||||
std::unique_ptr<BackgroundModeManager> manager) override {}
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX))
|
||||
void StartAutoupdateTimer() override {}
|
||||
#endif
|
||||
void SetApplicationLocale(const std::string& locale) override;
|
||||
const std::string& GetApplicationLocale() override;
|
||||
printing::PrintJobManager* print_job_manager() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
|
||||
std::string locale_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
|
||||
};
|
||||
|
||||
#endif // ATOM_BROWSER_BROWSER_PROCESS_IMPL_H_
|
Loading…
Add table
Add a link
Reference in a new issue