blob: c8286bc81fb3a039139f6c513b23c6e371863aa7 [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
[email protected]88264c92009-10-01 17:17:365// This interface is for managing the global services of the application. Each
initial.commit09911bf2008-07-26 23:55:296// 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.
9
[email protected]bfd04a62009-02-01 18:16:5610#ifndef CHROME_BROWSER_BROWSER_PROCESS_H_
11#define CHROME_BROWSER_BROWSER_PROCESS_H_
initial.commit09911bf2008-07-26 23:55:2912
13#include <string>
14
15#include "base/basictypes.h"
[email protected]55d342402013-02-22 11:28:0616#include "chrome/browser/ui/host_desktop.h"
initial.commit09911bf2008-07-26 23:55:2917
18class AutomationProviderList;
[email protected]9e7f015f2011-05-28 00:24:2519class BackgroundModeManager;
[email protected]195c99c2012-10-31 06:24:5120class BookmarkPromptController;
[email protected]d6f37fc2011-02-13 23:58:4121class ChromeNetLog;
[email protected]e9613b52012-11-27 22:35:1322class CommandLine;
[email protected]ca167a32011-09-30 15:19:1123class CRLSetFetcher;
[email protected]c1adf5a2011-08-03 22:11:3724class ComponentUpdateService;
[email protected]41291322010-07-15 17:09:0125class DownloadRequestLimiter;
[email protected]073ed7b2010-09-27 09:20:0226class DownloadStatusUpdater;
[email protected]a9830b52012-12-17 23:30:3627class GLStringManager;
[email protected]e6933d2a2013-03-12 22:32:2128class GpuModeManager;
initial.commit09911bf2008-07-26 23:55:2929class IconManager;
[email protected]d99bcaa2010-12-05 20:15:5630class IntranetRedirectDetector;
31class IOThread;
initial.commit09911bf2008-07-26 23:55:2932class MetricsService;
[email protected]29672ab2009-10-30 03:44:0333class NotificationUIManager;
[email protected]b1de2c72013-02-06 02:45:4734class PrefRegistrySimple;
35class PrefService;
[email protected]4475d232011-07-27 15:29:2036class Profile;
initial.commit09911bf2008-07-26 23:55:2937class ProfileManager;
[email protected]94e385322012-10-08 20:21:3338class RenderWidgetSnapshotTaker;
[email protected]462a0ff2011-06-02 17:15:3439class SafeBrowsingService;
[email protected]9e7f015f2011-05-28 00:24:2540class StatusTray;
[email protected]0b565182011-03-02 18:11:1541class WatchDogThread;
initial.commit09911bf2008-07-26 23:55:2942
[email protected]42aec8df2012-12-12 06:03:5743namespace chrome {
44class MediaFileSystemRegistry;
45}
46
[email protected]db0e86dd2011-03-16 14:47:2147#if defined(OS_CHROMEOS)
[email protected]38489a32012-05-11 02:24:5448namespace chromeos {
[email protected]5b869962011-09-20 19:49:3349class OomPriorityManager;
50}
[email protected]db0e86dd2011-03-16 14:47:2151#endif // defined(OS_CHROMEOS)
52
[email protected]04811242012-07-06 18:04:2953namespace chrome_variations {
54class VariationsService;
55}
56
[email protected]5a38dfd2012-07-23 23:22:1057namespace extensions {
58class EventRouterForwarder;
59}
60
[email protected]8393aa62013-01-23 19:40:1061#if defined(ENABLE_MESSAGE_CENTER)
62namespace message_center {
63class MessageCenter;
64}
65#endif
66
[email protected]abe2c032011-03-31 18:49:3467namespace net {
68class URLRequestContextGetter;
69}
70
[email protected]80745e32012-05-08 01:22:1271namespace policy {
72class BrowserPolicyConnector;
73class PolicyService;
74}
75
[email protected]1459fb62011-05-25 19:03:2776namespace prerender {
77class PrerenderTracker;
78}
79
initial.commit09911bf2008-07-26 23:55:2980namespace printing {
[email protected]68f88b992011-05-07 02:01:3981class BackgroundPrintingManager;
initial.commit09911bf2008-07-26 23:55:2982class PrintJobManager;
[email protected]d8ce31e2012-12-19 05:09:2183class PrintPreviewDialogController;
initial.commit09911bf2008-07-26 23:55:2984}
85
[email protected]462a0ff2011-06-02 17:15:3486namespace safe_browsing {
87class ClientSideDetectionService;
88}
89
initial.commit09911bf2008-07-26 23:55:2990// NOT THREAD SAFE, call only from the main thread.
91// These functions shouldn't return NULL unless otherwise noted.
92class BrowserProcess {
93 public:
[email protected]1889dc1b2010-10-14 22:03:1394 BrowserProcess();
95 virtual ~BrowserProcess();
initial.commit09911bf2008-07-26 23:55:2996
[email protected]99907362012-01-11 05:41:4097 // Called when the ResourceDispatcherHost object is created by content.
98 virtual void ResourceDispatcherHostCreated() = 0;
99
initial.commit09911bf2008-07-26 23:55:29100 // Invoked when the user is logging out/shutting down. When logging off we may
101 // not have enough time to do a normal shutdown. This method is invoked prior
102 // to normal shutdown and saves any state that must be saved before we are
103 // continue shutdown.
104 virtual void EndSession() = 0;
105
106 // Services: any of these getters may return NULL
initial.commit09911bf2008-07-26 23:55:29107 virtual MetricsService* metrics_service() = 0;
108 virtual ProfileManager* profile_manager() = 0;
[email protected]b1de2c72013-02-06 02:45:47109 virtual PrefService* local_state() = 0;
[email protected]abe2c032011-03-31 18:49:34110 virtual net::URLRequestContextGetter* system_request_context() = 0;
[email protected]04811242012-07-06 18:04:29111 virtual chrome_variations::VariationsService* variations_service() = 0;
[email protected]db0e86dd2011-03-16 14:47:21112
113#if defined(OS_CHROMEOS)
[email protected]5b869962011-09-20 19:49:33114 // Returns the out-of-memory priority manager.
[email protected]38489a32012-05-11 02:24:54115 virtual chromeos::OomPriorityManager* oom_priority_manager() = 0;
[email protected]db0e86dd2011-03-16 14:47:21116#endif // defined(OS_CHROMEOS)
117
[email protected]5a38dfd2012-07-23 23:22:10118 virtual extensions::EventRouterForwarder*
[email protected]3ce02412011-03-01 12:01:15119 extension_event_router_forwarder() = 0;
initial.commit09911bf2008-07-26 23:55:29120
[email protected]29672ab2009-10-30 03:44:03121 // Returns the manager for desktop notifications.
122 virtual NotificationUIManager* notification_ui_manager() = 0;
123
[email protected]8393aa62013-01-23 19:40:10124#if defined(ENABLE_MESSAGE_CENTER)
125 // MessageCenter is a global list of currently displayed notifications.
126 virtual message_center::MessageCenter* message_center() = 0;
127#endif
128
[email protected]ed10dd12011-12-07 12:03:42129 // Returns the state object for the thread that we perform I/O
130 // coordination on (network requests, communication with renderers,
131 // etc.
132 //
133 // Can be NULL close to startup and shutdown.
134 //
135 // NOTE: If you want to post a task to the IO thread, use
136 // BrowserThread::PostTask (or other variants).
[email protected]0ac83682010-01-22 17:46:27137 virtual IOThread* io_thread() = 0;
initial.commit09911bf2008-07-26 23:55:29138
[email protected]0b565182011-03-02 18:11:15139 // Returns the thread that is used for health check of all browser threads.
140 virtual WatchDogThread* watchdog_thread() = 0;
141
[email protected]a4179c2a2012-02-09 18:14:21142 // Starts and manages the policy system.
[email protected]985655a2011-02-23 09:54:25143 virtual policy::BrowserPolicyConnector* browser_policy_connector() = 0;
[email protected]f2a893c2011-01-05 09:38:07144
[email protected]a4179c2a2012-02-09 18:14:21145 // This is the main interface for chromium components to retrieve policy
146 // information from the policy system.
147 virtual policy::PolicyService* policy_service() = 0;
148
initial.commit09911bf2008-07-26 23:55:29149 virtual IconManager* icon_manager() = 0;
150
[email protected]a9830b52012-12-17 23:30:36151 virtual GLStringManager* gl_string_manager() = 0;
152
[email protected]e6933d2a2013-03-12 22:32:21153 virtual GpuModeManager* gpu_mode_manager() = 0;
154
[email protected]94e385322012-10-08 20:21:33155 virtual RenderWidgetSnapshotTaker* GetRenderWidgetSnapshotTaker() = 0;
[email protected]58dca552009-06-17 00:35:02156
[email protected]120655d2011-09-16 22:10:32157 virtual AutomationProviderList* GetAutomationProviderList() = 0;
initial.commit09911bf2008-07-26 23:55:29158
[email protected]76698ea2012-08-24 20:50:37159 virtual void CreateDevToolsHttpProtocolHandler(
[email protected]4475d232011-07-27 15:29:20160 Profile* profile,
[email protected]55d342402013-02-22 11:28:06161 chrome::HostDesktopType host_desktop_type,
[email protected]01000cf12011-02-04 11:39:22162 const std::string& ip,
[email protected]5613126e2011-01-31 15:27:55163 int port,
164 const std::string& frontend_url) = 0;
165
initial.commit09911bf2008-07-26 23:55:29166 virtual unsigned int AddRefModule() = 0;
167 virtual unsigned int ReleaseModule() = 0;
168
169 virtual bool IsShuttingDown() = 0;
170
initial.commit09911bf2008-07-26 23:55:29171 virtual printing::PrintJobManager* print_job_manager() = 0;
[email protected]d8ce31e2012-12-19 05:09:21172 virtual printing::PrintPreviewDialogController*
173 print_preview_dialog_controller() = 0;
[email protected]68f88b992011-05-07 02:01:39174 virtual printing::BackgroundPrintingManager*
175 background_printing_manager() = 0;
initial.commit09911bf2008-07-26 23:55:29176
[email protected]c4ff4952010-01-08 19:12:47177 virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
initial.commit09911bf2008-07-26 23:55:29178
179 // Returns the locale used by the application.
[email protected]d70539de2009-06-24 22:17:06180 virtual const std::string& GetApplicationLocale() = 0;
[email protected]f1b6de22010-03-06 12:13:47181 virtual void SetApplicationLocale(const std::string& locale) = 0;
initial.commit09911bf2008-07-26 23:55:29182
[email protected]073ed7b2010-09-27 09:20:02183 virtual DownloadStatusUpdater* download_status_updater() = 0;
[email protected]254ed742011-08-16 18:45:27184 virtual DownloadRequestLimiter* download_request_limiter() = 0;
[email protected]4cdac102008-10-17 18:07:02185
[email protected]9e7f015f2011-05-28 00:24:25186 // Returns the object that manages background applications.
187 virtual BackgroundModeManager* background_mode_manager() = 0;
188
189 // Returns the StatusTray, which provides an API for displaying status icons
190 // in the system status tray. Returns NULL if status icons are not supported
191 // on this platform (or this is a unit test).
192 virtual StatusTray* status_tray() = 0;
193
[email protected]462a0ff2011-06-02 17:15:34194 // Returns the SafeBrowsing service.
195 virtual SafeBrowsingService* safe_browsing_service() = 0;
196
[email protected]a7a5e992010-12-09 23:39:51197 // Returns an object which handles communication with the SafeBrowsing
198 // client-side detection servers.
199 virtual safe_browsing::ClientSideDetectionService*
200 safe_browsing_detection_service() = 0;
201
[email protected]3cdacd42010-04-30 18:55:53202#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
[email protected]bd48c2b02010-04-09 20:32:42203 // This will start a timer that, if Chrome is in persistent mode, will check
204 // whether an update is available, and if that's the case, restart the
205 // browser. Note that restart code will strip some of the command line keys
206 // and all loose values from the cl this instance of Chrome was launched with,
207 // and add the command line key that will force Chrome to start in the
208 // background mode. For the full list of "blacklisted" keys, refer to
209 // |kSwitchesToRemoveOnAutorestart| array in browser_process_impl.cc.
210 virtual void StartAutoupdateTimer() = 0;
[email protected]3cdacd42010-04-30 18:55:53211#endif
[email protected]bd48c2b02010-04-09 20:32:42212
[email protected]d6f37fc2011-02-13 23:58:41213 virtual ChromeNetLog* net_log() = 0;
214
[email protected]1459fb62011-05-25 19:03:27215 virtual prerender::PrerenderTracker* prerender_tracker() = 0;
216
[email protected]c1adf5a2011-08-03 22:11:37217 virtual ComponentUpdateService* component_updater() = 0;
218
[email protected]ca167a32011-09-30 15:19:11219 virtual CRLSetFetcher* crl_set_fetcher() = 0;
220
[email protected]195c99c2012-10-31 06:24:51221 virtual BookmarkPromptController* bookmark_prompt_controller() = 0;
222
[email protected]42aec8df2012-12-12 06:03:57223 virtual chrome::MediaFileSystemRegistry* media_file_system_registry() = 0;
224
[email protected]e9613b52012-11-27 22:35:13225 virtual void PlatformSpecificCommandLineProcessing(
226 const CommandLine& command_line) = 0;
227
initial.commit09911bf2008-07-26 23:55:29228 private:
[email protected]bfd04a62009-02-01 18:16:56229 DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
initial.commit09911bf2008-07-26 23:55:29230};
231
232extern BrowserProcess* g_browser_process;
233
[email protected]bfd04a62009-02-01 18:16:56234#endif // CHROME_BROWSER_BROWSER_PROCESS_H_