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 ExtensionSystem; | 25 class ExtensionPrefs; |
| 26 class ExtensionPrefValueMap; |
26 class NetPrefObserver; | 27 class NetPrefObserver; |
27 class PrefService; | 28 class PrefService; |
28 class PromoResourceService; | 29 class PromoResourceService; |
29 class SSLConfigServiceManager; | 30 class SSLConfigServiceManager; |
30 class VisitedLinkEventListener; | 31 class VisitedLinkEventListener; |
31 | 32 |
32 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
33 namespace chromeos { | 34 namespace chromeos { |
34 class EnterpriseExtensionObserver; | 35 class EnterpriseExtensionObserver; |
35 class LocaleChangeGuard; | 36 class LocaleChangeGuard; |
(...skipping 30 matching lines...) Expand all Loading... |
66 // Profile implementation: | 67 // Profile implementation: |
67 virtual std::string GetProfileName() OVERRIDE; | 68 virtual std::string GetProfileName() OVERRIDE; |
68 virtual bool IsOffTheRecord() const OVERRIDE; | 69 virtual bool IsOffTheRecord() const OVERRIDE; |
69 virtual Profile* GetOffTheRecordProfile() OVERRIDE; | 70 virtual Profile* GetOffTheRecordProfile() OVERRIDE; |
70 virtual void DestroyOffTheRecordProfile() OVERRIDE; | 71 virtual void DestroyOffTheRecordProfile() OVERRIDE; |
71 virtual bool HasOffTheRecordProfile() OVERRIDE; | 72 virtual bool HasOffTheRecordProfile() OVERRIDE; |
72 virtual Profile* GetOriginalProfile() OVERRIDE; | 73 virtual Profile* GetOriginalProfile() OVERRIDE; |
73 virtual history::TopSites* GetTopSites() OVERRIDE; | 74 virtual history::TopSites* GetTopSites() OVERRIDE; |
74 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; | 75 virtual history::TopSites* GetTopSitesWithoutCreating() OVERRIDE; |
75 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; | 76 virtual VisitedLinkMaster* GetVisitedLinkMaster() OVERRIDE; |
76 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() OVERRIDE; | 77 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; |
77 virtual ExtensionService* GetExtensionService() OVERRIDE; | 78 virtual ExtensionService* GetExtensionService() OVERRIDE; |
78 virtual UserScriptMaster* GetUserScriptMaster() OVERRIDE; | 79 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() OVERRIDE; |
79 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; | 80 virtual ExtensionProcessManager* GetExtensionProcessManager() OVERRIDE; |
| 81 virtual ExtensionMessageService* GetExtensionMessageService() OVERRIDE; |
80 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; | 82 virtual ExtensionEventRouter* GetExtensionEventRouter() OVERRIDE; |
81 virtual ExtensionSpecialStoragePolicy* | 83 virtual ExtensionSpecialStoragePolicy* |
82 GetExtensionSpecialStoragePolicy() OVERRIDE; | 84 GetExtensionSpecialStoragePolicy() OVERRIDE; |
83 virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; | 85 virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; |
84 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; | 86 virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; |
85 virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; | 87 virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; |
86 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; | 88 virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; |
87 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; | 89 virtual AutocompleteClassifier* GetAutocompleteClassifier() OVERRIDE; |
88 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; | 90 virtual history::ShortcutsBackend* GetShortcutsBackend() OVERRIDE; |
89 virtual WebDataService* GetWebDataService(ServiceAccessType sat) OVERRIDE; | 91 virtual WebDataService* GetWebDataService(ServiceAccessType sat) OVERRIDE; |
90 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; | 92 virtual WebDataService* GetWebDataServiceWithoutCreating() OVERRIDE; |
91 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) OVERRIDE; | 93 virtual PasswordStore* GetPasswordStore(ServiceAccessType sat) OVERRIDE; |
92 virtual PrefService* GetPrefs() OVERRIDE; | 94 virtual PrefService* GetPrefs() OVERRIDE; |
93 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; | 95 virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; |
94 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; | 96 virtual TemplateURLFetcher* GetTemplateURLFetcher() OVERRIDE; |
95 virtual net::URLRequestContextGetter* | 97 virtual net::URLRequestContextGetter* |
96 GetRequestContextForExtensions() OVERRIDE; | 98 GetRequestContextForExtensions() OVERRIDE; |
97 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( | 99 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( |
98 const std::string& app_id) OVERRIDE; | 100 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; |
99 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; | 106 virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; |
100 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; | 107 virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; |
101 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE; | 108 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() OVERRIDE; |
102 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; | 109 virtual BookmarkModel* GetBookmarkModel() OVERRIDE; |
103 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; | 110 virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; |
104 virtual bool IsSameProfile(Profile* profile) OVERRIDE; | 111 virtual bool IsSameProfile(Profile* profile) OVERRIDE; |
105 virtual base::Time GetStartTime() const OVERRIDE; | 112 virtual base::Time GetStartTime() const OVERRIDE; |
106 virtual void MarkAsCleanShutdown() OVERRIDE; | 113 virtual void MarkAsCleanShutdown() OVERRIDE; |
| 114 virtual void InitExtensions(bool extensions_enabled) OVERRIDE; |
107 virtual void InitPromoResources() OVERRIDE; | 115 virtual void InitPromoResources() OVERRIDE; |
108 virtual void InitRegisteredProtocolHandlers() OVERRIDE; | 116 virtual void InitRegisteredProtocolHandlers() OVERRIDE; |
109 virtual FilePath last_selected_directory() OVERRIDE; | 117 virtual FilePath last_selected_directory() OVERRIDE; |
110 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; | 118 virtual void set_last_selected_directory(const FilePath& path) OVERRIDE; |
111 virtual TokenService* GetTokenService() OVERRIDE; | 119 virtual TokenService* GetTokenService() OVERRIDE; |
| 120 virtual ExtensionInfoMap* GetExtensionInfoMap() OVERRIDE; |
112 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; | 121 virtual PromoCounter* GetInstantPromoCounter() OVERRIDE; |
113 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; | 122 virtual ChromeURLDataManager* GetChromeURLDataManager() OVERRIDE; |
114 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; | 123 virtual chrome_browser_net::Predictor* GetNetworkPredictor() OVERRIDE; |
115 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; | 124 virtual void ClearNetworkingHistorySince(base::Time time) OVERRIDE; |
116 virtual GURL GetHomePage() OVERRIDE; | 125 virtual GURL GetHomePage() OVERRIDE; |
117 | 126 |
118 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
119 virtual void ChangeAppLocale(const std::string& locale, | 128 virtual void ChangeAppLocale(const std::string& locale, |
120 AppLocaleChangedVia) OVERRIDE; | 129 AppLocaleChangedVia) OVERRIDE; |
121 virtual void OnLogin() OVERRIDE; | 130 virtual void OnLogin() OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void CreatePasswordStore(); | 164 void CreatePasswordStore(); |
156 | 165 |
157 void StopCreateSessionServiceTimer(); | 166 void StopCreateSessionServiceTimer(); |
158 | 167 |
159 void EnsureRequestContextCreated() { | 168 void EnsureRequestContextCreated() { |
160 GetRequestContext(); | 169 GetRequestContext(); |
161 } | 170 } |
162 | 171 |
163 void EnsureSessionServiceCreated(); | 172 void EnsureSessionServiceCreated(); |
164 | 173 |
| 174 ExtensionPrefValueMap* GetExtensionPrefValueMap(); |
| 175 |
165 void UpdateProfileUserNameCache(); | 176 void UpdateProfileUserNameCache(); |
166 | 177 |
167 | 178 |
168 // Updates the ProfileInfoCache with data from this profile. | 179 // Updates the ProfileInfoCache with data from this profile. |
169 void UpdateProfileNameCache(); | 180 void UpdateProfileNameCache(); |
170 void UpdateProfileAvatarCache(); | 181 void UpdateProfileAvatarCache(); |
171 | 182 |
172 void GetCacheParameters(bool is_media_context, | 183 void GetCacheParameters(bool is_media_context, |
173 FilePath* cache_path, | 184 FilePath* cache_path, |
174 int* max_size); | 185 int* max_size); |
(...skipping 12 matching lines...) Expand all Loading... |
187 | 198 |
188 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 199 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
189 // Keep |prefs_| on top for destruction order because |extension_prefs_|, | 200 // Keep |prefs_| on top for destruction order because |extension_prefs_|, |
190 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store | 201 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store |
191 // pointers to |prefs_| and shall be destructed first. | 202 // pointers to |prefs_| and shall be destructed first. |
192 scoped_ptr<PrefService> prefs_; | 203 scoped_ptr<PrefService> prefs_; |
193 scoped_ptr<PrefService> otr_prefs_; | 204 scoped_ptr<PrefService> otr_prefs_; |
194 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; | 205 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; |
195 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 206 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
196 ProfileImplIOData::Handle io_data_; | 207 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_; |
197 scoped_refptr<ExtensionSpecialStoragePolicy> | 224 scoped_refptr<ExtensionSpecialStoragePolicy> |
198 extension_special_storage_policy_; | 225 extension_special_storage_policy_; |
199 scoped_ptr<NetPrefObserver> net_pref_observer_; | 226 scoped_ptr<NetPrefObserver> net_pref_observer_; |
200 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; | 227 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
201 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 228 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
202 scoped_refptr<PromoResourceService> promo_resource_service_; | 229 scoped_refptr<PromoResourceService> promo_resource_service_; |
203 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 230 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
204 | 231 |
205 scoped_ptr<TokenService> token_service_; | 232 scoped_ptr<TokenService> token_service_; |
206 | 233 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 Profile::Delegate* delegate_; | 297 Profile::Delegate* delegate_; |
271 | 298 |
272 chrome_browser_net::Predictor* predictor_; | 299 chrome_browser_net::Predictor* predictor_; |
273 | 300 |
274 bool session_restore_enabled_; | 301 bool session_restore_enabled_; |
275 | 302 |
276 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 303 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
277 }; | 304 }; |
278 | 305 |
279 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 306 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
OLD | NEW |