blob: 0130685cfa0768aed3214c1fe60460da0c259493 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2012 The Chromium Authors
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
Keishi Hattori0e45c022021-11-27 09:25:5218#include "base/memory/raw_ptr.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
Xiaohan Wang55ae2c012022-01-20 21:49:1138#if !BUILDFLAG(IS_ANDROID)
Greg Thompson08451a42020-02-04 23:45:5439#include "chrome/browser/upgrade_detector/build_state.h"
40#endif
41
Xiaohan Wang55ae2c012022-01-20 21:49:1142#if BUILDFLAG(IS_ANDROID)
Oksana Zhuravlova3a4e4212021-02-17 21:51:3343#include "base/android/application_status_listener.h"
Xiaohan Wang55ae2c012022-01-20 21:49:1144#endif // BUILDFLAG(IS_ANDROID)
Oksana Zhuravlova3a4e4212021-02-17 21:51:3345
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
Jesse McKenna98e60df2021-08-17 16:57:0856namespace breadcrumbs {
57class ApplicationBreadcrumbsLogger;
Jesse McKenna98e60df2021-08-17 16:57:0858class BreadcrumbPersistentStorageManager;
59} // namespace breadcrumbs
60
[email protected]aa3dd492013-11-05 17:09:0961namespace extensions {
Alex Cooper29c20fc2022-12-22 18:17:0562class ChromeExtensionsBrowserClient;
[email protected]aa3dd492013-11-05 17:09:0963}
64
[email protected]c027d6d2014-06-05 15:25:4065namespace gcm {
66class GCMDriver;
67}
68
[email protected]5b869962011-09-20 19:49:3369namespace policy {
Scott Violetfdd6f352018-01-12 19:12:2970class ChromeBrowserPolicyConnector;
[email protected]a4179c2a2012-02-09 18:14:2171class PolicyService;
Scott Violetfdd6f352018-01-12 19:12:2972} // namespace policy
[email protected]fcf53572011-06-29 15:44:3773
Elad Alon39b1f6cc2018-08-30 09:52:2174namespace webrtc_event_logging {
75class WebRtcEventLogManager;
76} // namespace webrtc_event_logging
77
Akihiro Otacee2d142021-06-08 00:52:0578namespace speech {
79class SodaInstallerImpl;
80class SodaInstallerImplChromeOS;
81} // namespace speech
82
initial.commit09911bf2008-07-26 23:55:2983// Real implementation of BrowserProcess that creates and returns the services.
[email protected]6618d1d2010-12-15 21:18:4784class BrowserProcessImpl : public BrowserProcess,
dgnfe075c82016-03-18 11:25:3585 public KeepAliveStateObserver {
initial.commit09911bf2008-07-26 23:55:2986 public:
Xi Han85079c22019-04-18 21:43:0587 // |startup_data| should not be null. The BrowserProcessImpl
Xi Han07bad2892018-10-04 15:13:5888 // will take the PrefService owned by the creator as the Local State instead
89 // of loading the JSON file from disk.
Xi Han85079c22019-04-18 21:43:0590 explicit BrowserProcessImpl(StartupData* startup_data);
Peter Boström53c6c5952021-09-17 09:41:2691
92 BrowserProcessImpl(const BrowserProcessImpl&) = delete;
93 BrowserProcessImpl& operator=(const BrowserProcessImpl&) = delete;
94
Daniel Chenga542fca2014-10-21 09:51:2995 ~BrowserProcessImpl() override;
initial.commit09911bf2008-07-26 23:55:2996
Scott Violet875789e2018-02-02 07:46:4897 // Called to complete initialization.
98 void Init();
99
Xiaohan Wang55ae2c012022-01-20 21:49:11100#if !BUILDFLAG(IS_ANDROID)
Greg Thompson822ab51a2018-09-18 06:45:29101 // Sets a closure to be run to break out of a run loop on browser shutdown
102 // (when the KeepAlive count reaches zero).
103 // TODO(https://crbug.com/845966): This is also used on macOS for the Cocoa
104 // first run dialog so that shutdown can be initiated via a signal while the
105 // first run dialog is showing.
Filip Gorski209a3472018-08-27 23:03:41106 void SetQuitClosure(base::OnceClosure quit_closure);
Wez25fd35f2018-05-25 22:57:41107#endif
108
Xiaohan Wang55ae2c012022-01-20 21:49:11109#if BUILDFLAG(IS_MAC)
Greg Thompson822ab51a2018-09-18 06:45:29110 // Clears the quit closure. Shutdown will not be initiated should the
111 // KeepAlive count reach zero. This function may be called more than once.
112 // TODO(https://crbug.com/845966): Remove this once the Cocoa first run
113 // dialog no longer needs it.
114 void ClearQuitClosure();
Wez25fd35f2018-05-25 22:57:41115#endif
116
[email protected]99907362012-01-11 05:41:40117 // Called before the browser threads are created.
Gabriel Charette4c1897a2022-05-02 18:22:25118 void PreCreateThreads();
[email protected]2e5b60a22011-11-28 15:56:41119
[email protected]d2caaa22011-12-12 03:04:15120 // Called after the threads have been created but before the message loops
121 // starts running. Allows the browser process to do any initialization that
122 // requires all threads running.
123 void PreMainMessageLoopRun();
124
[email protected]2e5b60a22011-11-28 15:56:41125 // Most cleanup is done by these functions, driven from
126 // ChromeBrowserMain based on notifications from the content
127 // framework, rather than in the destructor, so that we can
128 // interleave cleanup with threads being stopped.
Xiaohan Wang55ae2c012022-01-20 21:49:11129#if !BUILDFLAG(IS_ANDROID)
[email protected]2e5b60a22011-11-28 15:56:41130 void StartTearDown();
[email protected]99907362012-01-11 05:41:40131 void PostDestroyThreads();
thestigd75ce5532015-10-05 22:08:34132#endif
[email protected]2e5b60a22011-11-28 15:56:41133
Xi Han07bad2892018-10-04 15:13:58134 // Sets |metrics_services_manager_| and |metrics_services_manager_client_|
135 // which is owned by it.
136 void SetMetricsServices(
137 std::unique_ptr<metrics_services_manager::MetricsServicesManager> manager,
138 metrics_services_manager::MetricsServicesManagerClient* client);
139
[email protected]80745e32012-05-08 01:22:12140 // BrowserProcess implementation.
Daniel Chenga542fca2014-10-21 09:51:29141 void EndSession() override;
Gabriel Charetteb1af7ffb2017-07-27 06:10:35142 void FlushLocalStateAndReply(base::OnceClosure reply) override;
blundell695d61f2015-10-21 11:25:53143 metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
144 override;
Daniel Chenga542fca2014-10-21 09:51:29145 metrics::MetricsService* metrics_service() override;
Min Qin8caab1d2018-10-03 17:28:13146 // TODO(qinmin): Remove this method as callers can retrieve the global
147 // instance from SystemNetworkContextManager directly.
Matt Menke21b9cc62017-08-23 15:45:45148 SystemNetworkContextManager* system_network_context_manager() override;
Antonio Gomesacd1a942018-07-10 20:23:54149 scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
150 override;
Tarun Bansalcd6a6cb2018-06-27 22:03:22151 network::NetworkQualityTracker* network_quality_tracker() override;
Daniel Chenga542fca2014-10-21 09:51:29152 ProfileManager* profile_manager() override;
153 PrefService* local_state() override;
blundell57bcfed2015-09-04 08:44:45154 variations::VariationsService* variations_service() override;
Daniel Chenga542fca2014-10-21 09:51:29155 BrowserProcessPlatformPart* platform_part() override;
156 extensions::EventRouterForwarder* extension_event_router_forwarder() override;
157 NotificationUIManager* notification_ui_manager() override;
miguelg23cd2dd72016-04-21 15:24:03158 NotificationPlatformBridge* notification_platform_bridge() override;
Scott Violetfdd6f352018-01-12 19:12:29159 policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
Daniel Chenga542fca2014-10-21 09:51:29160 policy::PolicyService* policy_service() override;
161 IconManager* icon_manager() override;
Daniel Chenga542fca2014-10-21 09:51:29162 GpuModeManager* gpu_mode_manager() override;
Pavel Feldmanc9ae59c2018-02-13 16:15:15163 void CreateDevToolsProtocolHandler() override;
dgozman54cc54e2016-02-23 03:47:30164 void CreateDevToolsAutoOpener() override;
Daniel Chenga542fca2014-10-21 09:51:29165 bool IsShuttingDown() override;
166 printing::PrintJobManager* print_job_manager() override;
167 printing::PrintPreviewDialogController* print_preview_dialog_controller()
168 override;
169 printing::BackgroundPrintingManager* background_printing_manager() override;
Xiaohan Wang55ae2c012022-01-20 21:49:11170#if !BUILDFLAG(IS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29171 IntranetRedirectDetector* intranet_redirect_detector() override;
Tommy Lid5b7c22b2020-10-28 01:26:51172#endif
Daniel Chenga542fca2014-10-21 09:51:29173 const std::string& GetApplicationLocale() override;
Xi Han349162b2018-10-26 12:44:23174 void SetApplicationLocale(const std::string& actual_locale) override;
Daniel Chenga542fca2014-10-21 09:51:29175 DownloadStatusUpdater* download_status_updater() override;
176 DownloadRequestLimiter* download_request_limiter() override;
177 BackgroundModeManager* background_mode_manager() override;
Reid Kleckner4d3f21c2021-01-25 22:48:31178#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
Daniel Chenga542fca2014-10-21 09:51:29179 void set_background_mode_manager_for_test(
dcheng4af48582016-04-19 00:29:35180 std::unique_ptr<BackgroundModeManager> manager) override;
Reid Kleckner4d3f21c2021-01-25 22:48:31181#endif
Daniel Chenga542fca2014-10-21 09:51:29182 StatusTray* status_tray() override;
vakh9a474d832015-11-13 01:43:09183 safe_browsing::SafeBrowsingService* safe_browsing_service() override;
Eric Robinsonefb3ea552018-11-02 18:24:32184 subresource_filter::RulesetService* subresource_filter_ruleset_service()
185 override;
[email protected]6641bf662009-08-21 00:34:09186
Xi Han9fd44002019-04-30 17:39:36187 StartupData* startup_data() override;
188
Yuta Hijikata235fc62b2020-12-08 03:48:32189// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
190// of lacros-chrome is complete.
Xiaohan Wang55ae2c012022-01-20 21:49:11191#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
dchenge1bc7982014-10-30 00:32:40192 void StartAutoupdateTimer() override;
[email protected]3cdacd42010-04-30 18:55:53193#endif
[email protected]bd48c2b02010-04-09 20:32:42194
Daniel Chenga542fca2014-10-21 09:51:29195 component_updater::ComponentUpdateService* component_updater() override;
Daniel Chenga542fca2014-10-21 09:51:29196 MediaFileSystemRegistry* media_file_system_registry() override;
Daniel Chenga542fca2014-10-21 09:51:29197 WebRtcLogUploader* webrtc_log_uploader() override;
Daniel Chenga542fca2014-10-21 09:51:29198 network_time::NetworkTimeTracker* network_time_tracker() override;
Xiaohan Wang55ae2c012022-01-20 21:49:11199#if !BUILDFLAG(IS_ANDROID)
Daniel Chenga542fca2014-10-21 09:51:29200 gcm::GCMDriver* gcm_driver() override;
Adam Langley1cb73c72020-08-28 17:06:44201#endif
lpyfedf65a2017-06-01 01:41:24202 resource_coordinator::TabManager* GetTabManager() override;
Sebastien Marchand2ebd9252018-11-08 18:39:35203 resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
204 override;
[email protected]ca167a32011-09-30 15:19:11205
Xiaohan Wang55ae2c012022-01-20 21:49:11206#if !BUILDFLAG(IS_ANDROID)
Reilly Grantbfc2ab72021-06-02 23:57:30207 SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
Matt Reynoldse6efee42022-02-08 01:38:56208 HidPolicyAllowedDevices* hid_policy_allowed_devices() override;
Jack Hsiehea76b94b52022-12-13 16:37:05209 HidSystemTrayIcon* hid_system_tray_icon() override;
Reilly Grantbfc2ab72021-06-02 23:57:30210#endif
211
Greg Thompson08451a42020-02-04 23:45:54212 BuildState* GetBuildState() override;
Jesse McKenna98e60df2021-08-17 16:57:08213 breadcrumbs::BreadcrumbPersistentStorageManager*
214 GetBreadcrumbPersistentStorageManager() override;
Greg Thompson08451a42020-02-04 23:45:54215
[email protected]b1de2c72013-02-06 02:45:47216 static void RegisterPrefs(PrefRegistrySimple* registry);
217
initial.commit09911bf2008-07-26 23:55:29218 private:
Elad Alon39b1f6cc2018-08-30 09:52:21219 using WebRtcEventLogManager = webrtc_event_logging::WebRtcEventLogManager;
220
dgnfe075c82016-03-18 11:25:35221 // KeepAliveStateObserver implementation
222 void OnKeepAliveStateChanged(bool is_keeping_alive) override;
223 void OnKeepAliveRestartStateChanged(bool can_restart) override;
224
Tarun Bansal86b39222018-09-21 02:07:32225 // Create network quality observer so that it can propagate network quality
226 // changes to the render process.
227 void CreateNetworkQualityObserver();
228
initial.commit09911bf2008-07-26 23:55:29229 void CreateProfileManager();
initial.commit09911bf2008-07-26 23:55:29230 void CreateIconManager();
miguelg23cd2dd72016-04-21 15:24:03231 void CreateNotificationPlatformBridge();
[email protected]29672ab2009-10-30 03:44:03232 void CreateNotificationUIManager();
[email protected]d8ce31e2012-12-19 05:09:21233 void CreatePrintPreviewDialogController();
[email protected]68f88b992011-05-07 02:01:39234 void CreateBackgroundPrintingManager();
[email protected]462a0ff2011-06-02 17:15:34235 void CreateSafeBrowsingService();
engedyc5ef21ad2016-06-17 20:22:27236 void CreateSubresourceFilterRulesetService();
Sophie Changf453c0522017-11-03 06:33:49237 void CreateOptimizationGuideService();
[email protected]9e7f015f2011-05-28 00:24:25238 void CreateStatusTray();
239 void CreateBackgroundModeManager();
[email protected]c027d6d2014-06-05 15:25:40240 void CreateGCMDriver();
Kalvin Lee5873f732022-07-27 01:58:22241 void CreateNetworkTimeTracker();
[email protected]a7a5e992010-12-09 23:39:51242
[email protected]b61f62a2011-11-01 02:02:10243 void ApplyDefaultBrowserPolicy();
[email protected]419a0572011-04-18 22:21:46244
dgnfe075c82016-03-18 11:25:35245 // Methods called to control our lifetime. The browser process can be "pinned"
246 // to make sure it keeps running.
247 void Pin();
248 void Unpin();
249
Keishi Hattori0e45c022021-11-27 09:25:52250 const raw_ptr<StartupData> startup_data_;
Greg Thompsond4ecaa92020-08-20 09:15:40251
[email protected]3b19e8e2012-10-17 19:15:49252 // Must be destroyed after |local_state_|.
Arthur Sonzognicf2ba42a2022-06-23 14:11:33253 // Must be destroyed after |profile_manager_|.
Lei Zhang93477ba2022-09-29 19:47:51254 std::unique_ptr<policy::ChromeBrowserPolicyConnector> const
Scott Violetfdd6f352018-01-12 19:12:29255 browser_policy_connector_;
[email protected]8d6b2432012-03-31 12:11:18256
Arthur Sonzognicf2ba42a2022-06-23 14:11:33257 // Must be destroyed before |browser_policy_connector_|.
Scott Violetfdd6f352018-01-12 19:12:29258 bool created_profile_manager_ = false;
dcheng4af48582016-04-19 00:29:35259 std::unique_ptr<ProfileManager> profile_manager_;
initial.commit09911bf2008-07-26 23:55:29260
Lei Zhange86673c2021-05-21 01:55:19261 const std::unique_ptr<PrefService> local_state_;
initial.commit09911bf2008-07-26 23:55:29262
Pavol Marko11f1bb42020-03-30 18:58:38263 // |metrics_services_manager_| owns this.
Ali Hijazi9594a642022-12-01 14:30:56264 raw_ptr<ChromeMetricsServicesManagerClient, DanglingUntriaged>
265 metrics_services_manager_client_ = nullptr;
Pavol Marko11f1bb42020-03-30 18:58:38266
267 // Must be destroyed before |local_state_|.
268 std::unique_ptr<metrics_services_manager::MetricsServicesManager>
269 metrics_services_manager_;
270
Tarun Bansalcd6a6cb2018-06-27 22:03:22271 std::unique_ptr<network::NetworkQualityTracker> network_quality_tracker_;
272
Tarun Bansal86b39222018-09-21 02:07:32273 // Listens to NetworkQualityTracker and sends network quality updates to the
274 // renderer.
275 std::unique_ptr<
276 network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver>
277 network_quality_observer_;
278
Scott Violetfdd6f352018-01-12 19:12:29279 bool created_icon_manager_ = false;
dcheng4af48582016-04-19 00:29:35280 std::unique_ptr<IconManager> icon_manager_;
initial.commit09911bf2008-07-26 23:55:29281
dcheng4af48582016-04-19 00:29:35282 std::unique_ptr<GpuModeManager> gpu_mode_manager_;
[email protected]e6933d2a2013-03-12 22:32:21283
brettw00899e62016-11-12 02:10:17284#if BUILDFLAG(ENABLE_EXTENSIONS)
Alex Cooper29c20fc2022-12-22 18:17:05285 std::unique_ptr<extensions::ChromeExtensionsBrowserClient>
dcheng4af48582016-04-19 00:29:35286 extensions_browser_client_;
[email protected]84b7a552014-07-19 04:52:06287
[email protected]5a38dfd2012-07-23 23:22:10288 scoped_refptr<extensions::EventRouterForwarder>
[email protected]3ce02412011-03-01 12:01:15289 extension_event_router_forwarder_;
290
dcheng4af48582016-04-19 00:29:35291 std::unique_ptr<MediaFileSystemRegistry> media_file_system_registry_;
[email protected]84b7a552014-07-19 04:52:06292#endif
293
Xiaohan Wang55ae2c012022-01-20 21:49:11294#if !BUILDFLAG(IS_ANDROID)
dcheng4af48582016-04-19 00:29:35295 std::unique_ptr<RemoteDebuggingServer> remote_debugging_server_;
296 std::unique_ptr<DevToolsAutoOpener> devtools_auto_opener_;
[email protected]8b60ca722013-07-19 01:29:02297#endif
298
Brett Wilson65f951c2016-11-03 22:06:12299#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
[email protected]d8ce31e2012-12-19 05:09:21300 scoped_refptr<printing::PrintPreviewDialogController>
301 print_preview_dialog_controller_;
[email protected]dbeebd52010-11-16 20:34:16302
dcheng4af48582016-04-19 00:29:35303 std::unique_ptr<printing::BackgroundPrintingManager>
304 background_printing_manager_;
[email protected]84b7a552014-07-19 04:52:06305#endif
[email protected]68f88b992011-05-07 02:01:39306
Richard Knoll232ad512021-06-10 17:30:08307#if BUILDFLAG(ENABLE_CHROME_NOTIFICATIONS)
[email protected]29672ab2009-10-30 03:44:03308 // Manager for desktop notification UI.
Scott Violetfdd6f352018-01-12 19:12:29309 bool created_notification_ui_manager_ = false;
dcheng4af48582016-04-19 00:29:35310 std::unique_ptr<NotificationUIManager> notification_ui_manager_;
Jinsong Fan0d46f952018-01-31 18:22:58311#endif
[email protected]29672ab2009-10-30 03:44:03312
Xiaohan Wang55ae2c012022-01-20 21:49:11313#if !BUILDFLAG(IS_ANDROID)
dcheng4af48582016-04-19 00:29:35314 std::unique_ptr<IntranetRedirectDetector> intranet_redirect_detector_;
Tommy Lid5b7c22b2020-10-28 01:26:51315#endif
initial.commit09911bf2008-07-26 23:55:29316
dcheng4af48582016-04-19 00:29:35317 std::unique_ptr<StatusTray> status_tray_;
[email protected]9e7f015f2011-05-28 00:24:25318
Peter Beverlooc30c9ddf2021-02-24 19:56:03319#if BUILDFLAG(ENABLE_SYSTEM_NOTIFICATIONS)
Scott Violetfdd6f352018-01-12 19:12:29320 bool created_notification_bridge_ = false;
Joone Hur06fb05f72018-04-19 18:58:23321#endif
322
miguelg23cd2dd72016-04-21 15:24:03323 std::unique_ptr<NotificationPlatformBridge> notification_bridge_;
324
Toni Barzicb598380e2018-11-26 19:14:10325 // Use SystemNotificationHelper::GetInstance to get this instance.
326 std::unique_ptr<SystemNotificationHelper> system_notification_helper_;
327
Denis Kuznetsov32099f32017-12-15 14:04:57328#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
David Rogercf0f5812020-11-13 11:42:12329 // Must be destroyed after the profile manager, because it doesn't remove
330 // itself as a profile attributes storage observer on destruction.
dcheng4af48582016-04-19 00:29:35331 std::unique_ptr<BackgroundModeManager> background_mode_manager_;
thestige4155842014-10-20 18:58:02332#endif
[email protected]3ba226c52011-10-27 22:50:24333
Scott Violetfdd6f352018-01-12 19:12:29334 bool created_safe_browsing_service_ = false;
vakh9a474d832015-11-13 01:43:09335 scoped_refptr<safe_browsing::SafeBrowsingService> safe_browsing_service_;
[email protected]462a0ff2011-06-02 17:15:34336
Scott Violetfdd6f352018-01-12 19:12:29337 bool created_subresource_filter_ruleset_service_ = false;
Eric Robinsonefb3ea552018-11-02 18:24:32338 std::unique_ptr<subresource_filter::RulesetService>
engedyc5ef21ad2016-06-17 20:22:27339 subresource_filter_ruleset_service_;
340
Scott Violetfdd6f352018-01-12 19:12:29341 bool shutting_down_ = false;
initial.commit09911bf2008-07-26 23:55:29342
Scott Violetfdd6f352018-01-12 19:12:29343 bool tearing_down_ = false;
csharrison058781a2015-11-24 21:44:03344
David Dorwin5c884f42022-08-16 01:17:32345#if BUILDFLAG(ENABLE_PRINTING)
initial.commit09911bf2008-07-26 23:55:29346 // Ensures that all the print jobs are finished before closing the browser.
dcheng4af48582016-04-19 00:29:35347 std::unique_ptr<printing::PrintJobManager> print_job_manager_;
David Dorwin5c884f42022-08-16 01:17:32348#endif
initial.commit09911bf2008-07-26 23:55:29349
[email protected]d70539de2009-06-24 22:17:06350 std::string locale_;
initial.commit09911bf2008-07-26 23:55:29351
[email protected]073ed7b2010-09-27 09:20:02352 // Download status updates (like a changing application icon on dock/taskbar)
353 // are global per-application. DownloadStatusUpdater does no work in the ctor
354 // so we don't have to worry about lazy initialization.
dcheng4af48582016-04-19 00:29:35355 std::unique_ptr<DownloadStatusUpdater> download_status_updater_;
[email protected]073ed7b2010-09-27 09:20:02356
[email protected]254ed742011-08-16 18:45:27357 scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
358
[email protected]2a7e7c152010-10-01 20:12:09359 // Ensures that the observers of plugin/print disable/enable state
[email protected]492d2142010-09-10 13:55:18360 // notifications are properly added and removed.
[email protected]2a7e7c152010-10-01 20:12:09361 PrefChangeRegistrar pref_change_registrar_;
[email protected]492d2142010-09-10 13:55:18362
Ryan Sturmf0ad4292019-05-10 00:51:10363 std::unique_ptr<BatteryMetrics> battery_metrics_;
364
Yuta Hijikata235fc62b2020-12-08 03:48:32365// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
366// of lacros-chrome is complete.
Xiaohan Wang55ae2c012022-01-20 21:49:11367#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
danakj8c3eb802015-09-24 07:53:00368 base::RepeatingTimer autoupdate_timer_;
[email protected]bd48c2b02010-04-09 20:32:42369
370 // Gets called by autoupdate timer to see if browser needs restart and can be
371 // restarted, and if that's the case, restarts the browser.
372 void OnAutoupdateTimer();
Greg Thompsonf9ce2502017-11-14 00:13:35373 bool IsRunningInBackground() const;
374 void OnPendingRestartResult(bool is_update_pending_restart);
[email protected]f6e6d2e2011-10-28 18:39:22375 void RestartBackgroundInstance();
Xiaohan Wang55ae2c012022-01-20 21:49:11376#endif // BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) ||
Yuta Hijikata235fc62b2020-12-08 03:48:32377 // BUILDFLAG(IS_CHROMEOS_LACROS))
[email protected]bd48c2b02010-04-09 20:32:42378
[email protected]9f108f22013-04-09 00:39:56379 // component updater is normally not used under ChromeOS due
380 // to concerns over integrity of data shared between profiles,
381 // but some users of component updater only install per-user.
dcheng4af48582016-04-19 00:29:35382 std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
thestig11b815e92014-08-26 00:32:14383
Xiaohan Wang55ae2c012022-01-20 21:49:11384#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
Akihiro Otacee2d142021-06-08 00:52:05385 // Used to create a singleton instance of SodaInstallerImpl, which can be
386 // retrieved using speech::SodaInstaller::GetInstance().
387 // SodaInstallerImpl depends on ComponentUpdateService, so define it here
388 // to ensure that SodaInstallerImpl gets destructed first.
389 std::unique_ptr<speech::SodaInstallerImpl> soda_installer_impl_;
390#endif
391
392#if BUILDFLAG(IS_CHROMEOS_ASH)
393 // Chrome OS has a different implementation of SodaInstaller.
394 std::unique_ptr<speech::SodaInstallerImplChromeOS> soda_installer_impl_;
395#endif
396
dcheng4af48582016-04-19 00:29:35397 std::unique_ptr<BrowserProcessPlatformPart> platform_part_;
[email protected]7cad6b0d2013-04-25 20:29:32398
[email protected]bbf32c52013-06-03 14:05:52399 // Lazily initialized.
dcheng4af48582016-04-19 00:29:35400 std::unique_ptr<WebRtcLogUploader> webrtc_log_uploader_;
Elad Alon7264d6a2018-03-21 15:06:26401
402 // WebRtcEventLogManager is a singleton which is instaniated before anything
403 // that needs it, and lives until ~BrowserProcessImpl(). This allows it to
404 // safely post base::Unretained(this) references to an internally owned task
405 // queue, since after ~BrowserProcessImpl(), those tasks would no longer run.
406 std::unique_ptr<WebRtcEventLogManager> webrtc_event_log_manager_;
[email protected]bbf32c52013-06-03 14:05:52407
dcheng4af48582016-04-19 00:29:35408 std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_;
[email protected]72f93712014-05-19 15:10:39409
dcheng4af48582016-04-19 00:29:35410 std::unique_ptr<gcm::GCMDriver> gcm_driver_;
[email protected]c027d6d2014-06-05 15:25:40411
Sebastien Marchand2ebd9252018-11-08 18:39:35412 std::unique_ptr<resource_coordinator::ResourceCoordinatorParts>
413 resource_coordinator_parts_;
Sam McNallye36abbc2017-07-20 01:04:28414
Lukasz Anforowicz60d1253d2019-05-08 16:31:37415 std::unique_ptr<SecureOriginPrefsObserver> secure_origin_prefs_observer_;
Lukasz Anforowicz65c61162019-03-27 20:33:58416 std::unique_ptr<SiteIsolationPrefsObserver> site_isolation_prefs_observer_;
417
Xiaohan Wang55ae2c012022-01-20 21:49:11418#if !BUILDFLAG(IS_ANDROID)
Wez25fd35f2018-05-25 22:57:41419 // Called to signal the process' main message loop to exit.
420 base::OnceClosure quit_closure_;
Greg Thompson08451a42020-02-04 23:45:54421
Reilly Grantbfc2ab72021-06-02 23:57:30422 std::unique_ptr<SerialPolicyAllowedPorts> serial_policy_allowed_ports_;
Matt Reynoldse6efee42022-02-08 01:38:56423 std::unique_ptr<HidPolicyAllowedDevices> hid_policy_allowed_devices_;
Jack Hsiehea76b94b52022-12-13 16:37:05424 std::unique_ptr<HidSystemTrayIcon> hid_system_tray_icon_;
Reilly Grantbfc2ab72021-06-02 23:57:30425
Greg Thompson08451a42020-02-04 23:45:54426 BuildState build_state_;
Wez25fd35f2018-05-25 22:57:41427#endif
428
Xiaohan Wang55ae2c012022-01-20 21:49:11429#if BUILDFLAG(IS_ANDROID)
Oksana Zhuravlova3a4e4212021-02-17 21:51:33430 std::unique_ptr<base::android::ApplicationStatusListener> app_state_listener_;
431#endif
432
Jesse McKenna8cb0cbe32022-03-07 19:34:16433 // Observes application-wide events and logs them to breadcrumbs. Null if
434 // breadcrumbs logging is disabled.
Jesse McKenna98e60df2021-08-17 16:57:08435 std::unique_ptr<breadcrumbs::ApplicationBreadcrumbsLogger>
436 application_breadcrumbs_logger_;
437
gab25894fe2017-05-30 03:40:36438 SEQUENCE_CHECKER(sequence_checker_);
initial.commit09911bf2008-07-26 23:55:29439};
440
[email protected]58dca552009-06-17 00:35:02441#endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_