OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // When each service is created, we set a flag indicating this. At this point, | 5 // When each service is created, we set a flag indicating this. At this point, |
6 // the service initialization could fail or succeed. This allows us to remember | 6 // the service initialization could fail or succeed. This allows us to remember |
7 // if we tried to create a service, and not try creating it over and over if | 7 // if we tried to create a service, and not try creating it over and over if |
8 // the creation failed. | 8 // the creation failed. |
9 | 9 |
10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
11 #define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 11 #define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
12 #pragma once | 12 #pragma once |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/non_thread_safe.h" | 18 #include "base/non_thread_safe.h" |
19 #include "base/timer.h" | 19 #include "base/timer.h" |
20 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/download/download_status_updater.h" | 22 #include "chrome/browser/download/download_status_updater.h" |
23 #include "chrome/browser/prefs/pref_change_registrar.h" | 23 #include "chrome/browser/prefs/pref_change_registrar.h" |
24 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 24 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
| 25 #include "chrome/common/notification_observer.h" |
| 26 #include "chrome/common/notification_registrar.h" |
25 #include "ipc/ipc_message.h" | 27 #include "ipc/ipc_message.h" |
26 | 28 |
27 class ChromeNetLog; | 29 class ChromeNetLog; |
28 class CommandLine; | 30 class CommandLine; |
29 class DebuggerWrapper; | 31 class DebuggerWrapper; |
30 class FilePath; | 32 class FilePath; |
31 class NotificationService; | 33 class NotificationService; |
| 34 class PluginDataRemover; |
32 class TabCloseableStateWatcher; | 35 class TabCloseableStateWatcher; |
33 | 36 |
34 // Real implementation of BrowserProcess that creates and returns the services. | 37 // Real implementation of BrowserProcess that creates and returns the services. |
35 class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe { | 38 class BrowserProcessImpl : public BrowserProcess, |
| 39 public NonThreadSafe, |
| 40 public NotificationObserver { |
36 public: | 41 public: |
37 explicit BrowserProcessImpl(const CommandLine& command_line); | 42 explicit BrowserProcessImpl(const CommandLine& command_line); |
38 virtual ~BrowserProcessImpl(); | 43 virtual ~BrowserProcessImpl(); |
39 | 44 |
40 virtual void EndSession(); | 45 virtual void EndSession(); |
41 | 46 |
| 47 // BrowserProcess methods |
42 virtual ResourceDispatcherHost* resource_dispatcher_host(); | 48 virtual ResourceDispatcherHost* resource_dispatcher_host(); |
43 virtual MetricsService* metrics_service(); | 49 virtual MetricsService* metrics_service(); |
44 virtual IOThread* io_thread(); | 50 virtual IOThread* io_thread(); |
45 virtual base::Thread* file_thread(); | 51 virtual base::Thread* file_thread(); |
46 virtual base::Thread* db_thread(); | 52 virtual base::Thread* db_thread(); |
47 virtual base::Thread* process_launcher_thread(); | 53 virtual base::Thread* process_launcher_thread(); |
48 virtual base::Thread* cache_thread(); | 54 virtual base::Thread* cache_thread(); |
49 #if defined(USE_X11) | 55 #if defined(USE_X11) |
50 virtual base::Thread* background_x11_thread(); | 56 virtual base::Thread* background_x11_thread(); |
51 #endif | 57 #endif |
(...skipping 16 matching lines...) Expand all Loading... |
68 virtual IntranetRedirectDetector* intranet_redirect_detector(); | 74 virtual IntranetRedirectDetector* intranet_redirect_detector(); |
69 virtual const std::string& GetApplicationLocale(); | 75 virtual const std::string& GetApplicationLocale(); |
70 virtual void SetApplicationLocale(const std::string& locale); | 76 virtual void SetApplicationLocale(const std::string& locale); |
71 virtual DownloadStatusUpdater* download_status_updater(); | 77 virtual DownloadStatusUpdater* download_status_updater(); |
72 virtual base::WaitableEvent* shutdown_event(); | 78 virtual base::WaitableEvent* shutdown_event(); |
73 virtual TabCloseableStateWatcher* tab_closeable_state_watcher(); | 79 virtual TabCloseableStateWatcher* tab_closeable_state_watcher(); |
74 virtual safe_browsing::ClientSideDetectionService* | 80 virtual safe_browsing::ClientSideDetectionService* |
75 safe_browsing_detection_service(); | 81 safe_browsing_detection_service(); |
76 virtual void CheckForInspectorFiles(); | 82 virtual void CheckForInspectorFiles(); |
77 | 83 |
| 84 // NotificationObserver methods |
| 85 virtual void Observe(NotificationType type, |
| 86 const NotificationSource& source, |
| 87 const NotificationDetails& details); |
| 88 |
78 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 89 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
79 virtual void StartAutoupdateTimer(); | 90 virtual void StartAutoupdateTimer(); |
80 #endif | 91 #endif |
81 | 92 |
82 virtual bool have_inspector_files() const; | 93 virtual bool have_inspector_files() const; |
83 | 94 |
84 #if defined(IPC_MESSAGE_LOG_ENABLED) | 95 #if defined(IPC_MESSAGE_LOG_ENABLED) |
85 virtual void SetIPCLoggingEnabled(bool enable); | 96 virtual void SetIPCLoggingEnabled(bool enable); |
86 #endif | 97 #endif |
87 | 98 |
88 private: | 99 private: |
89 void ClearLocalState(const FilePath& profile_path); | 100 void ClearLocalState(const FilePath& profile_path); |
90 bool ShouldClearLocalState(FilePath* profile_path); | 101 bool ShouldClearLocalState(FilePath* profile_path); |
91 | 102 |
92 void CreateResourceDispatcherHost(); | 103 void CreateResourceDispatcherHost(); |
93 void CreatePrefService(); | 104 void CreatePrefService(); |
94 void CreateMetricsService(); | 105 void CreateMetricsService(); |
95 | 106 |
96 void CreateIOThread(); | 107 void CreateIOThread(); |
97 static void CleanupOnIOThread(); | 108 static void CleanupOnIOThread(); |
98 | 109 |
| 110 void WaitForPluginDataRemoverToFinish(); |
| 111 |
99 void CreateFileThread(); | 112 void CreateFileThread(); |
100 void CreateDBThread(); | 113 void CreateDBThread(); |
101 void CreateProcessLauncherThread(); | 114 void CreateProcessLauncherThread(); |
102 void CreateCacheThread(); | 115 void CreateCacheThread(); |
103 void CreateTemplateURLModel(); | 116 void CreateTemplateURLModel(); |
104 void CreateProfileManager(); | 117 void CreateProfileManager(); |
105 void CreateWebDataService(); | 118 void CreateWebDataService(); |
106 void CreateLocalState(); | 119 void CreateLocalState(); |
107 void CreateViewedPageTracker(); | 120 void CreateViewedPageTracker(); |
108 void CreateIconManager(); | 121 void CreateIconManager(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // Our best estimate about the existence of the inspector directory. | 230 // Our best estimate about the existence of the inspector directory. |
218 bool have_inspector_files_; | 231 bool have_inspector_files_; |
219 | 232 |
220 // Ensures that the observers of plugin/print disable/enable state | 233 // Ensures that the observers of plugin/print disable/enable state |
221 // notifications are properly added and removed. | 234 // notifications are properly added and removed. |
222 PrefChangeRegistrar pref_change_registrar_; | 235 PrefChangeRegistrar pref_change_registrar_; |
223 | 236 |
224 // Lives here so can safely log events on shutdown. | 237 // Lives here so can safely log events on shutdown. |
225 scoped_ptr<ChromeNetLog> net_log_; | 238 scoped_ptr<ChromeNetLog> net_log_; |
226 | 239 |
| 240 NotificationRegistrar notification_registrar_; |
| 241 scoped_refptr<PluginDataRemover> plugin_data_remover_; |
| 242 |
227 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 243 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
228 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; | 244 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; |
229 | 245 |
230 // Gets called by autoupdate timer to see if browser needs restart and can be | 246 // Gets called by autoupdate timer to see if browser needs restart and can be |
231 // restarted, and if that's the case, restarts the browser. | 247 // restarted, and if that's the case, restarts the browser. |
232 void OnAutoupdateTimer(); | 248 void OnAutoupdateTimer(); |
233 bool CanAutorestartForUpdate() const; | 249 bool CanAutorestartForUpdate() const; |
234 void RestartPersistentInstance(); | 250 void RestartPersistentInstance(); |
235 #endif // defined(OS_WIN) || defined(OS_LINUX) | 251 #endif // defined(OS_WIN) || defined(OS_LINUX) |
236 | 252 |
237 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); | 253 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); |
238 }; | 254 }; |
239 | 255 |
240 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 256 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
OLD | NEW |