[email protected] | 3a80ea33 | 2012-01-09 19:53:29 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 88264c9 | 2009-10-01 17:17:36 | [diff] [blame] | 5 | // This interface is for managing the global services of the application. Each |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 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. |
| 9 | |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 10 | #ifndef CHROME_BROWSER_BROWSER_PROCESS_H_ |
| 11 | #define CHROME_BROWSER_BROWSER_PROCESS_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 12 | |
| 13 | #include <string> |
| 14 | |
| 15 | #include "base/basictypes.h" |
[email protected] | 55d34240 | 2013-02-22 11:28:06 | [diff] [blame] | 16 | #include "chrome/browser/ui/host_desktop.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 17 | |
| 18 | class AutomationProviderList; |
[email protected] | 9e7f015f | 2011-05-28 00:24:25 | [diff] [blame] | 19 | class BackgroundModeManager; |
[email protected] | 195c99c | 2012-10-31 06:24:51 | [diff] [blame] | 20 | class BookmarkPromptController; |
[email protected] | d6f37fc | 2011-02-13 23:58:41 | [diff] [blame] | 21 | class ChromeNetLog; |
[email protected] | e9613b5 | 2012-11-27 22:35:13 | [diff] [blame] | 22 | class CommandLine; |
[email protected] | ca167a3 | 2011-09-30 15:19:11 | [diff] [blame] | 23 | class CRLSetFetcher; |
[email protected] | c1adf5a | 2011-08-03 22:11:37 | [diff] [blame] | 24 | class ComponentUpdateService; |
[email protected] | 4129132 | 2010-07-15 17:09:01 | [diff] [blame] | 25 | class DownloadRequestLimiter; |
[email protected] | 073ed7b | 2010-09-27 09:20:02 | [diff] [blame] | 26 | class DownloadStatusUpdater; |
[email protected] | a9830b5 | 2012-12-17 23:30:36 | [diff] [blame] | 27 | class GLStringManager; |
[email protected] | e6933d2a | 2013-03-12 22:32:21 | [diff] [blame^] | 28 | class GpuModeManager; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 29 | class IconManager; |
[email protected] | d99bcaa | 2010-12-05 20:15:56 | [diff] [blame] | 30 | class IntranetRedirectDetector; |
| 31 | class IOThread; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 32 | class MetricsService; |
[email protected] | 29672ab | 2009-10-30 03:44:03 | [diff] [blame] | 33 | class NotificationUIManager; |
[email protected] | b1de2c7 | 2013-02-06 02:45:47 | [diff] [blame] | 34 | class PrefRegistrySimple; |
| 35 | class PrefService; |
[email protected] | 4475d23 | 2011-07-27 15:29:20 | [diff] [blame] | 36 | class Profile; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 37 | class ProfileManager; |
[email protected] | 94e38532 | 2012-10-08 20:21:33 | [diff] [blame] | 38 | class RenderWidgetSnapshotTaker; |
[email protected] | 462a0ff | 2011-06-02 17:15:34 | [diff] [blame] | 39 | class SafeBrowsingService; |
[email protected] | 9e7f015f | 2011-05-28 00:24:25 | [diff] [blame] | 40 | class StatusTray; |
[email protected] | 0b56518 | 2011-03-02 18:11:15 | [diff] [blame] | 41 | class WatchDogThread; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 42 | |
[email protected] | 42aec8df | 2012-12-12 06:03:57 | [diff] [blame] | 43 | namespace chrome { |
| 44 | class MediaFileSystemRegistry; |
| 45 | } |
| 46 | |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 47 | #if defined(OS_CHROMEOS) |
[email protected] | 38489a3 | 2012-05-11 02:24:54 | [diff] [blame] | 48 | namespace chromeos { |
[email protected] | 5b86996 | 2011-09-20 19:49:33 | [diff] [blame] | 49 | class OomPriorityManager; |
| 50 | } |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 51 | #endif // defined(OS_CHROMEOS) |
| 52 | |
[email protected] | 0481124 | 2012-07-06 18:04:29 | [diff] [blame] | 53 | namespace chrome_variations { |
| 54 | class VariationsService; |
| 55 | } |
| 56 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 57 | namespace extensions { |
| 58 | class EventRouterForwarder; |
| 59 | } |
| 60 | |
[email protected] | 8393aa6 | 2013-01-23 19:40:10 | [diff] [blame] | 61 | #if defined(ENABLE_MESSAGE_CENTER) |
| 62 | namespace message_center { |
| 63 | class MessageCenter; |
| 64 | } |
| 65 | #endif |
| 66 | |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 67 | namespace net { |
| 68 | class URLRequestContextGetter; |
| 69 | } |
| 70 | |
[email protected] | 80745e3 | 2012-05-08 01:22:12 | [diff] [blame] | 71 | namespace policy { |
| 72 | class BrowserPolicyConnector; |
| 73 | class PolicyService; |
| 74 | } |
| 75 | |
[email protected] | 1459fb6 | 2011-05-25 19:03:27 | [diff] [blame] | 76 | namespace prerender { |
| 77 | class PrerenderTracker; |
| 78 | } |
| 79 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 80 | namespace printing { |
[email protected] | 68f88b99 | 2011-05-07 02:01:39 | [diff] [blame] | 81 | class BackgroundPrintingManager; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 82 | class PrintJobManager; |
[email protected] | d8ce31e | 2012-12-19 05:09:21 | [diff] [blame] | 83 | class PrintPreviewDialogController; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 84 | } |
| 85 | |
[email protected] | 462a0ff | 2011-06-02 17:15:34 | [diff] [blame] | 86 | namespace safe_browsing { |
| 87 | class ClientSideDetectionService; |
| 88 | } |
| 89 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 90 | // NOT THREAD SAFE, call only from the main thread. |
| 91 | // These functions shouldn't return NULL unless otherwise noted. |
| 92 | class BrowserProcess { |
| 93 | public: |
[email protected] | 1889dc1b | 2010-10-14 22:03:13 | [diff] [blame] | 94 | BrowserProcess(); |
| 95 | virtual ~BrowserProcess(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 96 | |
[email protected] | 9990736 | 2012-01-11 05:41:40 | [diff] [blame] | 97 | // Called when the ResourceDispatcherHost object is created by content. |
| 98 | virtual void ResourceDispatcherHostCreated() = 0; |
| 99 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 100 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 107 | virtual MetricsService* metrics_service() = 0; |
| 108 | virtual ProfileManager* profile_manager() = 0; |
[email protected] | b1de2c7 | 2013-02-06 02:45:47 | [diff] [blame] | 109 | virtual PrefService* local_state() = 0; |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 110 | virtual net::URLRequestContextGetter* system_request_context() = 0; |
[email protected] | 0481124 | 2012-07-06 18:04:29 | [diff] [blame] | 111 | virtual chrome_variations::VariationsService* variations_service() = 0; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 112 | |
| 113 | #if defined(OS_CHROMEOS) |
[email protected] | 5b86996 | 2011-09-20 19:49:33 | [diff] [blame] | 114 | // Returns the out-of-memory priority manager. |
[email protected] | 38489a3 | 2012-05-11 02:24:54 | [diff] [blame] | 115 | virtual chromeos::OomPriorityManager* oom_priority_manager() = 0; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 116 | #endif // defined(OS_CHROMEOS) |
| 117 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 118 | virtual extensions::EventRouterForwarder* |
[email protected] | 3ce0241 | 2011-03-01 12:01:15 | [diff] [blame] | 119 | extension_event_router_forwarder() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 120 | |
[email protected] | 29672ab | 2009-10-30 03:44:03 | [diff] [blame] | 121 | // Returns the manager for desktop notifications. |
| 122 | virtual NotificationUIManager* notification_ui_manager() = 0; |
| 123 | |
[email protected] | 8393aa6 | 2013-01-23 19:40:10 | [diff] [blame] | 124 | #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] | ed10dd1 | 2011-12-07 12:03:42 | [diff] [blame] | 129 | // 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] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 137 | virtual IOThread* io_thread() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 138 | |
[email protected] | 0b56518 | 2011-03-02 18:11:15 | [diff] [blame] | 139 | // Returns the thread that is used for health check of all browser threads. |
| 140 | virtual WatchDogThread* watchdog_thread() = 0; |
| 141 | |
[email protected] | a4179c2a | 2012-02-09 18:14:21 | [diff] [blame] | 142 | // Starts and manages the policy system. |
[email protected] | 985655a | 2011-02-23 09:54:25 | [diff] [blame] | 143 | virtual policy::BrowserPolicyConnector* browser_policy_connector() = 0; |
[email protected] | f2a893c | 2011-01-05 09:38:07 | [diff] [blame] | 144 | |
[email protected] | a4179c2a | 2012-02-09 18:14:21 | [diff] [blame] | 145 | // 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.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 149 | virtual IconManager* icon_manager() = 0; |
| 150 | |
[email protected] | a9830b5 | 2012-12-17 23:30:36 | [diff] [blame] | 151 | virtual GLStringManager* gl_string_manager() = 0; |
| 152 | |
[email protected] | e6933d2a | 2013-03-12 22:32:21 | [diff] [blame^] | 153 | virtual GpuModeManager* gpu_mode_manager() = 0; |
| 154 | |
[email protected] | 94e38532 | 2012-10-08 20:21:33 | [diff] [blame] | 155 | virtual RenderWidgetSnapshotTaker* GetRenderWidgetSnapshotTaker() = 0; |
[email protected] | 58dca55 | 2009-06-17 00:35:02 | [diff] [blame] | 156 | |
[email protected] | 120655d | 2011-09-16 22:10:32 | [diff] [blame] | 157 | virtual AutomationProviderList* GetAutomationProviderList() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 158 | |
[email protected] | 76698ea | 2012-08-24 20:50:37 | [diff] [blame] | 159 | virtual void CreateDevToolsHttpProtocolHandler( |
[email protected] | 4475d23 | 2011-07-27 15:29:20 | [diff] [blame] | 160 | Profile* profile, |
[email protected] | 55d34240 | 2013-02-22 11:28:06 | [diff] [blame] | 161 | chrome::HostDesktopType host_desktop_type, |
[email protected] | 01000cf1 | 2011-02-04 11:39:22 | [diff] [blame] | 162 | const std::string& ip, |
[email protected] | 5613126e | 2011-01-31 15:27:55 | [diff] [blame] | 163 | int port, |
| 164 | const std::string& frontend_url) = 0; |
| 165 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 166 | virtual unsigned int AddRefModule() = 0; |
| 167 | virtual unsigned int ReleaseModule() = 0; |
| 168 | |
| 169 | virtual bool IsShuttingDown() = 0; |
| 170 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 171 | virtual printing::PrintJobManager* print_job_manager() = 0; |
[email protected] | d8ce31e | 2012-12-19 05:09:21 | [diff] [blame] | 172 | virtual printing::PrintPreviewDialogController* |
| 173 | print_preview_dialog_controller() = 0; |
[email protected] | 68f88b99 | 2011-05-07 02:01:39 | [diff] [blame] | 174 | virtual printing::BackgroundPrintingManager* |
| 175 | background_printing_manager() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 176 | |
[email protected] | c4ff495 | 2010-01-08 19:12:47 | [diff] [blame] | 177 | virtual IntranetRedirectDetector* intranet_redirect_detector() = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 178 | |
| 179 | // Returns the locale used by the application. |
[email protected] | d70539de | 2009-06-24 22:17:06 | [diff] [blame] | 180 | virtual const std::string& GetApplicationLocale() = 0; |
[email protected] | f1b6de2 | 2010-03-06 12:13:47 | [diff] [blame] | 181 | virtual void SetApplicationLocale(const std::string& locale) = 0; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 182 | |
[email protected] | 073ed7b | 2010-09-27 09:20:02 | [diff] [blame] | 183 | virtual DownloadStatusUpdater* download_status_updater() = 0; |
[email protected] | 254ed74 | 2011-08-16 18:45:27 | [diff] [blame] | 184 | virtual DownloadRequestLimiter* download_request_limiter() = 0; |
[email protected] | 4cdac10 | 2008-10-17 18:07:02 | [diff] [blame] | 185 | |
[email protected] | 9e7f015f | 2011-05-28 00:24:25 | [diff] [blame] | 186 | // 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] | 462a0ff | 2011-06-02 17:15:34 | [diff] [blame] | 194 | // Returns the SafeBrowsing service. |
| 195 | virtual SafeBrowsingService* safe_browsing_service() = 0; |
| 196 | |
[email protected] | a7a5e99 | 2010-12-09 23:39:51 | [diff] [blame] | 197 | // 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] | 3cdacd4 | 2010-04-30 18:55:53 | [diff] [blame] | 202 | #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
[email protected] | bd48c2b0 | 2010-04-09 20:32:42 | [diff] [blame] | 203 | // 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] | 3cdacd4 | 2010-04-30 18:55:53 | [diff] [blame] | 211 | #endif |
[email protected] | bd48c2b0 | 2010-04-09 20:32:42 | [diff] [blame] | 212 | |
[email protected] | d6f37fc | 2011-02-13 23:58:41 | [diff] [blame] | 213 | virtual ChromeNetLog* net_log() = 0; |
| 214 | |
[email protected] | 1459fb6 | 2011-05-25 19:03:27 | [diff] [blame] | 215 | virtual prerender::PrerenderTracker* prerender_tracker() = 0; |
| 216 | |
[email protected] | c1adf5a | 2011-08-03 22:11:37 | [diff] [blame] | 217 | virtual ComponentUpdateService* component_updater() = 0; |
| 218 | |
[email protected] | ca167a3 | 2011-09-30 15:19:11 | [diff] [blame] | 219 | virtual CRLSetFetcher* crl_set_fetcher() = 0; |
| 220 | |
[email protected] | 195c99c | 2012-10-31 06:24:51 | [diff] [blame] | 221 | virtual BookmarkPromptController* bookmark_prompt_controller() = 0; |
| 222 | |
[email protected] | 42aec8df | 2012-12-12 06:03:57 | [diff] [blame] | 223 | virtual chrome::MediaFileSystemRegistry* media_file_system_registry() = 0; |
| 224 | |
[email protected] | e9613b5 | 2012-11-27 22:35:13 | [diff] [blame] | 225 | virtual void PlatformSpecificCommandLineProcessing( |
| 226 | const CommandLine& command_line) = 0; |
| 227 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 228 | private: |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 229 | DISALLOW_COPY_AND_ASSIGN(BrowserProcess); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | extern BrowserProcess* g_browser_process; |
| 233 | |
[email protected] | bfd04a6 | 2009-02-01 18:16:56 | [diff] [blame] | 234 | #endif // CHROME_BROWSER_BROWSER_PROCESS_H_ |