1 // Copyright (c) 2013 The Chromium Embedded Framework Authors. 2 // Portions (c) 2011 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 // This file provides a stub implementation of Chrome's BrowserProcess object 7 // for use as an interop layer between CEF and files that live in chrome/. 8 9 #ifndef CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ 10 #define CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ 11 12 #include <memory> 13 #include <string> 14 15 #include "base/compiler_specific.h" 16 #include "base/metrics/field_trial.h" 17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/extensions/event_router_forwarder.h" 19 #include "media/media_buildflags.h" 20 21 namespace extensions { 22 class ExtensionsBrowserClient; 23 class ExtensionsClient; 24 } // namespace extensions 25 26 class ChromeProfileManagerAlloy; 27 28 class BackgroundModeManager { 29 public: 30 BackgroundModeManager(); 31 32 BackgroundModeManager(const BackgroundModeManager&) = delete; 33 BackgroundModeManager& operator=(const BackgroundModeManager&) = delete; 34 35 virtual ~BackgroundModeManager(); 36 }; 37 38 class ChromeBrowserProcessAlloy : public BrowserProcess { 39 public: 40 ChromeBrowserProcessAlloy(); 41 42 ChromeBrowserProcessAlloy(const ChromeBrowserProcessAlloy&) = delete; 43 ChromeBrowserProcessAlloy& operator=(const ChromeBrowserProcessAlloy&) = 44 delete; 45 46 ~ChromeBrowserProcessAlloy() override; 47 48 void Initialize(); 49 void OnContextInitialized(); 50 void CleanupOnUIThread(); 51 52 // BrowserProcess implementation. 53 void EndSession() override; 54 void FlushLocalStateAndReply(base::OnceClosure reply) override; 55 metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager() 56 override; 57 metrics::MetricsService* metrics_service() override; 58 SystemNetworkContextManager* system_network_context_manager() override; 59 network::NetworkQualityTracker* network_quality_tracker() override; 60 ProfileManager* profile_manager() override; 61 PrefService* local_state() override; 62 scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory() 63 override; 64 variations::VariationsService* variations_service() override; 65 BrowserProcessPlatformPart* platform_part() override; 66 extensions::EventRouterForwarder* extension_event_router_forwarder() override; 67 NotificationUIManager* notification_ui_manager() override; 68 NotificationPlatformBridge* notification_platform_bridge() override; 69 policy::ChromeBrowserPolicyConnector* browser_policy_connector() override; 70 policy::PolicyService* policy_service() override; 71 IconManager* icon_manager() override; 72 GpuModeManager* gpu_mode_manager() override; 73 void CreateDevToolsProtocolHandler() override; 74 void CreateDevToolsAutoOpener() override; 75 bool IsShuttingDown() override; 76 printing::PrintJobManager* print_job_manager() override; 77 printing::PrintPreviewDialogController* print_preview_dialog_controller() 78 override; 79 printing::BackgroundPrintingManager* background_printing_manager() override; 80 IntranetRedirectDetector* intranet_redirect_detector() override; 81 const std::string& GetApplicationLocale() override; 82 void SetApplicationLocale(const std::string& locale) override; 83 DownloadStatusUpdater* download_status_updater() override; 84 DownloadRequestLimiter* download_request_limiter() override; 85 #if BUILDFLAG(ENABLE_BACKGROUND_MODE) 86 BackgroundModeManager* background_mode_manager() override; 87 void set_background_mode_manager_for_test( 88 std::unique_ptr<BackgroundModeManager> manager) override; 89 #endif 90 StatusTray* status_tray() override; 91 safe_browsing::SafeBrowsingService* safe_browsing_service() override; 92 subresource_filter::RulesetService* subresource_filter_ruleset_service() 93 override; 94 federated_learning::FlocSortingLshClustersService* 95 floc_sorting_lsh_clusters_service() override; 96 StartupData* startup_data() override; 97 98 #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) 99 void StartAutoupdateTimer() override; 100 #endif 101 102 component_updater::ComponentUpdateService* component_updater() override; 103 MediaFileSystemRegistry* media_file_system_registry() override; 104 WebRtcLogUploader* webrtc_log_uploader() override; 105 network_time::NetworkTimeTracker* network_time_tracker() override; 106 gcm::GCMDriver* gcm_driver() override; 107 resource_coordinator::TabManager* GetTabManager() override; 108 resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts() 109 override; 110 BuildState* GetBuildState() override; 111 SerialPolicyAllowedPorts* serial_policy_allowed_ports() override; 112 breadcrumbs::BreadcrumbPersistentStorageManager* 113 GetBreadcrumbPersistentStorageManager() override; 114 115 private: 116 bool initialized_; 117 bool context_initialized_; 118 bool shutdown_; 119 120 std::unique_ptr<extensions::ExtensionsClient> extensions_client_; 121 std::unique_ptr<extensions::ExtensionsBrowserClient> 122 extensions_browser_client_; 123 124 std::string locale_; 125 std::unique_ptr<printing::PrintJobManager> print_job_manager_; 126 std::unique_ptr<ChromeProfileManagerAlloy> profile_manager_; 127 scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_; 128 scoped_refptr<printing::PrintPreviewDialogController> 129 print_preview_dialog_controller_; 130 std::unique_ptr<printing::BackgroundPrintingManager> 131 background_printing_manager_; 132 std::unique_ptr<PrefService> local_state_; 133 // Must be destroyed after |local_state_|. 134 std::unique_ptr<policy::ChromeBrowserPolicyConnector> 135 browser_policy_connector_; 136 std::unique_ptr<base::FieldTrialList> field_trial_list_; 137 138 std::unique_ptr<component_updater::ComponentUpdateService> component_updater_; 139 }; 140 141 #endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ 142