blob: e63afefc769d6ea3657eafa3013bfa851393a239 [file] [log] [blame]
[email protected]3a80ea332012-01-09 19:53:291// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
5// When each service is created, we set a flag indicating this. At this point,
6// the service initialization could fail or succeed. This allows us to remember
7// if we tried to create a service, and not try creating it over and over if
8// the creation failed.
9
[email protected]58dca552009-06-17 00:35:0210#ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
11#define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
initial.commit09911bf2008-07-26 23:55:2912
avie4d7b6f2015-12-26 00:59:1813#include <stdint.h>
14
dcheng4af48582016-04-19 00:29:3515#include <memory>
initial.commit09911bf2008-07-26 23:55:2916#include <string>
17
avie4d7b6f2015-12-26 00:59:1818#include "base/macros.h"
[email protected]80745e32012-05-08 01:22:1219#include "base/memory/ref_counted.h"
gab25894fe2017-05-30 03:40:3620#include "base/sequence_checker.h"
[email protected]4dcb7972013-06-28 15:15:4121#include "base/timer/timer.h"
avie4d7b6f2015-12-26 00:59:1822#include "build/build_config.h"
initial.commit09911bf2008-07-26 23:55:2923#include "chrome/browser/browser_process.h"
Scott Violet6200d332018-02-23 21:29:2324#include "chrome/common/buildflags.h"
Michael Giuffrida2dbce0d12017-09-02 03:30:5925#include "components/keep_alive_registry/keep_alive_state_observer.h"
Xi Han07bad2892018-10-04 15:13:5826#include "components/metrics_services_manager/metrics_services_manager.h"
Scott Violet9ae82892018-03-01 18:38:1227#include "components/nacl/common/buildflags.h"
Xi Handdb1ab12018-08-27 22:18:5428#include "components/prefs/persistent_pref_store.h"
brettwb1fc1b82016-02-02 00:19:0829#include "components/prefs/pref_change_registrar.h"
Scott Violetc8240b02018-03-08 22:03:5930#include "extensions/buildflags/buildflags.h"
Scott Violeta35f9a42018-03-22 22:00:4431#include "media/media_buildflags.h"
Scott Violet02e38b92018-03-27 23:42:1432#include "ppapi/buildflags/buildflags.h"
Scott Violet318a55f2018-03-30 19:08:1933#include "printing/buildflags/buildflags.h"
Tarun Bansal86b39222018-09-21 02:07:3234#include "services/network/public/cpp/network_quality_tracker.h"
Takuto Ikutaaa3b796c2019-02-06 02:54:5635#include "services/network/public/mojom/network_service.mojom-forward.h"
[email protected]b112a4c2009-02-01 20:24:0136
Greg Thompson08451a42020-02-04 23:45:5437#if !defined(OS_ANDROID)
38#include "chrome/browser/upgrade_detector/build_state.h"
39#endif
40
Ryan Sturmf0ad4292019-05-10 00:51:1041class BatteryMetrics;
Scott Violet875789e2018-02-02 07:46:4842class ChromeMetricsServicesManagerClient;
dgozman54cc54e2016-02-23 03:47:3043class DevToolsAutoOpener;
[email protected]4475d232011-07-27 15:29:2044class RemoteDebuggingServer;
[email protected]b1de2c72013-02-06 02:45:4745class PrefRegistrySimple;
Lukasz Anforowicz60d1253d2019-05-08 16:31:3746class SecureOriginPrefsObserver;
Lukasz Anforowicz65c61162019-03-27 20:33:5847class SiteIsolationPrefsObserver;
Toni Barzicb598380e2018-11-26 19:14:1048class SystemNotificationHelper;
Xi Han85079c22019-04-18 21:43:0549class StartupData;
initial.commit09911bf2008-07-26 23:55:2950
bauerbecab4f52017-03-13 20:16:4151#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]2366a3a2012-10-02 20:41:1452class PluginsResourceService;
53#endif
54
[email protected]0de615a2012-11-08 04:40:5955namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1556class CommandLine;
[email protected]0de615a2012-11-08 04:40:5957}
58
[email protected]aa3dd492013-11-05 17:09:0959namespace extensions {
60class ExtensionsBrowserClient;
61}
62
[email protected]c027d6d2014-06-05 15:25:4063namespace gcm {
64class GCMDriver;
65}
66
[email protected]5b869962011-09-20 19:49:3367namespace policy {
Scott Violetfdd6f352018-01-12 19:12:2968class ChromeBrowserPolicyConnector;
[email protected]a4179c2a2012-02-09 18:14:2169class PolicyService;
Scott Violetfdd6f352018-01-12 19:12:2970} // namespace policy
[email protected]fcf53572011-06-29 15:44:3771
Elad Alon39b1f6cc2018-08-30 09:52:2172namespace webrtc_event_logging {
73class WebRtcEventLogManager;
74} // namespace webrtc_event_logging
75
initial.commit09911bf2008-07-26 23:55:2976// Real implementation of BrowserProcess that creates and returns the services.
[email protected]6618d1d2010-12-15 21:18:4777class BrowserProcessImpl : public BrowserProcess,
dgnfe075c82016-03-18 11:25:3578 public KeepAliveStateObserver {
initial.commit09911bf2008-07-26 23:55:2979 public:
Xi Han85079c22019-04-18 21:43:0580 // |startup_data| should not be null. The BrowserProcessImpl
Xi Han07bad2892018-10-04 15:13:5881 // will take the PrefService owned by the creator as the Local State instead
82 // of loading the JSON file from disk.
Xi Han85079c22019-04-18 21:43:0583 explicit BrowserProcessImpl(StartupData* startup_data);
Daniel Chenga542fca2014-10-21 09:51:2984 ~BrowserProcessImpl() override;
initial.commit09911bf2008-07-26 23:55:2985
Scott Violet875789e2018-02-02 07:46:4886 // Called to complete initialization.
87 void Init();
88
Wez25fd35f2018-05-25 22:57:4189#if !defined(OS_ANDROID)
Greg Thompson822ab51a2018-09-18 06:45:2990 // Sets a closure to be run to break out of a run loop on browser shutdown
91 // (when the KeepAlive count reaches zero).
92 // TODO(https://crbug.com/845966): This is also used on macOS for the Cocoa
93 // first run dialog so that shutdown can be initiated via a signal while the
94 // first run dialog is showing.
Filip Gorski209a3472018-08-27 23:03:4195 void SetQuitClosure(base::OnceClosure quit_closure);
Wez25fd35f2018-05-25 22:57:4196#endif
97
Avi Drissman2e458df2020-07-29 16:24:3198#if defined(OS_MAC)
Greg Thompson822ab51a2018-09-18 06:45:2999 // Clears the quit closure. Shutdown will not be initiated should the
100 // KeepAlive count reach zero. This function may be called more than once.
101 // TODO(https://crbug.com/845966): Remove this once the Cocoa first run
102 // dialog no longer needs it.
103 void ClearQuitClosure();
Wez25fd35f2018-05-25 22:57:41104#endif
105
[email protected]99907362012-01-11 05:41:40106 // Called before the browser threads are created.
Bernhard Bauer5533f9912017-11-06 17:56:02107 void PreCreateThreads(const base::CommandLine& command_line);
[email protected]2e5b60a22011-11-28 15:56:41108
[email protected]d2caaa22011-12-12 03:04:15109 // Called after the threads have been created but before the message loops
110 // starts running. Allows the browser process to do any initialization that
111 // requires all threads running.
112 void PreMainMessageLoopRun();
113
[email protected]2e5b60a22011-11-28 15:56:41114 // Most cleanup is done by these functions, driven from
115 // ChromeBrowserMain based on notifications from the content
116 // framework, rather than in the destructor, so that we can
117 // interleave cleanup with threads being stopped.
thestigd75ce5532015-10-05 22:08:34118#if !defined(OS_ANDROID)
[email protected]2e5b60a22011-11-28 15:56:41119 void StartTearDown();
[email protected]99907362012-01-11 05:41:40120 void PostDestroyThreads();
thestigd75ce5532015-10-05 22:08:34121#endif
[email protected]2e5b60a22011-11-28 15:56:41122
Xi Han07bad2892018-10-04 15:13:58123 // Sets |metrics_services_manager_| and |metrics_services_manager_client_|
124 // which is owned by it.
125 void SetMetricsServices(
126 std::unique_ptr<metrics_services_manager::MetricsServicesManager> manager,
127 metrics_services_manager::MetricsServicesManagerClient* client);
128
[email protected]80745e32012-05-08 01:22:12129 // BrowserProcess implementation.
Daniel Chenga542fca2014-10-21 09:51:29130 void EndSession() override;
Gabriel Charetteb1af7ffb2017-07-27 06:10:35131 void FlushLocalStateAndReply(base::OnceClosure reply) override;
blundell695d61f2015-10-21 11:25:53132 metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
133 override;
Daniel Chenga542fca2014-10-21 09:51:29134 metrics::MetricsService* metrics_service() override;
nzolghadrd87a308d2016-12-07 15:45:56135 rappor::RapporServiceImpl* rappor_service() override;
Min Qin8caab1d2018-10-03 17:28:13136 // TODO(qinmin): Remove this method as callers can retrieve the global
137 // instance from SystemNetworkContextManager directly.
Matt Menke21b9cc62017-08-23 15:45:45138 SystemNetworkContextManager* system_network_context_manager() override;
Antonio Gomesacd1a942018-07-10 20:23:54139 scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
140 override;
Tarun Bansalcd6a6cb2018-06-27 22:03:22141 network::NetworkQualityTracker* network_quality_tracker() override;
Daniel Chenga542fca2014-10-21 09:51:29142 WatchDogThread* watchdog_thread() override;
143 ProfileManager* profile_manager() override;
144 PrefService* local_state() override;
blundell57bcfed2015-09-04 08:44:45145 variations::VariationsService* variations_service() override;
Daniel Chenga542fca2014-10-21 09:51:29146 BrowserProcessPlatformPart* platform_part() override;
147 extensions::EventRouterForwarder* extension_event_router_forwarder() override;
148 NotificationUIManager* notification_ui_manager() override;
miguelg23cd2dd72016-04-21 15:24:03149 NotificationPlatformBridge* notification_platform_bridge() override;
Scott Violetfdd6f352018-01-12 19:12:29150 policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
Daniel Chenga542fca2014-10-21 09:51:29151 policy::PolicyService* policy_service() override;
152 IconManager* icon_manager() override;
Daniel Chenga542fca2014-10-21 09:51:29153 GpuModeManager* gpu_mode_manager() override;
Pavel Feldmanc9ae59c2018-02-13 16:15:15154 void CreateDevToolsProtocolHandler() override;
dgozman54cc54e2016-02-23 03:47:30155 void CreateDevToolsAutoOpener() override;
Daniel Chenga542fca2014-10-21 09:51:29156 bool IsShuttingDown() override;
157 printing::PrintJobManager* print_job_manager() override;
158 printing::PrintPreviewDialogController* print_preview_dialog_controller()
159 override;
160 printing::BackgroundPrintingManager* background_printing_manager() override;
Tommy Lid5b7c22b2020-10-28 01:26:51161#if !defined(OS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29162 IntranetRedirectDetector* intranet_redirect_detector() override;
Tommy Lid5b7c22b2020-10-28 01:26:51163#endif
Daniel Chenga542fca2014-10-21 09:51:29164 const std::string& GetApplicationLocale() override;
Xi Han349162b2018-10-26 12:44:23165 void SetApplicationLocale(const std::string& actual_locale) override;
Daniel Chenga542fca2014-10-21 09:51:29166 DownloadStatusUpdater* download_status_updater() override;
167 DownloadRequestLimiter* download_request_limiter() override;
168 BackgroundModeManager* background_mode_manager() override;
169 void set_background_mode_manager_for_test(
dcheng4af48582016-04-19 00:29:35170 std::unique_ptr<BackgroundModeManager> manager) override;
Daniel Chenga542fca2014-10-21 09:51:29171 StatusTray* status_tray() override;
vakh9a474d832015-11-13 01:43:09172 safe_browsing::SafeBrowsingService* safe_browsing_service() override;
Eric Robinsonefb3ea552018-11-02 18:24:32173 subresource_filter::RulesetService* subresource_filter_ruleset_service()
174 override;
Yao Xiaocc8e0c42020-10-01 17:34:46175 federated_learning::FlocSortingLshClustersService*
176 floc_sorting_lsh_clusters_service() override;
Sophie Changf453c0522017-11-03 06:33:49177 optimization_guide::OptimizationGuideService* optimization_guide_service()
178 override;
[email protected]6641bf662009-08-21 00:34:09179
Xi Han9fd44002019-04-30 17:39:36180 StartupData* startup_data() override;
181
Michael Giuffridadc8030c2017-08-02 13:22:44182#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
dchenge1bc7982014-10-30 00:32:40183 void StartAutoupdateTimer() override;
[email protected]3cdacd42010-04-30 18:55:53184#endif
[email protected]bd48c2b02010-04-09 20:32:42185
Daniel Chenga542fca2014-10-21 09:51:29186 component_updater::ComponentUpdateService* component_updater() override;
Toby H5cfaf942019-07-25 22:54:50187#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
bauerb22951c32015-02-12 13:18:17188 component_updater::SupervisedUserWhitelistInstaller*
189 supervised_user_whitelist_installer() override;
Toby H5cfaf942019-07-25 22:54:50190#endif
Daniel Chenga542fca2014-10-21 09:51:29191 MediaFileSystemRegistry* media_file_system_registry() override;
Daniel Chenga542fca2014-10-21 09:51:29192 WebRtcLogUploader* webrtc_log_uploader() override;
Daniel Chenga542fca2014-10-21 09:51:29193 network_time::NetworkTimeTracker* network_time_tracker() override;
Adam Langley1cb73c72020-08-28 17:06:44194#if !defined(OS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29195 gcm::GCMDriver* gcm_driver() override;
Adam Langley1cb73c72020-08-28 17:06:44196#endif
lpyfedf65a2017-06-01 01:41:24197 resource_coordinator::TabManager* GetTabManager() override;
Sebastien Marchand2ebd9252018-11-08 18:39:35198 resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
199 override;
[email protected]ca167a32011-09-30 15:19:11200
Greg Thompson08451a42020-02-04 23:45:54201 BuildState* GetBuildState() override;
202
[email protected]b1de2c72013-02-06 02:45:47203 static void RegisterPrefs(PrefRegistrySimple* registry);
204
initial.commit09911bf2008-07-26 23:55:29205 private:
Elad Alon39b1f6cc2018-08-30 09:52:21206 using WebRtcEventLogManager = webrtc_event_logging::WebRtcEventLogManager;
207
dgnfe075c82016-03-18 11:25:35208 // KeepAliveStateObserver implementation
209 void OnKeepAliveStateChanged(bool is_keeping_alive) override;
210 void OnKeepAliveRestartStateChanged(bool can_restart) override;
211
Tarun Bansal86b39222018-09-21 02:07:32212 // Create network quality observer so that it can propagate network quality
213 // changes to the render process.
214 void CreateNetworkQualityObserver();
215
[email protected]0b565182011-03-02 18:11:15216 void CreateWatchdogThread();
initial.commit09911bf2008-07-26 23:55:29217 void CreateProfileManager();
initial.commit09911bf2008-07-26 23:55:29218 void CreateIconManager();
miguelg23cd2dd72016-04-21 15:24:03219 void CreateNotificationPlatformBridge();
[email protected]29672ab2009-10-30 03:44:03220 void CreateNotificationUIManager();
[email protected]d8ce31e2012-12-19 05:09:21221 void CreatePrintPreviewDialogController();
[email protected]68f88b992011-05-07 02:01:39222 void CreateBackgroundPrintingManager();
[email protected]462a0ff2011-06-02 17:15:34223 void CreateSafeBrowsingService();
engedyc5ef21ad2016-06-17 20:22:27224 void CreateSubresourceFilterRulesetService();
Yao Xiao431dec62020-06-25 14:13:06225 void CreateFlocBlocklistService();
Yao Xiaocc8e0c42020-10-01 17:34:46226 void CreateFlocSortingLshClustersService();
Sophie Changf453c0522017-11-03 06:33:49227 void CreateOptimizationGuideService();
[email protected]9e7f015f2011-05-28 00:24:25228 void CreateStatusTray();
229 void CreateBackgroundModeManager();
[email protected]c027d6d2014-06-05 15:25:40230 void CreateGCMDriver();
[email protected]a7a5e992010-12-09 23:39:51231
[email protected]b61f62a2011-11-01 02:02:10232 void ApplyDefaultBrowserPolicy();
[email protected]419a0572011-04-18 22:21:46233
dgnfe075c82016-03-18 11:25:35234 // Methods called to control our lifetime. The browser process can be "pinned"
235 // to make sure it keeps running.
236 void Pin();
237 void Unpin();
238
Greg Thompsond4ecaa92020-08-20 09:15:40239 StartupData* const startup_data_;
240
Scott Violetfdd6f352018-01-12 19:12:29241 bool created_watchdog_thread_ = false;
dcheng4af48582016-04-19 00:29:35242 std::unique_ptr<WatchDogThread> watchdog_thread_;
[email protected]0b565182011-03-02 18:11:15243
[email protected]3b19e8e2012-10-17 19:15:49244 // Must be destroyed after |local_state_|.
Scott Violetfdd6f352018-01-12 19:12:29245 std::unique_ptr<policy::ChromeBrowserPolicyConnector>
246 browser_policy_connector_;
[email protected]8d6b2432012-03-31 12:11:18247
Scott Violetfdd6f352018-01-12 19:12:29248 bool created_profile_manager_ = false;
dcheng4af48582016-04-19 00:29:35249 std::unique_ptr<ProfileManager> profile_manager_;
initial.commit09911bf2008-07-26 23:55:29250
dcheng4af48582016-04-19 00:29:35251 std::unique_ptr<PrefService> local_state_;
initial.commit09911bf2008-07-26 23:55:29252
Pavol Marko11f1bb42020-03-30 18:58:38253 // |metrics_services_manager_| owns this.
254 ChromeMetricsServicesManagerClient* metrics_services_manager_client_ =
255 nullptr;
256
257 // Must be destroyed before |local_state_|.
258 std::unique_ptr<metrics_services_manager::MetricsServicesManager>
259 metrics_services_manager_;
260
Tarun Bansalcd6a6cb2018-06-27 22:03:22261 std::unique_ptr<network::NetworkQualityTracker> network_quality_tracker_;
262
Tarun Bansal86b39222018-09-21 02:07:32263 // Listens to NetworkQualityTracker and sends network quality updates to the
264 // renderer.
265 std::unique_ptr<
266 network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver>
267 network_quality_observer_;
268
Scott Violetfdd6f352018-01-12 19:12:29269 bool created_icon_manager_ = false;
dcheng4af48582016-04-19 00:29:35270 std::unique_ptr<IconManager> icon_manager_;
initial.commit09911bf2008-07-26 23:55:29271
dcheng4af48582016-04-19 00:29:35272 std::unique_ptr<GpuModeManager> gpu_mode_manager_;
[email protected]e6933d2a2013-03-12 22:32:21273
brettw00899e62016-11-12 02:10:17274#if BUILDFLAG(ENABLE_EXTENSIONS)
dcheng4af48582016-04-19 00:29:35275 std::unique_ptr<extensions::ExtensionsBrowserClient>
276 extensions_browser_client_;
[email protected]84b7a552014-07-19 04:52:06277
[email protected]5a38dfd2012-07-23 23:22:10278 scoped_refptr<extensions::EventRouterForwarder>
[email protected]3ce02412011-03-01 12:01:15279 extension_event_router_forwarder_;
280
dcheng4af48582016-04-19 00:29:35281 std::unique_ptr<MediaFileSystemRegistry> media_file_system_registry_;
[email protected]84b7a552014-07-19 04:52:06282#endif
283
[email protected]81054f812012-08-30 00:47:09284#if !defined(OS_ANDROID)
dcheng4af48582016-04-19 00:29:35285 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_;
286 std::unique_ptr<DevToolsAutoOpener> devtools_auto_opener_;
[email protected]8b60ca722013-07-19 01:29:02287#endif
288
Brett Wilson65f951c2016-11-03 22:06:12289#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
[email protected]d8ce31e2012-12-19 05:09:21290 scoped_refptr<printing::PrintPreviewDialogController>
291 print_preview_dialog_controller_;
[email protected]dbeebd52010-11-16 20:34:16292
dcheng4af48582016-04-19 00:29:35293 std::unique_ptr<printing::BackgroundPrintingManager>
294 background_printing_manager_;
[email protected]84b7a552014-07-19 04:52:06295#endif
[email protected]68f88b992011-05-07 02:01:39296
Evan Stade4d8df162018-06-07 16:59:25297#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
[email protected]29672ab2009-10-30 03:44:03298 // Manager for desktop notification UI.
Scott Violetfdd6f352018-01-12 19:12:29299 bool created_notification_ui_manager_ = false;
dcheng4af48582016-04-19 00:29:35300 std::unique_ptr<NotificationUIManager> notification_ui_manager_;
Jinsong Fan0d46f952018-01-31 18:22:58301#endif
[email protected]29672ab2009-10-30 03:44:03302
Tommy Lid5b7c22b2020-10-28 01:26:51303#if !defined(OS_ANDROID)
dcheng4af48582016-04-19 00:29:35304 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
Tommy Lid5b7c22b2020-10-28 01:26:51305#endif
initial.commit09911bf2008-07-26 23:55:29306
dcheng4af48582016-04-19 00:29:35307 std::unique_ptr<StatusTray> status_tray_;
[email protected]9e7f015f2011-05-28 00:24:25308
Joone Hur06fb05f72018-04-19 18:58:23309#if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS)
Scott Violetfdd6f352018-01-12 19:12:29310 bool created_notification_bridge_ = false;
Joone Hur06fb05f72018-04-19 18:58:23311#endif
312
miguelg23cd2dd72016-04-21 15:24:03313 std::unique_ptr<NotificationPlatformBridge> notification_bridge_;
314
Toni Barzicb598380e2018-11-26 19:14:10315 // Use SystemNotificationHelper::GetInstance to get this instance.
316 std::unique_ptr<SystemNotificationHelper> system_notification_helper_;
317
Denis Kuznetsov32099f32017-12-15 14:04:57318#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
dcheng4af48582016-04-19 00:29:35319 std::unique_ptr<BackgroundModeManager> background_mode_manager_;
thestige4155842014-10-20 18:58:02320#endif
[email protected]3ba226c52011-10-27 22:50:24321
Scott Violetfdd6f352018-01-12 19:12:29322 bool created_safe_browsing_service_ = false;
vakh9a474d832015-11-13 01:43:09323 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service_;
[email protected]462a0ff2011-06-02 17:15:34324
Scott Violetfdd6f352018-01-12 19:12:29325 bool created_subresource_filter_ruleset_service_ = false;
Eric Robinsonefb3ea552018-11-02 18:24:32326 std::unique_ptr<subresource_filter::RulesetService>
engedyc5ef21ad2016-06-17 20:22:27327 subresource_filter_ruleset_service_;
328
Yao Xiaocc8e0c42020-10-01 17:34:46329 std::unique_ptr<federated_learning::FlocSortingLshClustersService>
330 floc_sorting_lsh_clusters_service_;
331
Scott Violetfdd6f352018-01-12 19:12:29332 bool created_optimization_guide_service_ = false;
Sophie Changf453c0522017-11-03 06:33:49333 std::unique_ptr<optimization_guide::OptimizationGuideService>
334 optimization_guide_service_;
335
Scott Violetfdd6f352018-01-12 19:12:29336 bool shutting_down_ = false;
initial.commit09911bf2008-07-26 23:55:29337
Scott Violetfdd6f352018-01-12 19:12:29338 bool tearing_down_ = false;
csharrison058781a2015-11-24 21:44:03339
initial.commit09911bf2008-07-26 23:55:29340 // Ensures that all the print jobs are finished before closing the browser.
dcheng4af48582016-04-19 00:29:35341 std::unique_ptr<printing::PrintJobManager> print_job_manager_;
initial.commit09911bf2008-07-26 23:55:29342
[email protected]d70539de2009-06-24 22:17:06343 std::string locale_;
initial.commit09911bf2008-07-26 23:55:29344
[email protected]073ed7b2010-09-27 09:20:02345 // Download status updates (like a changing application icon on dock/taskbar)
346 // are global per-application. DownloadStatusUpdater does no work in the ctor
347 // so we don't have to worry about lazy initialization.
dcheng4af48582016-04-19 00:29:35348 std::unique_ptr<DownloadStatusUpdater> download_status_updater_;
[email protected]073ed7b2010-09-27 09:20:02349
[email protected]254ed742011-08-16 18:45:27350 scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
351
[email protected]2a7e7c152010-10-01 20:12:09352 // Ensures that the observers of plugin/print disable/enable state
[email protected]492d2142010-09-10 13:55:18353 // notifications are properly added and removed.
[email protected]2a7e7c152010-10-01 20:12:09354 PrefChangeRegistrar pref_change_registrar_;
[email protected]492d2142010-09-10 13:55:18355
Ryan Sturmf0ad4292019-05-10 00:51:10356 std::unique_ptr<BatteryMetrics> battery_metrics_;
357
Michael Giuffridadc8030c2017-08-02 13:22:44358#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
danakj8c3eb802015-09-24 07:53:00359 base::RepeatingTimer autoupdate_timer_;
[email protected]bd48c2b02010-04-09 20:32:42360
361 // Gets called by autoupdate timer to see if browser needs restart and can be
362 // restarted, and if that's the case, restarts the browser.
363 void OnAutoupdateTimer();
Greg Thompsonf9ce2502017-11-14 00:13:35364 bool IsRunningInBackground() const;
365 void OnPendingRestartResult(bool is_update_pending_restart);
[email protected]f6e6d2e2011-10-28 18:39:22366 void RestartBackgroundInstance();
Michael Giuffridadc8030c2017-08-02 13:22:44367#endif // defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
[email protected]bd48c2b02010-04-09 20:32:42368
[email protected]9f108f22013-04-09 00:39:56369 // component updater is normally not used under ChromeOS due
370 // to concerns over integrity of data shared between profiles,
371 // but some users of component updater only install per-user.
dcheng4af48582016-04-19 00:29:35372 std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
thestig11b815e92014-08-26 00:32:14373
Toby H5cfaf942019-07-25 22:54:50374#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
dcheng4af48582016-04-19 00:29:35375 std::unique_ptr<component_updater::SupervisedUserWhitelistInstaller>
bauerb22951c32015-02-12 13:18:17376 supervised_user_whitelist_installer_;
Toby H5cfaf942019-07-25 22:54:50377#endif
bauerb22951c32015-02-12 13:18:17378
bauerbecab4f52017-03-13 20:16:41379#if BUILDFLAG(ENABLE_PLUGINS)
dcheng4af48582016-04-19 00:29:35380 std::unique_ptr<PluginsResourceService> plugins_resource_service_;
[email protected]2366a3a2012-10-02 20:41:14381#endif
[email protected]e9613b52012-11-27 22:35:13382
dcheng4af48582016-04-19 00:29:35383 std::unique_ptr<BrowserProcessPlatformPart> platform_part_;
[email protected]7cad6b0d2013-04-25 20:29:32384
[email protected]bbf32c52013-06-03 14:05:52385 // Lazily initialized.
dcheng4af48582016-04-19 00:29:35386 std::unique_ptr<WebRtcLogUploader> webrtc_log_uploader_;
Elad Alon7264d6a2018-03-21 15:06:26387
388 // WebRtcEventLogManager is a singleton which is instaniated before anything
389 // that needs it, and lives until ~BrowserProcessImpl(). This allows it to
390 // safely post base::Unretained(this) references to an internally owned task
391 // queue, since after ~BrowserProcessImpl(), those tasks would no longer run.
392 std::unique_ptr<WebRtcEventLogManager> webrtc_event_log_manager_;
[email protected]bbf32c52013-06-03 14:05:52393
dcheng4af48582016-04-19 00:29:35394 std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
[email protected]72f93712014-05-19 15:10:39395
dcheng4af48582016-04-19 00:29:35396 std::unique_ptr<gcm::GCMDriver> gcm_driver_;
[email protected]c027d6d2014-06-05 15:25:40397
Sebastien Marchand2ebd9252018-11-08 18:39:35398 std::unique_ptr<resource_coordinator::ResourceCoordinatorParts>
399 resource_coordinator_parts_;
Sam McNallye36abbc2017-07-20 01:04:28400
Lukasz Anforowicz60d1253d2019-05-08 16:31:37401 std::unique_ptr<SecureOriginPrefsObserver> secure_origin_prefs_observer_;
Lukasz Anforowicz65c61162019-03-27 20:33:58402 std::unique_ptr<SiteIsolationPrefsObserver> site_isolation_prefs_observer_;
403
Wez25fd35f2018-05-25 22:57:41404#if !defined(OS_ANDROID)
405 // Called to signal the process' main message loop to exit.
406 base::OnceClosure quit_closure_;
Greg Thompson08451a42020-02-04 23:45:54407
408 BuildState build_state_;
Wez25fd35f2018-05-25 22:57:41409#endif
410
gab25894fe2017-05-30 03:40:36411 SEQUENCE_CHECKER(sequence_checker_);
412
[email protected]58dca552009-06-17 00:35:02413 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
initial.commit09911bf2008-07-26 23:55:29414};
415
[email protected]58dca552009-06-17 00:35:02416#endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_