blob: 80311eff04c56e9a165a13e1616f76587588b0ec [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"
Yuta Hijikata235fc62b2020-12-08 03:48:3223#include "build/chromeos_buildflags.h"
initial.commit09911bf2008-07-26 23:55:2924#include "chrome/browser/browser_process.h"
Scott Violet6200d332018-02-23 21:29:2325#include "chrome/common/buildflags.h"
Michael Giuffrida2dbce0d12017-09-02 03:30:5926#include "components/keep_alive_registry/keep_alive_state_observer.h"
Xi Han07bad2892018-10-04 15:13:5827#include "components/metrics_services_manager/metrics_services_manager.h"
Scott Violet9ae82892018-03-01 18:38:1228#include "components/nacl/common/buildflags.h"
Xi Handdb1ab12018-08-27 22:18:5429#include "components/prefs/persistent_pref_store.h"
brettwb1fc1b82016-02-02 00:19:0830#include "components/prefs/pref_change_registrar.h"
Scott Violetc8240b02018-03-08 22:03:5931#include "extensions/buildflags/buildflags.h"
Scott Violeta35f9a42018-03-22 22:00:4432#include "media/media_buildflags.h"
Scott Violet02e38b92018-03-27 23:42:1433#include "ppapi/buildflags/buildflags.h"
Scott Violet318a55f2018-03-30 19:08:1934#include "printing/buildflags/buildflags.h"
Tarun Bansal86b39222018-09-21 02:07:3235#include "services/network/public/cpp/network_quality_tracker.h"
Takuto Ikutaaa3b796c2019-02-06 02:54:5636#include "services/network/public/mojom/network_service.mojom-forward.h"
[email protected]b112a4c2009-02-01 20:24:0137
Greg Thompson08451a42020-02-04 23:45:5438#if !defined(OS_ANDROID)
39#include "chrome/browser/upgrade_detector/build_state.h"
40#endif
41
Oksana Zhuravlova3a4e4212021-02-17 21:51:3342#if defined(OS_ANDROID)
43#include "base/android/application_status_listener.h"
44#endif // defined(OS_ANDROID)
45
Ryan Sturmf0ad4292019-05-10 00:51:1046class BatteryMetrics;
Scott Violet875789e2018-02-02 07:46:4847class ChromeMetricsServicesManagerClient;
dgozman54cc54e2016-02-23 03:47:3048class DevToolsAutoOpener;
[email protected]4475d232011-07-27 15:29:2049class RemoteDebuggingServer;
[email protected]b1de2c72013-02-06 02:45:4750class PrefRegistrySimple;
Lukasz Anforowicz60d1253d2019-05-08 16:31:3751class SecureOriginPrefsObserver;
Lukasz Anforowicz65c61162019-03-27 20:33:5852class SiteIsolationPrefsObserver;
Toni Barzicb598380e2018-11-26 19:14:1053class SystemNotificationHelper;
Xi Han85079c22019-04-18 21:43:0554class StartupData;
initial.commit09911bf2008-07-26 23:55:2955
bauerbecab4f52017-03-13 20:16:4156#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]2366a3a2012-10-02 20:41:1457class PluginsResourceService;
58#endif
59
[email protected]0de615a2012-11-08 04:40:5960namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1561class CommandLine;
[email protected]0de615a2012-11-08 04:40:5962}
63
Jesse McKenna98e60df2021-08-17 16:57:0864namespace breadcrumbs {
65class ApplicationBreadcrumbsLogger;
66class BreadcrumbManager;
67class BreadcrumbPersistentStorageManager;
68} // namespace breadcrumbs
69
[email protected]aa3dd492013-11-05 17:09:0970namespace extensions {
71class ExtensionsBrowserClient;
72}
73
[email protected]c027d6d2014-06-05 15:25:4074namespace gcm {
75class GCMDriver;
76}
77
[email protected]5b869962011-09-20 19:49:3378namespace policy {
Scott Violetfdd6f352018-01-12 19:12:2979class ChromeBrowserPolicyConnector;
[email protected]a4179c2a2012-02-09 18:14:2180class PolicyService;
Scott Violetfdd6f352018-01-12 19:12:2981} // namespace policy
[email protected]fcf53572011-06-29 15:44:3782
Elad Alon39b1f6cc2018-08-30 09:52:2183namespace webrtc_event_logging {
84class WebRtcEventLogManager;
85} // namespace webrtc_event_logging
86
Akihiro Otacee2d142021-06-08 00:52:0587namespace speech {
88class SodaInstallerImpl;
89class SodaInstallerImplChromeOS;
90} // namespace speech
91
initial.commit09911bf2008-07-26 23:55:2992// Real implementation of BrowserProcess that creates and returns the services.
[email protected]6618d1d2010-12-15 21:18:4793class BrowserProcessImpl : public BrowserProcess,
dgnfe075c82016-03-18 11:25:3594 public KeepAliveStateObserver {
initial.commit09911bf2008-07-26 23:55:2995 public:
Xi Han85079c22019-04-18 21:43:0596 // |startup_data| should not be null. The BrowserProcessImpl
Xi Han07bad2892018-10-04 15:13:5897 // will take the PrefService owned by the creator as the Local State instead
98 // of loading the JSON file from disk.
Xi Han85079c22019-04-18 21:43:0599 explicit BrowserProcessImpl(StartupData* startup_data);
Daniel Chenga542fca2014-10-21 09:51:29100 ~BrowserProcessImpl() override;
initial.commit09911bf2008-07-26 23:55:29101
Scott Violet875789e2018-02-02 07:46:48102 // Called to complete initialization.
103 void Init();
104
Wez25fd35f2018-05-25 22:57:41105#if !defined(OS_ANDROID)
Greg Thompson822ab51a2018-09-18 06:45:29106 // Sets a closure to be run to break out of a run loop on browser shutdown
107 // (when the KeepAlive count reaches zero).
108 // TODO(https://crbug.com/845966): This is also used on macOS for the Cocoa
109 // first run dialog so that shutdown can be initiated via a signal while the
110 // first run dialog is showing.
Filip Gorski209a3472018-08-27 23:03:41111 void SetQuitClosure(base::OnceClosure quit_closure);
Wez25fd35f2018-05-25 22:57:41112#endif
113
Avi Drissman2e458df2020-07-29 16:24:31114#if defined(OS_MAC)
Greg Thompson822ab51a2018-09-18 06:45:29115 // Clears the quit closure. Shutdown will not be initiated should the
116 // KeepAlive count reach zero. This function may be called more than once.
117 // TODO(https://crbug.com/845966): Remove this once the Cocoa first run
118 // dialog no longer needs it.
119 void ClearQuitClosure();
Wez25fd35f2018-05-25 22:57:41120#endif
121
[email protected]99907362012-01-11 05:41:40122 // Called before the browser threads are created.
Bernhard Bauer5533f9912017-11-06 17:56:02123 void PreCreateThreads(const base::CommandLine& command_line);
[email protected]2e5b60a22011-11-28 15:56:41124
[email protected]d2caaa22011-12-12 03:04:15125 // Called after the threads have been created but before the message loops
126 // starts running. Allows the browser process to do any initialization that
127 // requires all threads running.
128 void PreMainMessageLoopRun();
129
[email protected]2e5b60a22011-11-28 15:56:41130 // Most cleanup is done by these functions, driven from
131 // ChromeBrowserMain based on notifications from the content
132 // framework, rather than in the destructor, so that we can
133 // interleave cleanup with threads being stopped.
thestigd75ce5532015-10-05 22:08:34134#if !defined(OS_ANDROID)
[email protected]2e5b60a22011-11-28 15:56:41135 void StartTearDown();
[email protected]99907362012-01-11 05:41:40136 void PostDestroyThreads();
thestigd75ce5532015-10-05 22:08:34137#endif
[email protected]2e5b60a22011-11-28 15:56:41138
Xi Han07bad2892018-10-04 15:13:58139 // Sets |metrics_services_manager_| and |metrics_services_manager_client_|
140 // which is owned by it.
141 void SetMetricsServices(
142 std::unique_ptr<metrics_services_manager::MetricsServicesManager> manager,
143 metrics_services_manager::MetricsServicesManagerClient* client);
144
[email protected]80745e32012-05-08 01:22:12145 // BrowserProcess implementation.
Daniel Chenga542fca2014-10-21 09:51:29146 void EndSession() override;
Gabriel Charetteb1af7ffb2017-07-27 06:10:35147 void FlushLocalStateAndReply(base::OnceClosure reply) override;
blundell695d61f2015-10-21 11:25:53148 metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
149 override;
Daniel Chenga542fca2014-10-21 09:51:29150 metrics::MetricsService* metrics_service() override;
Min Qin8caab1d2018-10-03 17:28:13151 // TODO(qinmin): Remove this method as callers can retrieve the global
152 // instance from SystemNetworkContextManager directly.
Matt Menke21b9cc62017-08-23 15:45:45153 SystemNetworkContextManager* system_network_context_manager() override;
Antonio Gomesacd1a942018-07-10 20:23:54154 scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
155 override;
Tarun Bansalcd6a6cb2018-06-27 22:03:22156 network::NetworkQualityTracker* network_quality_tracker() override;
Daniel Chenga542fca2014-10-21 09:51:29157 WatchDogThread* watchdog_thread() override;
158 ProfileManager* profile_manager() override;
159 PrefService* local_state() override;
blundell57bcfed2015-09-04 08:44:45160 variations::VariationsService* variations_service() override;
Daniel Chenga542fca2014-10-21 09:51:29161 BrowserProcessPlatformPart* platform_part() override;
162 extensions::EventRouterForwarder* extension_event_router_forwarder() override;
163 NotificationUIManager* notification_ui_manager() override;
miguelg23cd2dd72016-04-21 15:24:03164 NotificationPlatformBridge* notification_platform_bridge() override;
Scott Violetfdd6f352018-01-12 19:12:29165 policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
Daniel Chenga542fca2014-10-21 09:51:29166 policy::PolicyService* policy_service() override;
167 IconManager* icon_manager() override;
Daniel Chenga542fca2014-10-21 09:51:29168 GpuModeManager* gpu_mode_manager() override;
Pavel Feldmanc9ae59c2018-02-13 16:15:15169 void CreateDevToolsProtocolHandler() override;
dgozman54cc54e2016-02-23 03:47:30170 void CreateDevToolsAutoOpener() override;
Daniel Chenga542fca2014-10-21 09:51:29171 bool IsShuttingDown() override;
172 printing::PrintJobManager* print_job_manager() override;
173 printing::PrintPreviewDialogController* print_preview_dialog_controller()
174 override;
175 printing::BackgroundPrintingManager* background_printing_manager() override;
Tommy Lid5b7c22b2020-10-28 01:26:51176#if !defined(OS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29177 IntranetRedirectDetector* intranet_redirect_detector() override;
Tommy Lid5b7c22b2020-10-28 01:26:51178#endif
Daniel Chenga542fca2014-10-21 09:51:29179 const std::string& GetApplicationLocale() override;
Xi Han349162b2018-10-26 12:44:23180 void SetApplicationLocale(const std::string& actual_locale) override;
Daniel Chenga542fca2014-10-21 09:51:29181 DownloadStatusUpdater* download_status_updater() override;
182 DownloadRequestLimiter* download_request_limiter() override;
183 BackgroundModeManager* background_mode_manager() override;
Reid Kleckner4d3f21c2021-01-25 22:48:31184#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
Daniel Chenga542fca2014-10-21 09:51:29185 void set_background_mode_manager_for_test(
dcheng4af48582016-04-19 00:29:35186 std::unique_ptr<BackgroundModeManager> manager) override;
Reid Kleckner4d3f21c2021-01-25 22:48:31187#endif
Daniel Chenga542fca2014-10-21 09:51:29188 StatusTray* status_tray() override;
vakh9a474d832015-11-13 01:43:09189 safe_browsing::SafeBrowsingService* safe_browsing_service() override;
Eric Robinsonefb3ea552018-11-02 18:24:32190 subresource_filter::RulesetService* subresource_filter_ruleset_service()
191 override;
Yao Xiaocc8e0c42020-10-01 17:34:46192 federated_learning::FlocSortingLshClustersService*
193 floc_sorting_lsh_clusters_service() override;
[email protected]6641bf662009-08-21 00:34:09194
Xi Han9fd44002019-04-30 17:39:36195 StartupData* startup_data() override;
196
Yuta Hijikata235fc62b2020-12-08 03:48:32197// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
198// of lacros-chrome is complete.
199#if defined(OS_WIN) || (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
dchenge1bc7982014-10-30 00:32:40200 void StartAutoupdateTimer() override;
[email protected]3cdacd42010-04-30 18:55:53201#endif
[email protected]bd48c2b02010-04-09 20:32:42202
Daniel Chenga542fca2014-10-21 09:51:29203 component_updater::ComponentUpdateService* component_updater() override;
Daniel Chenga542fca2014-10-21 09:51:29204 MediaFileSystemRegistry* media_file_system_registry() override;
Daniel Chenga542fca2014-10-21 09:51:29205 WebRtcLogUploader* webrtc_log_uploader() override;
Daniel Chenga542fca2014-10-21 09:51:29206 network_time::NetworkTimeTracker* network_time_tracker() override;
Adam Langley1cb73c72020-08-28 17:06:44207#if !defined(OS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29208 gcm::GCMDriver* gcm_driver() override;
Adam Langley1cb73c72020-08-28 17:06:44209#endif
lpyfedf65a2017-06-01 01:41:24210 resource_coordinator::TabManager* GetTabManager() override;
Sebastien Marchand2ebd9252018-11-08 18:39:35211 resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
212 override;
[email protected]ca167a32011-09-30 15:19:11213
Reilly Grantbfc2ab72021-06-02 23:57:30214#if !defined(OS_ANDROID)
215 SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
216#endif
217
Greg Thompson08451a42020-02-04 23:45:54218 BuildState* GetBuildState() override;
Jesse McKenna98e60df2021-08-17 16:57:08219 breadcrumbs::BreadcrumbPersistentStorageManager*
220 GetBreadcrumbPersistentStorageManager() override;
Greg Thompson08451a42020-02-04 23:45:54221
[email protected]b1de2c72013-02-06 02:45:47222 static void RegisterPrefs(PrefRegistrySimple* registry);
223
initial.commit09911bf2008-07-26 23:55:29224 private:
Elad Alon39b1f6cc2018-08-30 09:52:21225 using WebRtcEventLogManager = webrtc_event_logging::WebRtcEventLogManager;
226
dgnfe075c82016-03-18 11:25:35227 // KeepAliveStateObserver implementation
228 void OnKeepAliveStateChanged(bool is_keeping_alive) override;
229 void OnKeepAliveRestartStateChanged(bool can_restart) override;
230
Tarun Bansal86b39222018-09-21 02:07:32231 // Create network quality observer so that it can propagate network quality
232 // changes to the render process.
233 void CreateNetworkQualityObserver();
234
[email protected]0b565182011-03-02 18:11:15235 void CreateWatchdogThread();
initial.commit09911bf2008-07-26 23:55:29236 void CreateProfileManager();
initial.commit09911bf2008-07-26 23:55:29237 void CreateIconManager();
miguelg23cd2dd72016-04-21 15:24:03238 void CreateNotificationPlatformBridge();
[email protected]29672ab2009-10-30 03:44:03239 void CreateNotificationUIManager();
[email protected]d8ce31e2012-12-19 05:09:21240 void CreatePrintPreviewDialogController();
[email protected]68f88b992011-05-07 02:01:39241 void CreateBackgroundPrintingManager();
[email protected]462a0ff2011-06-02 17:15:34242 void CreateSafeBrowsingService();
engedyc5ef21ad2016-06-17 20:22:27243 void CreateSubresourceFilterRulesetService();
Yao Xiao431dec62020-06-25 14:13:06244 void CreateFlocBlocklistService();
Yao Xiaocc8e0c42020-10-01 17:34:46245 void CreateFlocSortingLshClustersService();
Sophie Changf453c0522017-11-03 06:33:49246 void CreateOptimizationGuideService();
[email protected]9e7f015f2011-05-28 00:24:25247 void CreateStatusTray();
248 void CreateBackgroundModeManager();
[email protected]c027d6d2014-06-05 15:25:40249 void CreateGCMDriver();
[email protected]a7a5e992010-12-09 23:39:51250
[email protected]b61f62a2011-11-01 02:02:10251 void ApplyDefaultBrowserPolicy();
[email protected]419a0572011-04-18 22:21:46252
dgnfe075c82016-03-18 11:25:35253 // Methods called to control our lifetime. The browser process can be "pinned"
254 // to make sure it keeps running.
255 void Pin();
256 void Unpin();
257
Greg Thompsond4ecaa92020-08-20 09:15:40258 StartupData* const startup_data_;
259
Scott Violetfdd6f352018-01-12 19:12:29260 bool created_watchdog_thread_ = false;
dcheng4af48582016-04-19 00:29:35261 std::unique_ptr<WatchDogThread> watchdog_thread_;
[email protected]0b565182011-03-02 18:11:15262
[email protected]3b19e8e2012-10-17 19:15:49263 // Must be destroyed after |local_state_|.
Scott Violetfdd6f352018-01-12 19:12:29264 std::unique_ptr<policy::ChromeBrowserPolicyConnector>
265 browser_policy_connector_;
[email protected]8d6b2432012-03-31 12:11:18266
Scott Violetfdd6f352018-01-12 19:12:29267 bool created_profile_manager_ = false;
dcheng4af48582016-04-19 00:29:35268 std::unique_ptr<ProfileManager> profile_manager_;
initial.commit09911bf2008-07-26 23:55:29269
Lei Zhange86673c2021-05-21 01:55:19270 const std::unique_ptr<PrefService> local_state_;
initial.commit09911bf2008-07-26 23:55:29271
Pavol Marko11f1bb42020-03-30 18:58:38272 // |metrics_services_manager_| owns this.
273 ChromeMetricsServicesManagerClient* metrics_services_manager_client_ =
274 nullptr;
275
276 // Must be destroyed before |local_state_|.
277 std::unique_ptr<metrics_services_manager::MetricsServicesManager>
278 metrics_services_manager_;
279
Tarun Bansalcd6a6cb2018-06-27 22:03:22280 std::unique_ptr<network::NetworkQualityTracker> network_quality_tracker_;
281
Tarun Bansal86b39222018-09-21 02:07:32282 // Listens to NetworkQualityTracker and sends network quality updates to the
283 // renderer.
284 std::unique_ptr<
285 network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver>
286 network_quality_observer_;
287
Scott Violetfdd6f352018-01-12 19:12:29288 bool created_icon_manager_ = false;
dcheng4af48582016-04-19 00:29:35289 std::unique_ptr<IconManager> icon_manager_;
initial.commit09911bf2008-07-26 23:55:29290
dcheng4af48582016-04-19 00:29:35291 std::unique_ptr<GpuModeManager> gpu_mode_manager_;
[email protected]e6933d2a2013-03-12 22:32:21292
brettw00899e62016-11-12 02:10:17293#if BUILDFLAG(ENABLE_EXTENSIONS)
dcheng4af48582016-04-19 00:29:35294 std::unique_ptr<extensions::ExtensionsBrowserClient>
295 extensions_browser_client_;
[email protected]84b7a552014-07-19 04:52:06296
[email protected]5a38dfd2012-07-23 23:22:10297 scoped_refptr<extensions::EventRouterForwarder>
[email protected]3ce02412011-03-01 12:01:15298 extension_event_router_forwarder_;
299
dcheng4af48582016-04-19 00:29:35300 std::unique_ptr<MediaFileSystemRegistry> media_file_system_registry_;
[email protected]84b7a552014-07-19 04:52:06301#endif
302
[email protected]81054f812012-08-30 00:47:09303#if !defined(OS_ANDROID)
dcheng4af48582016-04-19 00:29:35304 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_;
305 std::unique_ptr<DevToolsAutoOpener> devtools_auto_opener_;
[email protected]8b60ca722013-07-19 01:29:02306#endif
307
Brett Wilson65f951c2016-11-03 22:06:12308#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
[email protected]d8ce31e2012-12-19 05:09:21309 scoped_refptr<printing::PrintPreviewDialogController>
310 print_preview_dialog_controller_;
[email protected]dbeebd52010-11-16 20:34:16311
dcheng4af48582016-04-19 00:29:35312 std::unique_ptr<printing::BackgroundPrintingManager>
313 background_printing_manager_;
[email protected]84b7a552014-07-19 04:52:06314#endif
[email protected]68f88b992011-05-07 02:01:39315
Richard Knoll232ad512021-06-10 17:30:08316#if BUILDFLAG(ENABLE_CHROME_NOTIFICATIONS)
[email protected]29672ab2009-10-30 03:44:03317 // Manager for desktop notification UI.
Scott Violetfdd6f352018-01-12 19:12:29318 bool created_notification_ui_manager_ = false;
dcheng4af48582016-04-19 00:29:35319 std::unique_ptr<NotificationUIManager> notification_ui_manager_;
Jinsong Fan0d46f952018-01-31 18:22:58320#endif
[email protected]29672ab2009-10-30 03:44:03321
Tommy Lid5b7c22b2020-10-28 01:26:51322#if !defined(OS_ANDROID)
dcheng4af48582016-04-19 00:29:35323 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
Tommy Lid5b7c22b2020-10-28 01:26:51324#endif
initial.commit09911bf2008-07-26 23:55:29325
dcheng4af48582016-04-19 00:29:35326 std::unique_ptr<StatusTray> status_tray_;
[email protected]9e7f015f2011-05-28 00:24:25327
Peter Beverlooc30c9ddf2021-02-24 19:56:03328#if BUILDFLAG(ENABLE_SYSTEM_NOTIFICATIONS)
Scott Violetfdd6f352018-01-12 19:12:29329 bool created_notification_bridge_ = false;
Joone Hur06fb05f72018-04-19 18:58:23330#endif
331
miguelg23cd2dd72016-04-21 15:24:03332 std::unique_ptr<NotificationPlatformBridge> notification_bridge_;
333
Toni Barzicb598380e2018-11-26 19:14:10334 // Use SystemNotificationHelper::GetInstance to get this instance.
335 std::unique_ptr<SystemNotificationHelper> system_notification_helper_;
336
Denis Kuznetsov32099f32017-12-15 14:04:57337#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
David Rogercf0f5812020-11-13 11:42:12338 // Must be destroyed after the profile manager, because it doesn't remove
339 // itself as a profile attributes storage observer on destruction.
dcheng4af48582016-04-19 00:29:35340 std::unique_ptr<BackgroundModeManager> background_mode_manager_;
thestige4155842014-10-20 18:58:02341#endif
[email protected]3ba226c52011-10-27 22:50:24342
Scott Violetfdd6f352018-01-12 19:12:29343 bool created_safe_browsing_service_ = false;
vakh9a474d832015-11-13 01:43:09344 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service_;
[email protected]462a0ff2011-06-02 17:15:34345
Scott Violetfdd6f352018-01-12 19:12:29346 bool created_subresource_filter_ruleset_service_ = false;
Eric Robinsonefb3ea552018-11-02 18:24:32347 std::unique_ptr<subresource_filter::RulesetService>
engedyc5ef21ad2016-06-17 20:22:27348 subresource_filter_ruleset_service_;
349
Yao Xiaocc8e0c42020-10-01 17:34:46350 std::unique_ptr<federated_learning::FlocSortingLshClustersService>
351 floc_sorting_lsh_clusters_service_;
352
Scott Violetfdd6f352018-01-12 19:12:29353 bool shutting_down_ = false;
initial.commit09911bf2008-07-26 23:55:29354
Scott Violetfdd6f352018-01-12 19:12:29355 bool tearing_down_ = false;
csharrison058781a2015-11-24 21:44:03356
initial.commit09911bf2008-07-26 23:55:29357 // Ensures that all the print jobs are finished before closing the browser.
dcheng4af48582016-04-19 00:29:35358 std::unique_ptr<printing::PrintJobManager> print_job_manager_;
initial.commit09911bf2008-07-26 23:55:29359
[email protected]d70539de2009-06-24 22:17:06360 std::string locale_;
initial.commit09911bf2008-07-26 23:55:29361
[email protected]073ed7b2010-09-27 09:20:02362 // Download status updates (like a changing application icon on dock/taskbar)
363 // are global per-application. DownloadStatusUpdater does no work in the ctor
364 // so we don't have to worry about lazy initialization.
dcheng4af48582016-04-19 00:29:35365 std::unique_ptr<DownloadStatusUpdater> download_status_updater_;
[email protected]073ed7b2010-09-27 09:20:02366
[email protected]254ed742011-08-16 18:45:27367 scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
368
[email protected]2a7e7c152010-10-01 20:12:09369 // Ensures that the observers of plugin/print disable/enable state
[email protected]492d2142010-09-10 13:55:18370 // notifications are properly added and removed.
[email protected]2a7e7c152010-10-01 20:12:09371 PrefChangeRegistrar pref_change_registrar_;
[email protected]492d2142010-09-10 13:55:18372
Ryan Sturmf0ad4292019-05-10 00:51:10373 std::unique_ptr<BatteryMetrics> battery_metrics_;
374
Yuta Hijikata235fc62b2020-12-08 03:48:32375// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
376// of lacros-chrome is complete.
377#if defined(OS_WIN) || (defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
danakj8c3eb802015-09-24 07:53:00378 base::RepeatingTimer autoupdate_timer_;
[email protected]bd48c2b02010-04-09 20:32:42379
380 // Gets called by autoupdate timer to see if browser needs restart and can be
381 // restarted, and if that's the case, restarts the browser.
382 void OnAutoupdateTimer();
Greg Thompsonf9ce2502017-11-14 00:13:35383 bool IsRunningInBackground() const;
384 void OnPendingRestartResult(bool is_update_pending_restart);
[email protected]f6e6d2e2011-10-28 18:39:22385 void RestartBackgroundInstance();
Yuta Hijikata235fc62b2020-12-08 03:48:32386#endif // defined(OS_WIN) || (defined(OS_LINUX) ||
387 // BUILDFLAG(IS_CHROMEOS_LACROS))
[email protected]bd48c2b02010-04-09 20:32:42388
[email protected]9f108f22013-04-09 00:39:56389 // component updater is normally not used under ChromeOS due
390 // to concerns over integrity of data shared between profiles,
391 // but some users of component updater only install per-user.
dcheng4af48582016-04-19 00:29:35392 std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
thestig11b815e92014-08-26 00:32:14393
Akihiro Otacee2d142021-06-08 00:52:05394#if !defined(OS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
395 // Used to create a singleton instance of SodaInstallerImpl, which can be
396 // retrieved using speech::SodaInstaller::GetInstance().
397 // SodaInstallerImpl depends on ComponentUpdateService, so define it here
398 // to ensure that SodaInstallerImpl gets destructed first.
399 std::unique_ptr<speech::SodaInstallerImpl> soda_installer_impl_;
400#endif
401
402#if BUILDFLAG(IS_CHROMEOS_ASH)
403 // Chrome OS has a different implementation of SodaInstaller.
404 std::unique_ptr<speech::SodaInstallerImplChromeOS> soda_installer_impl_;
405#endif
406
bauerbecab4f52017-03-13 20:16:41407#if BUILDFLAG(ENABLE_PLUGINS)
dcheng4af48582016-04-19 00:29:35408 std::unique_ptr<PluginsResourceService> plugins_resource_service_;
[email protected]2366a3a2012-10-02 20:41:14409#endif
[email protected]e9613b52012-11-27 22:35:13410
dcheng4af48582016-04-19 00:29:35411 std::unique_ptr<BrowserProcessPlatformPart> platform_part_;
[email protected]7cad6b0d2013-04-25 20:29:32412
[email protected]bbf32c52013-06-03 14:05:52413 // Lazily initialized.
dcheng4af48582016-04-19 00:29:35414 std::unique_ptr<WebRtcLogUploader> webrtc_log_uploader_;
Elad Alon7264d6a2018-03-21 15:06:26415
416 // WebRtcEventLogManager is a singleton which is instaniated before anything
417 // that needs it, and lives until ~BrowserProcessImpl(). This allows it to
418 // safely post base::Unretained(this) references to an internally owned task
419 // queue, since after ~BrowserProcessImpl(), those tasks would no longer run.
420 std::unique_ptr<WebRtcEventLogManager> webrtc_event_log_manager_;
[email protected]bbf32c52013-06-03 14:05:52421
dcheng4af48582016-04-19 00:29:35422 std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
[email protected]72f93712014-05-19 15:10:39423
dcheng4af48582016-04-19 00:29:35424 std::unique_ptr<gcm::GCMDriver> gcm_driver_;
[email protected]c027d6d2014-06-05 15:25:40425
Sebastien Marchand2ebd9252018-11-08 18:39:35426 std::unique_ptr<resource_coordinator::ResourceCoordinatorParts>
427 resource_coordinator_parts_;
Sam McNallye36abbc2017-07-20 01:04:28428
Lukasz Anforowicz60d1253d2019-05-08 16:31:37429 std::unique_ptr<SecureOriginPrefsObserver> secure_origin_prefs_observer_;
Lukasz Anforowicz65c61162019-03-27 20:33:58430 std::unique_ptr<SiteIsolationPrefsObserver> site_isolation_prefs_observer_;
431
Wez25fd35f2018-05-25 22:57:41432#if !defined(OS_ANDROID)
433 // Called to signal the process' main message loop to exit.
434 base::OnceClosure quit_closure_;
Greg Thompson08451a42020-02-04 23:45:54435
Reilly Grantbfc2ab72021-06-02 23:57:30436 std::unique_ptr<SerialPolicyAllowedPorts> serial_policy_allowed_ports_;
437
Greg Thompson08451a42020-02-04 23:45:54438 BuildState build_state_;
Wez25fd35f2018-05-25 22:57:41439#endif
440
Oksana Zhuravlova3a4e4212021-02-17 21:51:33441#if defined(OS_ANDROID)
442 std::unique_ptr<base::android::ApplicationStatusListener> app_state_listener_;
443#endif
444
Jesse McKenna98e60df2021-08-17 16:57:08445 // Stores application-wide breadcrumb events. Null if breadcrumbs logging is
446 // disabled.
447 std::unique_ptr<breadcrumbs::BreadcrumbManager> breadcrumb_manager_;
448 // Observes application-wide events and logs them to |breadcrumb_manager_|.
449 // Null if breadcrumbs logging is disabled.
450 std::unique_ptr<breadcrumbs::ApplicationBreadcrumbsLogger>
451 application_breadcrumbs_logger_;
452
gab25894fe2017-05-30 03:40:36453 SEQUENCE_CHECKER(sequence_checker_);
454
[email protected]58dca552009-06-17 00:35:02455 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
initial.commit09911bf2008-07-26 23:55:29456};
457
[email protected]58dca552009-06-17 00:35:02458#endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_