Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / browser_process.h
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.
4
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.
9
10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_H_
11 #define CHROME_BROWSER_BROWSER_PROCESS_H_
12
13 #include <string>
14
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"
19
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 WatchDogThread;
42 #if defined(ENABLE_WEBRTC)
43 class WebRtcLogUploader;
44 #endif
45
46 namespace chrome_variations {
47 class VariationsService;
48 }
49
50 namespace component_updater {
51 class ComponentUpdateService;
52 class PnaclComponentInstaller;
53 }
54
55 namespace extensions {
56 class EventRouterForwarder;
57 }
58
59 namespace message_center {
60 class MessageCenter;
61 }
62
63 namespace net {
64 class URLRequestContextGetter;
65 }
66
67 namespace policy {
68 class BrowserPolicyConnector;
69 class PolicyService;
70 }
71
72 namespace prerender {
73 class PrerenderTracker;
74 }
75
76 namespace printing {
77 class BackgroundPrintingManager;
78 class PrintJobManager;
79 class PrintPreviewDialogController;
80 }
81
82 namespace safe_browsing {
83 class ClientSideDetectionService;
84 }
85
86 // NOT THREAD SAFE, call only from the main thread.
87 // These functions shouldn't return NULL unless otherwise noted.
88 class BrowserProcess {
89  public:
90   BrowserProcess();
91   virtual ~BrowserProcess();
92
93   // Called when the ResourceDispatcherHost object is created by content.
94   virtual void ResourceDispatcherHostCreated() = 0;
95
96   // Invoked when the user is logging out/shutting down. When logging off we may
97   // not have enough time to do a normal shutdown. This method is invoked prior
98   // to normal shutdown and saves any state that must be saved before we are
99   // continue shutdown.
100   virtual void EndSession() = 0;
101
102   // Services: any of these getters may return NULL
103   virtual MetricsService* metrics_service() = 0;
104   virtual ProfileManager* profile_manager() = 0;
105   virtual PrefService* local_state() = 0;
106   virtual net::URLRequestContextGetter* system_request_context() = 0;
107   virtual chrome_variations::VariationsService* variations_service() = 0;
108
109   virtual BrowserProcessPlatformPart* platform_part() = 0;
110
111   virtual extensions::EventRouterForwarder*
112       extension_event_router_forwarder() = 0;
113
114   // Returns the manager for desktop notifications.
115   virtual NotificationUIManager* notification_ui_manager() = 0;
116
117   // MessageCenter is a global list of currently displayed notifications.
118   virtual message_center::MessageCenter* message_center() = 0;
119
120   // Returns the state object for the thread that we perform I/O
121   // coordination on (network requests, communication with renderers,
122   // etc.
123   //
124   // Can be NULL close to startup and shutdown.
125   //
126   // NOTE: If you want to post a task to the IO thread, use
127   // BrowserThread::PostTask (or other variants).
128   virtual IOThread* io_thread() = 0;
129
130   // Returns the thread that is used for health check of all browser threads.
131   virtual WatchDogThread* watchdog_thread() = 0;
132
133   // Starts and manages the policy system.
134   virtual policy::BrowserPolicyConnector* browser_policy_connector() = 0;
135
136   // This is the main interface for chromium components to retrieve policy
137   // information from the policy system.
138   virtual policy::PolicyService* policy_service() = 0;
139
140   virtual IconManager* icon_manager() = 0;
141
142   virtual GLStringManager* gl_string_manager() = 0;
143
144   virtual GpuModeManager* gpu_mode_manager() = 0;
145
146   virtual AutomationProviderList* GetAutomationProviderList() = 0;
147
148   virtual void CreateDevToolsHttpProtocolHandler(
149       chrome::HostDesktopType host_desktop_type,
150       const std::string& ip,
151       int port,
152       const std::string& frontend_url) = 0;
153
154   virtual unsigned int AddRefModule() = 0;
155   virtual unsigned int ReleaseModule() = 0;
156
157   virtual bool IsShuttingDown() = 0;
158
159   virtual printing::PrintJobManager* print_job_manager() = 0;
160   virtual printing::PrintPreviewDialogController*
161       print_preview_dialog_controller() = 0;
162   virtual printing::BackgroundPrintingManager*
163       background_printing_manager() = 0;
164
165   virtual IntranetRedirectDetector* intranet_redirect_detector() = 0;
166
167   // Returns the locale used by the application.
168   virtual const std::string& GetApplicationLocale() = 0;
169   virtual void SetApplicationLocale(const std::string& locale) = 0;
170
171   virtual DownloadStatusUpdater* download_status_updater() = 0;
172   virtual DownloadRequestLimiter* download_request_limiter() = 0;
173
174   // Returns the object that manages background applications.
175   virtual BackgroundModeManager* background_mode_manager() = 0;
176   virtual void set_background_mode_manager_for_test(
177       scoped_ptr<BackgroundModeManager> manager) = 0;
178
179   // Returns the StatusTray, which provides an API for displaying status icons
180   // in the system status tray. Returns NULL if status icons are not supported
181   // on this platform (or this is a unit test).
182   virtual StatusTray* status_tray() = 0;
183
184   // Returns the SafeBrowsing service.
185   virtual SafeBrowsingService* safe_browsing_service() = 0;
186
187   // Returns an object which handles communication with the SafeBrowsing
188   // client-side detection servers.
189   virtual safe_browsing::ClientSideDetectionService*
190       safe_browsing_detection_service() = 0;
191
192 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
193   // This will start a timer that, if Chrome is in persistent mode, will check
194   // whether an update is available, and if that's the case, restart the
195   // browser. Note that restart code will strip some of the command line keys
196   // and all loose values from the cl this instance of Chrome was launched with,
197   // and add the command line key that will force Chrome to start in the
198   // background mode. For the full list of "blacklisted" keys, refer to
199   // |kSwitchesToRemoveOnAutorestart| array in browser_process_impl.cc.
200   virtual void StartAutoupdateTimer() = 0;
201 #endif
202
203   virtual ChromeNetLog* net_log() = 0;
204
205   virtual prerender::PrerenderTracker* prerender_tracker() = 0;
206
207   virtual component_updater::ComponentUpdateService* component_updater() = 0;
208
209   virtual CRLSetFetcher* crl_set_fetcher() = 0;
210
211   virtual component_updater::PnaclComponentInstaller*
212       pnacl_component_installer() = 0;
213
214   virtual BookmarkPromptController* bookmark_prompt_controller() = 0;
215
216   virtual MediaFileSystemRegistry* media_file_system_registry() = 0;
217
218   virtual bool created_local_state() const = 0;
219
220 #if defined(ENABLE_WEBRTC)
221   virtual WebRtcLogUploader* webrtc_log_uploader() = 0;
222 #endif
223
224  private:
225   DISALLOW_COPY_AND_ASSIGN(BrowserProcess);
226 };
227
228 extern BrowserProcess* g_browser_process;
229
230 #endif  // CHROME_BROWSER_BROWSER_PROCESS_H_