ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / browser_process.h
blobc5a889fd82b756008122d4a478bab04f082368ef
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This interface is for managing the global services of the application. Each
6 // service is lazily created when requested the first time. The service getters
7 // will return NULL if the service is not available, so callers must check for
8 // this condition.
10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_H_
11 #define CHROME_BROWSER_BROWSER_PROCESS_H_
13 #include <string>
15 #include "base/basictypes.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "chrome/browser/browser_process_platform_part.h"
18 #include "chrome/browser/shell_integration.h"
19 #include "chrome/browser/ui/host_desktop.h"
21 class BackgroundModeManager;
22 class ChromeNetLog;
23 class CRLSetFetcher;
24 class DownloadRequestLimiter;
25 class DownloadStatusUpdater;
26 class GLStringManager;
27 class GpuModeManager;
28 class IconManager;
29 class IntranetRedirectDetector;
30 class IOThread;
31 class MediaFileSystemRegistry;
32 class MetricsServicesManager;
33 class NotificationUIManager;
34 class PrefRegistrySimple;
35 class PrefService;
36 class Profile;
37 class ProfileManager;
38 class PromoResourceService;
39 class SafeBrowsingService;
40 class StatusTray;
41 class WatchDogThread;
42 #if defined(ENABLE_WEBRTC)
43 class WebRtcLogUploader;
44 #endif
46 namespace chrome_variations {
47 class VariationsService;
50 namespace component_updater {
51 class ComponentUpdateService;
52 class PnaclComponentInstaller;
53 class SupervisedUserWhitelistInstaller;
56 namespace extensions {
57 class EventRouterForwarder;
60 namespace gcm {
61 class GCMDriver;
64 namespace memory {
65 class OomPriorityManager;
68 namespace message_center {
69 class MessageCenter;
72 namespace metrics {
73 class MetricsService;
76 namespace net {
77 class URLRequestContextGetter;
80 namespace network_time {
81 class NetworkTimeTracker;
84 namespace policy {
85 class BrowserPolicyConnector;
86 class PolicyService;
89 namespace printing {
90 class BackgroundPrintingManager;
91 class PrintJobManager;
92 class PrintPreviewDialogController;
95 namespace rappor {
96 class RapporService;
99 namespace safe_browsing {
100 class ClientSideDetectionService;
103 // NOT THREAD SAFE, call only from the main thread.
104 // These functions shouldn't return NULL unless otherwise noted.
105 class BrowserProcess {
106 public:
107 BrowserProcess();
108 virtual ~BrowserProcess();
110 // Called when the ResourceDispatcherHost object is created by content.
111 virtual void ResourceDispatcherHostCreated() = 0;
113 // Invoked when the user is logging out/shutting down. When logging off we may
114 // not have enough time to do a normal shutdown. This method is invoked prior
115 // to normal shutdown and saves any state that must be saved before we are
116 // continue shutdown.
117 virtual void EndSession() = 0;
119 // Gets the manager for the various metrics-related services, constructing it
120 // if necessary.
121 virtual MetricsServicesManager* GetMetricsServicesManager() = 0;
123 // Services: any of these getters may return NULL
124 virtual metrics::MetricsService* metrics_service() = 0;
125 virtual rappor::RapporService* rappor_service() = 0;
126 virtual ProfileManager* profile_manager() = 0;
127 virtual PrefService* local_state() = 0;
128 virtual net::URLRequestContextGetter* system_request_context() = 0;
129 virtual chrome_variations::VariationsService* variations_service() = 0;
130 virtual PromoResourceService* promo_resource_service() = 0;
132 virtual BrowserProcessPlatformPart* platform_part() = 0;
134 virtual extensions::EventRouterForwarder*
135 extension_event_router_forwarder() = 0;
137 // Returns the manager for desktop notifications.
138 virtual NotificationUIManager* notification_ui_manager() = 0;
140 // MessageCenter is a global list of currently displayed notifications.
141 virtual message_center::MessageCenter* message_center() = 0;
143 // Returns the state object for the thread that we perform I/O
144 // coordination on (network requests, communication with renderers,
145 // etc.
147 // Can be NULL close to startup and shutdown.
149 // NOTE: If you want to post a task to the IO thread, use
150 // BrowserThread::PostTask (or other variants).
151 virtual IOThread* io_thread() = 0;
153 // Returns the thread that is used for health check of all browser threads.
154 virtual WatchDogThread* watchdog_thread() = 0;
156 // Starts and manages the policy system.
157 virtual policy::BrowserPolicyConnector* browser_policy_connector() = 0;
159 // This is the main interface for chromium components to retrieve policy
160 // information from the policy system.
161 virtual policy::PolicyService* policy_service() = 0;
163 virtual IconManager* icon_manager() = 0;
165 virtual GLStringManager* gl_string_manager() = 0;
167 virtual GpuModeManager* gpu_mode_manager() = 0;
169 virtual void CreateDevToolsHttpProtocolHandler(
170 chrome::HostDesktopType host_desktop_type,
171 const std::string& ip,
172 uint16 port) = 0;
174 virtual unsigned int AddRefModule() = 0;
175 virtual unsigned int ReleaseModule() = 0;
177 virtual bool IsShuttingDown() = 0;
179 virtual printing::PrintJobManager* print_job_manager() = 0;
180 virtual printing::PrintPreviewDialogController*
181 print_preview_dialog_controller() = 0;
182 virtual printing::BackgroundPrintingManager*
183 background_printing_manager() = 0;
185 virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
187 // Returns the locale used by the application.
188 virtual const std::string& GetApplicationLocale() = 0;
189 virtual void SetApplicationLocale(const std::string& locale) = 0;
191 virtual DownloadStatusUpdater* download_status_updater() = 0;
192 virtual DownloadRequestLimiter* download_request_limiter() = 0;
194 // Returns the object that manages background applications.
195 virtual BackgroundModeManager* background_mode_manager() = 0;
196 virtual void set_background_mode_manager_for_test(
197 scoped_ptr<BackgroundModeManager> manager) = 0;
199 // Returns the StatusTray, which provides an API for displaying status icons
200 // in the system status tray. Returns NULL if status icons are not supported
201 // on this platform (or this is a unit test).
202 virtual StatusTray* status_tray() = 0;
204 // Returns the SafeBrowsing service.
205 virtual SafeBrowsingService* safe_browsing_service() = 0;
207 // Returns an object which handles communication with the SafeBrowsing
208 // client-side detection servers.
209 virtual safe_browsing::ClientSideDetectionService*
210 safe_browsing_detection_service() = 0;
212 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
213 // This will start a timer that, if Chrome is in persistent mode, will check
214 // whether an update is available, and if that's the case, restart the
215 // browser. Note that restart code will strip some of the command line keys
216 // and all loose values from the cl this instance of Chrome was launched with,
217 // and add the command line key that will force Chrome to start in the
218 // background mode. For the full list of "blacklisted" keys, refer to
219 // |kSwitchesToRemoveOnAutorestart| array in browser_process_impl.cc.
220 virtual void StartAutoupdateTimer() = 0;
221 #endif
223 virtual ChromeNetLog* net_log() = 0;
225 virtual component_updater::ComponentUpdateService* component_updater() = 0;
227 virtual CRLSetFetcher* crl_set_fetcher() = 0;
229 virtual component_updater::PnaclComponentInstaller*
230 pnacl_component_installer() = 0;
232 virtual component_updater::SupervisedUserWhitelistInstaller*
233 supervised_user_whitelist_installer() = 0;
235 virtual MediaFileSystemRegistry* media_file_system_registry() = 0;
237 virtual bool created_local_state() const = 0;
239 #if defined(ENABLE_WEBRTC)
240 virtual WebRtcLogUploader* webrtc_log_uploader() = 0;
241 #endif
243 virtual network_time::NetworkTimeTracker* network_time_tracker() = 0;
245 virtual gcm::GCMDriver* gcm_driver() = 0;
247 // Returns the out-of-memory priority manager if it exists, null otherwise.
248 virtual memory::OomPriorityManager* GetOomPriorityManager() = 0;
250 // Returns the default web client state of Chrome (i.e., was it the user's
251 // default browser) at the time a previous check was made sometime between
252 // process startup and now.
253 virtual ShellIntegration::DefaultWebClientState
254 CachedDefaultWebClientState() = 0;
256 private:
257 DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
260 extern BrowserProcess* g_browser_process;
262 #endif // CHROME_BROWSER_BROWSER_PROCESS_H_