| 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/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/timer.h" | 16 #include "base/timer.h" |
| 17 #include "chrome/browser/prefs/pref_change_registrar.h" | 17 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_impl_io_data.h" | 19 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 | 22 |
| 23 class ExtensionNavigationObserver; | 23 class ExtensionNavigationObserver; |
| 24 class ExtensionPrefs; | 24 class ExtensionSystem; |
| 25 class ExtensionPrefValueMap; | |
| 26 class NetPrefObserver; | 25 class NetPrefObserver; |
| 27 class PrefService; | 26 class PrefService; |
| 28 class PromoResourceService; | 27 class PromoResourceService; |
| 29 class SSLConfigServiceManager; | 28 class SSLConfigServiceManager; |
| 30 class VisitedLinkEventListener; | 29 class VisitedLinkEventListener; |
| 31 | 30 |
| 32 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 33 namespace chromeos { | 32 namespace chromeos { |
| 34 class EnterpriseExtensionObserver; | 33 class EnterpriseExtensionObserver; |
| 35 class LocaleChangeGuard; | 34 class LocaleChangeGuard; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Profile implementation: | 66 // Profile implementation: |
| 68 virtual std::string GetProfileName() OVERRIDE; | 67 virtual std::string GetProfileName() OVERRIDE; |
| 69 virtual bool IsOffTheRecord() OVERRIDE; | 68 virtual bool IsOffTheRecord() 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 virtual void SaveSessionState() OVERRIDE; | 117 virtual void SaveSessionState() OVERRIDE; |
| 127 | 118 |
| 128 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
| 129 virtual void ChangeAppLocale(const std::string& locale, | 120 virtual void ChangeAppLocale(const std::string& locale, |
| 130 AppLocaleChangedVia) OVERRIDE; | 121 AppLocaleChangedVia) OVERRIDE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 void CreatePasswordStore(); | 153 void CreatePasswordStore(); |
| 163 | 154 |
| 164 void StopCreateSessionServiceTimer(); | 155 void StopCreateSessionServiceTimer(); |
| 165 | 156 |
| 166 void EnsureRequestContextCreated() { | 157 void EnsureRequestContextCreated() { |
| 167 GetRequestContext(); | 158 GetRequestContext(); |
| 168 } | 159 } |
| 169 | 160 |
| 170 void EnsureSessionServiceCreated(); | 161 void EnsureSessionServiceCreated(); |
| 171 | 162 |
| 172 ExtensionPrefValueMap* GetExtensionPrefValueMap(); | |
| 173 | |
| 174 void UpdateProfileUserNameCache(); | 163 void UpdateProfileUserNameCache(); |
| 175 | 164 |
| 176 | 165 |
| 177 // Updates the ProfileInfoCache with data from this profile. | 166 // Updates the ProfileInfoCache with data from this profile. |
| 178 void UpdateProfileNameCache(); | 167 void UpdateProfileNameCache(); |
| 179 void UpdateProfileAvatarCache(); | 168 void UpdateProfileAvatarCache(); |
| 180 | 169 |
| 181 void GetCacheParameters(bool is_media_context, | 170 void GetCacheParameters(bool is_media_context, |
| 182 FilePath* cache_path, | 171 FilePath* cache_path, |
| 183 int* max_size); | 172 int* max_size); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 196 | 185 |
| 197 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; | 186 scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_; |
| 198 // Keep |prefs_| on top for destruction order because |extension_prefs_|, | 187 // Keep |prefs_| on top for destruction order because |extension_prefs_|, |
| 199 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store | 188 // |net_pref_observer_|, |web_resource_service_|, and |io_data_| store |
| 200 // pointers to |prefs_| and shall be destructed first. | 189 // pointers to |prefs_| and shall be destructed first. |
| 201 scoped_ptr<PrefService> prefs_; | 190 scoped_ptr<PrefService> prefs_; |
| 202 scoped_ptr<PrefService> otr_prefs_; | 191 scoped_ptr<PrefService> otr_prefs_; |
| 203 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; | 192 scoped_ptr<VisitedLinkEventListener> visited_link_event_listener_; |
| 204 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 193 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
| 205 ProfileImplIOData::Handle io_data_; | 194 ProfileImplIOData::Handle io_data_; |
| 206 // Keep extension_prefs_ on top of extension_service_ because the latter | |
| 207 // maintains a pointer to the first and shall be destructed first. | |
| 208 scoped_ptr<ExtensionPrefs> extension_prefs_; | |
| 209 scoped_ptr<ExtensionService> extension_service_; | |
| 210 scoped_refptr<UserScriptMaster> user_script_master_; | |
| 211 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | |
| 212 // extension_info_map_ needs to outlive extension_process_manager_. | |
| 213 scoped_refptr<ExtensionInfoMap> extension_info_map_; | |
| 214 // |extension_process_manager_| must be destroyed before |io_data_|. | |
| 215 // While |extension_process_manager_| still lives, we handle incoming | |
| 216 // resource requests from extension processes and those require access | |
| 217 // to the ResourceContext owned by |io_data_|. | |
| 218 scoped_ptr<ExtensionProcessManager> extension_process_manager_; | |
| 219 scoped_refptr<ExtensionMessageService> extension_message_service_; | |
| 220 scoped_ptr<ExtensionEventRouter> extension_event_router_; | |
| 221 scoped_ptr<ExtensionNavigationObserver> extension_navigation_observer_; | |
| 222 scoped_refptr<ExtensionSpecialStoragePolicy> | 195 scoped_refptr<ExtensionSpecialStoragePolicy> |
| 223 extension_special_storage_policy_; | 196 extension_special_storage_policy_; |
| 224 scoped_ptr<NetPrefObserver> net_pref_observer_; | 197 scoped_ptr<NetPrefObserver> net_pref_observer_; |
| 225 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; | 198 scoped_ptr<TemplateURLFetcher> template_url_fetcher_; |
| 226 scoped_ptr<BookmarkModel> bookmark_bar_model_; | 199 scoped_ptr<BookmarkModel> bookmark_bar_model_; |
| 227 scoped_refptr<PromoResourceService> promo_resource_service_; | 200 scoped_refptr<PromoResourceService> promo_resource_service_; |
| 228 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; | 201 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry_; |
| 229 | 202 |
| 230 scoped_ptr<TokenService> token_service_; | 203 scoped_ptr<TokenService> token_service_; |
| 231 | 204 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 Profile::Delegate* delegate_; | 269 Profile::Delegate* delegate_; |
| 297 | 270 |
| 298 chrome_browser_net::Predictor* predictor_; | 271 chrome_browser_net::Predictor* predictor_; |
| 299 | 272 |
| 300 bool session_restore_enabled_; | 273 bool session_restore_enabled_; |
| 301 | 274 |
| 302 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); | 275 DISALLOW_COPY_AND_ASSIGN(ProfileImpl); |
| 303 }; | 276 }; |
| 304 | 277 |
| 305 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ | 278 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_H_ |
| OLD | NEW |