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 14 matching lines...) Expand all Loading... |
66 virtual printing::PrintPreviewTabController* print_preview_tab_controller(); | 72 virtual printing::PrintPreviewTabController* print_preview_tab_controller(); |
67 virtual GoogleURLTracker* google_url_tracker(); | 73 virtual GoogleURLTracker* google_url_tracker(); |
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 void CheckForInspectorFiles(); | 80 virtual void CheckForInspectorFiles(); |
75 | 81 |
| 82 // NotificationObserver methods |
| 83 virtual void Observe(NotificationType type, |
| 84 const NotificationSource& source, |
| 85 const NotificationDetails& details); |
| 86 |
76 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 87 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
77 void StartAutoupdateTimer(); | 88 void StartAutoupdateTimer(); |
78 #endif | 89 #endif |
79 | 90 |
80 virtual bool have_inspector_files() const; | 91 virtual bool have_inspector_files() const; |
81 | 92 |
82 #if defined(IPC_MESSAGE_LOG_ENABLED) | 93 #if defined(IPC_MESSAGE_LOG_ENABLED) |
83 virtual void SetIPCLoggingEnabled(bool enable); | 94 virtual void SetIPCLoggingEnabled(bool enable); |
84 #endif | 95 #endif |
85 | 96 |
86 private: | 97 private: |
87 void ClearLocalState(const FilePath& profile_path); | 98 void ClearLocalState(const FilePath& profile_path); |
88 bool ShouldClearLocalState(FilePath* profile_path); | 99 bool ShouldClearLocalState(FilePath* profile_path); |
89 | 100 |
90 void CreateResourceDispatcherHost(); | 101 void CreateResourceDispatcherHost(); |
91 void CreatePrefService(); | 102 void CreatePrefService(); |
92 void CreateMetricsService(); | 103 void CreateMetricsService(); |
93 | 104 |
94 void CreateIOThread(); | 105 void CreateIOThread(); |
95 static void CleanupOnIOThread(); | 106 static void CleanupOnIOThread(); |
96 | 107 |
| 108 void WaitForPluginDataRemoverToFinish(); |
| 109 |
97 void CreateFileThread(); | 110 void CreateFileThread(); |
98 void CreateDBThread(); | 111 void CreateDBThread(); |
99 void CreateProcessLauncherThread(); | 112 void CreateProcessLauncherThread(); |
100 void CreateCacheThread(); | 113 void CreateCacheThread(); |
101 void CreateTemplateURLModel(); | 114 void CreateTemplateURLModel(); |
102 void CreateProfileManager(); | 115 void CreateProfileManager(); |
103 void CreateWebDataService(); | 116 void CreateWebDataService(); |
104 void CreateLocalState(); | 117 void CreateLocalState(); |
105 void CreateViewedPageTracker(); | 118 void CreateViewedPageTracker(); |
106 void CreateIconManager(); | 119 void CreateIconManager(); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Our best estimate about the existence of the inspector directory. | 221 // Our best estimate about the existence of the inspector directory. |
209 bool have_inspector_files_; | 222 bool have_inspector_files_; |
210 | 223 |
211 // Ensures that the observers of plugin/print disable/enable state | 224 // Ensures that the observers of plugin/print disable/enable state |
212 // notifications are properly added and removed. | 225 // notifications are properly added and removed. |
213 PrefChangeRegistrar pref_change_registrar_; | 226 PrefChangeRegistrar pref_change_registrar_; |
214 | 227 |
215 // Lives here so can safely log events on shutdown. | 228 // Lives here so can safely log events on shutdown. |
216 scoped_ptr<ChromeNetLog> net_log_; | 229 scoped_ptr<ChromeNetLog> net_log_; |
217 | 230 |
| 231 NotificationRegistrar notification_registrar_; |
| 232 scoped_ptr<PluginDataRemover> plugin_data_remover_; |
| 233 |
218 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 234 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
219 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; | 235 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; |
220 | 236 |
221 // Gets called by autoupdate timer to see if browser needs restart and can be | 237 // Gets called by autoupdate timer to see if browser needs restart and can be |
222 // restarted, and if that's the case, restarts the browser. | 238 // restarted, and if that's the case, restarts the browser. |
223 void OnAutoupdateTimer(); | 239 void OnAutoupdateTimer(); |
224 bool CanAutorestartForUpdate() const; | 240 bool CanAutorestartForUpdate() const; |
225 void RestartPersistentInstance(); | 241 void RestartPersistentInstance(); |
226 #endif // defined(OS_WIN) || defined(OS_LINUX) | 242 #endif // defined(OS_WIN) || defined(OS_LINUX) |
227 | 243 |
228 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); | 244 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); |
229 }; | 245 }; |
230 | 246 |
231 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 247 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
OLD | NEW |