NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / browser_process.h
blobfaf5d6fbf3c60732d05e5e3296ce683b326ef54e
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/ui/host_desktop.h"
20 class AutomationProviderList;
21 class BackgroundModeManager;
22 class BookmarkPromptController;
23 class ChromeNetLog;
24 class CRLSetFetcher;
25 class DownloadRequestLimiter;
26 class DownloadStatusUpdater;
27 class GLStringManager;
28 class GpuModeManager;
29 class IconManager;
30 class IntranetRedirectDetector;
31 class IOThread;
32 class MediaFileSystemRegistry;
33 class MetricsService;
34 class NotificationUIManager;
35 class PrefRegistrySimple;
36 class PrefService;
37 class Profile;
38 class ProfileManager;
39 class SafeBrowsingService;
40 class StatusTray;
41 class StorageMonitor;
42 class WatchDogThread;
43 #if defined(ENABLE_WEBRTC)
44 class WebRtcLogUploader;
45 #endif
47 namespace chrome_variations {
48 class VariationsService;
51 namespace component_updater {
52 class ComponentUpdateService;
53 class PnaclComponentInstaller;
56 namespace extensions {
57 class EventRouterForwarder;
60 namespace message_center {
61 class MessageCenter;
64 namespace net {
65 class URLRequestContextGetter;
68 namespace policy {
69 class BrowserPolicyConnector;
70 class PolicyService;
73 namespace prerender {
74 class PrerenderTracker;
77 namespace printing {
78 class BackgroundPrintingManager;
79 class PrintJobManager;
80 class PrintPreviewDialogController;
83 namespace safe_browsing {
84 class ClientSideDetectionService;
87 // NOT THREAD SAFE, call only from the main thread.
88 // These functions shouldn't return NULL unless otherwise noted.
89 class BrowserProcess {
90 public:
91 BrowserProcess();
92 virtual ~BrowserProcess();
94 // Called when the ResourceDispatcherHost object is created by content.
95 virtual void ResourceDispatcherHostCreated() = 0;
97 // Invoked when the user is logging out/shutting down. When logging off we may
98 // not have enough time to do a normal shutdown. This method is invoked prior
99 // to normal shutdown and saves any state that must be saved before we are
100 // continue shutdown.
101 virtual void EndSession() = 0;
103 // Services: any of these getters may return NULL
104 virtual MetricsService* metrics_service() = 0;
105 virtual ProfileManager* profile_manager() = 0;
106 virtual PrefService* local_state() = 0;
107 virtual net::URLRequestContextGetter* system_request_context() = 0;
108 virtual chrome_variations::VariationsService* variations_service() = 0;
110 virtual BrowserProcessPlatformPart* platform_part() = 0;
112 virtual extensions::EventRouterForwarder*
113 extension_event_router_forwarder() = 0;
115 // Returns the manager for desktop notifications.
116 virtual NotificationUIManager* notification_ui_manager() = 0;
118 // MessageCenter is a global list of currently displayed notifications.
119 virtual message_center::MessageCenter* message_center() = 0;
121 // Returns the state object for the thread that we perform I/O
122 // coordination on (network requests, communication with renderers,
123 // etc.
125 // Can be NULL close to startup and shutdown.
127 // NOTE: If you want to post a task to the IO thread, use
128 // BrowserThread::PostTask (or other variants).
129 virtual IOThread* io_thread() = 0;
131 // Returns the thread that is used for health check of all browser threads.
132 virtual WatchDogThread* watchdog_thread() = 0;
134 // Starts and manages the policy system.
135 virtual policy::BrowserPolicyConnector* browser_policy_connector() = 0;
137 // This is the main interface for chromium components to retrieve policy
138 // information from the policy system.
139 virtual policy::PolicyService* policy_service() = 0;
141 virtual IconManager* icon_manager() = 0;
143 virtual GLStringManager* gl_string_manager() = 0;
145 virtual GpuModeManager* gpu_mode_manager() = 0;
147 virtual AutomationProviderList* GetAutomationProviderList() = 0;
149 virtual void CreateDevToolsHttpProtocolHandler(
150 chrome::HostDesktopType host_desktop_type,
151 const std::string& ip,
152 int port,
153 const std::string& frontend_url) = 0;
155 virtual unsigned int AddRefModule() = 0;
156 virtual unsigned int ReleaseModule() = 0;
158 virtual bool IsShuttingDown() = 0;
160 virtual printing::PrintJobManager* print_job_manager() = 0;
161 virtual printing::PrintPreviewDialogController*
162 print_preview_dialog_controller() = 0;
163 virtual printing::BackgroundPrintingManager*
164 background_printing_manager() = 0;
166 virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
168 // Returns the locale used by the application.
169 virtual const std::string& GetApplicationLocale() = 0;
170 virtual void SetApplicationLocale(const std::string& locale) = 0;
172 virtual DownloadStatusUpdater* download_status_updater() = 0;
173 virtual DownloadRequestLimiter* download_request_limiter() = 0;
175 // Returns the object that manages background applications.
176 virtual BackgroundModeManager* background_mode_manager() = 0;
177 virtual void set_background_mode_manager_for_test(
178 scoped_ptr<BackgroundModeManager> manager) = 0;
180 // Returns the StatusTray, which provides an API for displaying status icons
181 // in the system status tray. Returns NULL if status icons are not supported
182 // on this platform (or this is a unit test).
183 virtual StatusTray* status_tray() = 0;
185 // Returns the SafeBrowsing service.
186 virtual SafeBrowsingService* safe_browsing_service() = 0;
188 // Returns an object which handles communication with the SafeBrowsing
189 // client-side detection servers.
190 virtual safe_browsing::ClientSideDetectionService*
191 safe_browsing_detection_service() = 0;
193 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
194 // This will start a timer that, if Chrome is in persistent mode, will check
195 // whether an update is available, and if that's the case, restart the
196 // browser. Note that restart code will strip some of the command line keys
197 // and all loose values from the cl this instance of Chrome was launched with,
198 // and add the command line key that will force Chrome to start in the
199 // background mode. For the full list of "blacklisted" keys, refer to
200 // |kSwitchesToRemoveOnAutorestart| array in browser_process_impl.cc.
201 virtual void StartAutoupdateTimer() = 0;
202 #endif
204 virtual ChromeNetLog* net_log() = 0;
206 virtual prerender::PrerenderTracker* prerender_tracker() = 0;
208 virtual component_updater::ComponentUpdateService* component_updater() = 0;
210 virtual CRLSetFetcher* crl_set_fetcher() = 0;
212 virtual component_updater::PnaclComponentInstaller*
213 pnacl_component_installer() = 0;
215 virtual BookmarkPromptController* bookmark_prompt_controller() = 0;
217 virtual MediaFileSystemRegistry* media_file_system_registry() = 0;
219 virtual StorageMonitor* storage_monitor() = 0;
221 virtual bool created_local_state() const = 0;
223 #if defined(ENABLE_WEBRTC)
224 virtual WebRtcLogUploader* webrtc_log_uploader() = 0;
225 #endif
227 private:
228 DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
231 extern BrowserProcess* g_browser_process;
233 #endif // CHROME_BROWSER_BROWSER_PROCESS_H_