OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // This class gathers state related to a single user profile. | 5 // This class gathers state related to a single user profile. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "chrome/browser/prefs/pref_change_registrar.h" | 18 #include "chrome/browser/prefs/pref_change_registrar.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_impl_io_data.h" | 20 #include "chrome/browser/profiles/profile_impl_io_data.h" |
21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
23 | 23 |
24 class ExtensionNavigationObserver; | 24 class ExtensionNavigationObserver; |
25 class ExtensionPrefs; | 25 class ExtensionSystem; |
26 class ExtensionPrefValueMap; | |
27 class NetPrefObserver; | 26 class NetPrefObserver; |
28 class PrefService; | 27 class PrefService; |
29 class PromoResourceService; | 28 class PromoResourceService; |
30 class SSLConfigServiceManager; | 29 class SSLConfigServiceManager; |
31 class VisitedLinkEventListener; | 30 class VisitedLinkEventListener; |
32 | 31 |
33 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
34 namespace chromeos { | 33 namespace chromeos { |
35 class EnterpriseExtensionObserver; | 34 class EnterpriseExtensionObserver; |
36 class LocaleChangeGuard; | 35 class LocaleChangeGuard; |
(...skipping 30 matching lines...) Expand all Loading... |
67 // Profile implementation: | 66 // Profile implementation: |
68 virtual std::string GetProfileName() OVERRIDE; | 67 virtual std::string GetProfileName() OVERRIDE; |
69 virtual bool IsOffTheRecord() const OVERRIDE; | 68 virtual bool IsOffTheRecord() const OVERRIDE; |
70 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 69 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
71 virtual void DestroyOffTheRecordProfile() OVERRIDE; | 70 virtual void DestroyOffTheRecordProfile() OVERRIDE; |
72 virtual bool HasOffTheRecordProfile() OVERRIDE; | 71 virtual bool HasOffTheRecordProfile() OVERRIDE; |
73 virtual Profile* GetOriginalProfile() OVERRIDE; | 72 virtual Profile* GetOriginalProfile() OVERRIDE; |
74 virtual history::TopSites* GetTopSites() OVERRIDE; | 73 virtual history::TopSites* GetTopSites() OVERRIDE; |
75 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 74 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
76 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; | 75 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; |
| 76 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() OVERRIDE; |
| 77 virtual ExtensionService* GetExtensionService() OVERRIDE; |
77 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; | 78 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; |
78 virtual ExtensionService* GetExtensionService() OVERRIDE; | |
79 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE; | |
80 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; | 79 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; |
81 virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE; | |
82 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 80 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
83 virtual ExtensionSpecialStoragePolicy* | 81 virtual ExtensionSpecialStoragePolicy* |
84 GetExtensionSpecialStoragePolicy() OVERRIDE; | 82 GetExtensionSpecialStoragePolicy() OVERRIDE; |
85 virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; | 83 virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; |
86 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; | 84 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; |
87 virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; | 85 virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; |
88 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 86 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
89 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 87 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
90 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 88 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
91 virtual WebDataService* GetWebDataService(ServiceAccessType sat) OVERRIDE; | 89 virtual WebDataService* GetWebDataService(ServiceAccessType sat) OVERRIDE; |
92 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; | 90 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; |
93 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) OVERRIDE; | 91 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) OVERRIDE; |
94 virtual PrefService* GetPrefs() OVERRIDE; | 92 virtual PrefService* GetPrefs() OVERRIDE; |
95 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; | 93 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; |
96 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; | 94 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; |
97 virtual net::URLRequestContextGetter* | 95 virtual net::URLRequestContextGetter* |
98 GetRequestContextForExtensions() OVERRIDE; | 96 GetRequestContextForExtensions() OVERRIDE; |
99 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( | 97 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( |
100 const std::string& app_id) OVERRIDE; | 98 const std::string& app_id) OVERRIDE; |
101 virtual void RegisterExtensionWithRequestContexts( | |
102 const Extension* extension) OVERRIDE; | |
103 virtual void UnregisterExtensionWithRequestContexts( | |
104 const std::string& extension_id, | |
105 const extension_misc::UnloadedExtensionReason reason) OVERRIDE; | |
106 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; | 99 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; |
107 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; | 100 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; |
108 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE; | 101 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE; |
109 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; | 102 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; |
110 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; | 103 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; |
111 virtual bool IsSameProfile(Profile* profile) OVERRIDE; | 104 virtual bool IsSameProfile(Profile* profile) OVERRIDE; |
112 virtual base::Time GetStartTime() const OVERRIDE; | 105 virtual base::Time GetStartTime() const OVERRIDE; |
113 virtual void MarkAsCleanShutdown() OVERRIDE; | 106 virtual void MarkAsCleanShutdown() OVERRIDE; |
114 virtual void InitExtensions(bool extensions_enabled) OVERRIDE; | |
115 virtual void InitPromoResources() OVERRIDE; | 107 virtual void InitPromoResources() OVERRIDE; |
116 virtual void InitRegisteredProtocolHandlers() OVERRIDE; | 108 virtual void InitRegisteredProtocolHandlers() OVERRIDE; |
117 virtual FilePath last_selected_directory() OVERRIDE; | 109 virtual FilePath last_selected_directory() OVERRIDE; |
118 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; | 110 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; |
119 virtual TokenService* GetTokenService() OVERRIDE; | 111 virtual TokenService* GetTokenService() OVERRIDE; |
120 virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; | |
121 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; | 112 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |
122 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; | 113 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; |
123 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; | 114 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; |
124 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; | 115 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; |
125 virtual GURL GetHomePage() OVERRIDE; | 116 virtual GURL GetHomePage() OVERRIDE; |
126 | 117 |
127 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
128 virtual void ChangeAppLocale(const std::string& locale, | 119 virtual void ChangeAppLocale(const std::string& locale, |
129 AppLocaleChangedVia) OVERRIDE; | 120 AppLocaleChangedVia) OVERRIDE; |
130 virtual void OnLogin() OVERRIDE; | 121 virtual void OnLogin() OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 void CreatePasswordStore(); | 155 void CreatePasswordStore(); |
165 | 156 |
166 void StopCreateSessionServiceTimer(); | 157 void StopCreateSessionServiceTimer(); |
167 | 158 |
168 void EnsureRequestContextCreated() { | 159 void EnsureRequestContextCreated() { |
169 GetRequestContext(); | 160 GetRequestContext(); |
170 } | 161 } |
171 | 162 |
172 void EnsureSessionServiceCreated(); | 163 void EnsureSessionServiceCreated(); |
173 | 164 |
174 ExtensionPrefValueMap* GetExtensionPrefValueMap(); | |
175 | |
176 void UpdateProfileUserNameCache(); | 165 void UpdateProfileUserNameCache(); |
177 | 166 |
178 | 167 |
179 // Updates the ProfileInfoCache with data from this profile. | 168 // Updates the ProfileInfoCache with data from this profile. |
180 void UpdateProfileNameCache(); | 169 void UpdateProfileNameCache(); |
181 void UpdateProfileAvatarCache(); | 170 void UpdateProfileAvatarCache(); |
182 | 171 |
183 void GetCacheParameters(bool is_media_context, | 172 void GetCacheParameters(bool is_media_context, |
184 FilePath* cache_path, | 173 FilePath* cache_path, |
185 int* max_size); | 174 int* max_size); |
(...skipping 12 matching lines...) Expand all Loading... |
198 | 187 |
199 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 188 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
200 // Keep |prefs_| on top for destruction order because |extension_prefs_|, | 189 // Keep |prefs_| on top for destruction order because |extension_prefs_|, |
201 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store | 190 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store |
202 // pointers to |prefs_| and shall be destructed first. | 191 // pointers to |prefs_| and shall be destructed first. |
203 scoped_ptr<PrefService> prefs_; | 192 scoped_ptr<PrefService> prefs_; |
204 scoped_ptr<PrefService> otr_prefs_; | 193 scoped_ptr<PrefService> otr_prefs_; |
205 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; | 194 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; |
206 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 195 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
207 ProfileImplIOData::Handle io_data_; | 196 ProfileImplIOData::Handle io_data_; |
208 // Keep extension_prefs_ on top of extension_service_ because the latter | |
209 // maintains a pointer to the first and shall be destructed first. | |
210 scoped_ptr<ExtensionPrefs> extension_prefs_; | |
211 scoped_ptr<ExtensionService> extension_service_; | |
212 scoped_refptr<UserScriptMaster> user_script_master_; | |
213 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | |
214 // extension_info_map_ needs to outlive extension_process_manager_. | |
215 scoped_refptr<ExtensionInfoMap> extension_info_map_; | |
216 // |extension_process_manager_| must be destroyed before |io_data_|. | |
217 // While |extension_process_manager_| still lives, we handle incoming | |
218 // resource requests from extension processes and those require access | |
219 // to the ResourceContext owned by |io_data_|. | |
220 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | |
221 scoped_refptr<ExtensionMessageService> extension_message_service_; | |
222 scoped_ptr<ExtensionEventRouter> extension_event_router_; | |
223 scoped_ptr<ExtensionNavigationObserver> extension_navigation_observer_; | |
224 scoped_refptr<ExtensionSpecialStoragePolicy> | 197 scoped_refptr<ExtensionSpecialStoragePolicy> |
225 extension_special_storage_policy_; | 198 extension_special_storage_policy_; |
226 scoped_ptr<NetPrefObserver> net_pref_observer_; | 199 scoped_ptr<NetPrefObserver> net_pref_observer_; |
227 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; | 200 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
228 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 201 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
229 scoped_refptr<PromoResourceService> promo_resource_service_; | 202 scoped_refptr<PromoResourceService> promo_resource_service_; |
230 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 203 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
231 | 204 |
232 scoped_ptr<TokenService> token_service_; | 205 scoped_ptr<TokenService> token_service_; |
233 | 206 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 Profile::Delegate* delegate_; | 270 Profile::Delegate* delegate_; |
298 | 271 |
299 chrome_browser_net::Predictor* predictor_; | 272 chrome_browser_net::Predictor* predictor_; |
300 | 273 |
301 bool session_restore_enabled_; | 274 bool session_restore_enabled_; |
302 | 275 |
303 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 276 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
304 }; | 277 }; |
305 | 278 |
306 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 279 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
OLD | NEW |