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_H_ | 7 #ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ |
8 #define CHROME_BROWSER_PROFILES_PROFILE_H_ | 8 #define CHROME_BROWSER_PROFILES_PROFILE_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "chrome/browser/net/preconnect.h" // TODO: remove this. | 16 #include "chrome/browser/net/preconnect.h" // TODO: remove this. |
17 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 17 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
18 #include "chrome/common/extensions/extension_constants.h" | |
19 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
20 | 19 |
21 class AutocompleteClassifier; | 20 class AutocompleteClassifier; |
22 class BookmarkModel; | 21 class BookmarkModel; |
23 class ChromeAppCacheService; | 22 class ChromeAppCacheService; |
24 class ChromeURLDataManager; | 23 class ChromeURLDataManager; |
25 class Extension; | 24 class Extension; |
26 class ExtensionDevToolsManager; | |
27 class ExtensionEventRouter; | 25 class ExtensionEventRouter; |
28 class ExtensionInfoMap; | 26 class ExtensionPrefValueMap; |
29 class ExtensionMessageService; | |
30 class ExtensionProcessManager; | 27 class ExtensionProcessManager; |
31 class ExtensionService; | 28 class ExtensionService; |
32 class ExtensionSpecialStoragePolicy; | 29 class ExtensionSpecialStoragePolicy; |
33 class FaviconService; | 30 class FaviconService; |
34 class GAIAInfoUpdateService; | 31 class GAIAInfoUpdateService; |
35 class HistoryService; | 32 class HistoryService; |
36 class HostContentSettingsMap; | 33 class HostContentSettingsMap; |
37 class PasswordStore; | 34 class PasswordStore; |
38 class PrefService; | 35 class PrefService; |
39 class PromoCounter; | 36 class PromoCounter; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 virtual history::TopSites* GetTopSites() = 0; | 209 virtual history::TopSites* GetTopSites() = 0; |
213 | 210 |
214 // Variant of GetTopSites that doesn't force creation. | 211 // Variant of GetTopSites that doesn't force creation. |
215 virtual history::TopSites* GetTopSitesWithoutCreating() = 0; | 212 virtual history::TopSites* GetTopSitesWithoutCreating() = 0; |
216 | 213 |
217 // Retrieves a pointer to the VisitedLinkMaster associated with this | 214 // Retrieves a pointer to the VisitedLinkMaster associated with this |
218 // profile. The VisitedLinkMaster is lazily created the first time | 215 // profile. The VisitedLinkMaster is lazily created the first time |
219 // that this method is called. | 216 // that this method is called. |
220 virtual VisitedLinkMaster* GetVisitedLinkMaster() = 0; | 217 virtual VisitedLinkMaster* GetVisitedLinkMaster() = 0; |
221 | 218 |
| 219 // Accessor. The instance is created upon first access. |
| 220 // TODO(yoz): make this a ProfileKeyedService. |
| 221 virtual ExtensionPrefValueMap* GetExtensionPrefValueMap() = 0; |
| 222 |
| 223 // DEPRECATED. Instead, use ExtensionSystemFactory::extension_service(). |
222 // Retrieves a pointer to the ExtensionService associated with this | 224 // Retrieves a pointer to the ExtensionService associated with this |
223 // profile. The ExtensionService is created at startup. | 225 // profile. The ExtensionService is created at startup. |
| 226 // TODO(yoz): remove this accessor (bug 104095). |
224 virtual ExtensionService* GetExtensionService() = 0; | 227 virtual ExtensionService* GetExtensionService() = 0; |
225 | 228 |
| 229 // DEPRECATED. Instead, use ExtensionSystemFactory::user_script_master(). |
226 // Retrieves a pointer to the UserScriptMaster associated with this | 230 // Retrieves a pointer to the UserScriptMaster associated with this |
227 // profile. The UserScriptMaster is lazily created the first time | 231 // profile. The UserScriptMaster is lazily created the first time |
228 // that this method is called. | 232 // that this method is called. |
| 233 // TODO(yoz): remove this accessor (bug 104095). |
229 virtual UserScriptMaster* GetUserScriptMaster() = 0; | 234 virtual UserScriptMaster* GetUserScriptMaster() = 0; |
230 | 235 |
231 // Retrieves a pointer to the ExtensionDevToolsManager associated with this | 236 // DEPRECATED. Instead, use ExtensionSystemFactory::process_manager(). |
232 // profile. The instance is created at startup. | |
233 virtual ExtensionDevToolsManager* GetExtensionDevToolsManager() = 0; | |
234 | |
235 // Retrieves a pointer to the ExtensionProcessManager associated with this | 237 // Retrieves a pointer to the ExtensionProcessManager associated with this |
236 // profile. The instance is created at startup. | 238 // profile. The instance is created at startup. |
| 239 // TODO(yoz): remove this accessor (bug 104095). |
237 virtual ExtensionProcessManager* GetExtensionProcessManager() = 0; | 240 virtual ExtensionProcessManager* GetExtensionProcessManager() = 0; |
238 | 241 |
239 // Retrieves a pointer to the ExtensionMessageService associated with this | 242 // DEPRECATED. Instead, use ExtensionSystemFactory::event_router(). |
240 // profile. The instance is created at startup. | |
241 virtual ExtensionMessageService* GetExtensionMessageService() = 0; | |
242 | |
243 // Accessor. The instance is created at startup. | 243 // Accessor. The instance is created at startup. |
| 244 // TODO(yoz): remove this accessor (bug 104095). |
244 virtual ExtensionEventRouter* GetExtensionEventRouter() = 0; | 245 virtual ExtensionEventRouter* GetExtensionEventRouter() = 0; |
245 | 246 |
246 // Accessor. The instance is created upon first access. | 247 // Accessor. The instance is created upon first access. |
247 virtual ExtensionSpecialStoragePolicy* | 248 virtual ExtensionSpecialStoragePolicy* |
248 GetExtensionSpecialStoragePolicy() = 0; | 249 GetExtensionSpecialStoragePolicy() = 0; |
249 | 250 |
250 // Retrieves a pointer to the FaviconService associated with this | 251 // Retrieves a pointer to the FaviconService associated with this |
251 // profile. The FaviconService is lazily created the first time | 252 // profile. The FaviconService is lazily created the first time |
252 // that this method is called. | 253 // that this method is called. |
253 // | 254 // |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 324 |
324 // Returns the request context used for extension-related requests. This | 325 // Returns the request context used for extension-related requests. This |
325 // is only used for a separate cookie store currently. | 326 // is only used for a separate cookie store currently. |
326 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; | 327 virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; |
327 | 328 |
328 // Returns the request context used within an installed app that has | 329 // Returns the request context used within an installed app that has |
329 // requested isolated storage. | 330 // requested isolated storage. |
330 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( | 331 virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( |
331 const std::string& app_id) = 0; | 332 const std::string& app_id) = 0; |
332 | 333 |
333 // Called by the ExtensionService that lives in this profile. Gives the | |
334 // profile a chance to react to the load event before the EXTENSION_LOADED | |
335 // notification has fired. The purpose for handling this event first is to | |
336 // avoid race conditions by making sure URLRequestContexts learn about new | |
337 // extensions before anything else needs them to know. | |
338 virtual void RegisterExtensionWithRequestContexts( | |
339 const Extension* extension) {} | |
340 | |
341 // Called by the ExtensionService that lives in this profile. Lets the | |
342 // profile clean up its RequestContexts once all the listeners to the | |
343 // EXTENSION_UNLOADED notification have finished running. | |
344 virtual void UnregisterExtensionWithRequestContexts( | |
345 const std::string& extension_id, | |
346 const extension_misc::UnloadedExtensionReason) {} | |
347 | |
348 // Returns the SSLConfigService for this profile. | 334 // Returns the SSLConfigService for this profile. |
349 virtual net::SSLConfigService* GetSSLConfigService() = 0; | 335 virtual net::SSLConfigService* GetSSLConfigService() = 0; |
350 | 336 |
351 // Returns the Hostname <-> Content settings map for this profile. | 337 // Returns the Hostname <-> Content settings map for this profile. |
352 virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; | 338 virtual HostContentSettingsMap* GetHostContentSettingsMap() = 0; |
353 | 339 |
354 // Returns the user style sheet watcher. | 340 // Returns the user style sheet watcher. |
355 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; | 341 virtual UserStyleSheetWatcher* GetUserStyleSheetWatcher() = 0; |
356 | 342 |
357 // Returns the BookmarkModel, creating if not yet created. | 343 // Returns the BookmarkModel, creating if not yet created. |
(...skipping 16 matching lines...) Expand all Loading... |
374 // this profile. For the single profile case, this corresponds to the time | 360 // this profile. For the single profile case, this corresponds to the time |
375 // the user started chrome. | 361 // the user started chrome. |
376 virtual base::Time GetStartTime() const = 0; | 362 virtual base::Time GetStartTime() const = 0; |
377 | 363 |
378 // Marks the profile as cleanly shutdown. | 364 // Marks the profile as cleanly shutdown. |
379 // | 365 // |
380 // NOTE: this is invoked internally on a normal shutdown, but is public so | 366 // NOTE: this is invoked internally on a normal shutdown, but is public so |
381 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). | 367 // that it can be invoked when the user logs out/powers down (WM_ENDSESSION). |
382 virtual void MarkAsCleanShutdown() = 0; | 368 virtual void MarkAsCleanShutdown() = 0; |
383 | 369 |
384 // Initializes extensions machinery. | |
385 // Component extensions are always enabled, external and user extensions | |
386 // are controlled by |extensions_enabled|. | |
387 virtual void InitExtensions(bool extensions_enabled) = 0; | |
388 | |
389 // Start up service that gathers data from a promo resource feed. | 370 // Start up service that gathers data from a promo resource feed. |
390 virtual void InitPromoResources() = 0; | 371 virtual void InitPromoResources() = 0; |
391 | 372 |
392 // Register URLRequestFactories for protocols registered with | 373 // Register URLRequestFactories for protocols registered with |
393 // registerProtocolHandler. | 374 // registerProtocolHandler. |
394 virtual void InitRegisteredProtocolHandlers() = 0; | 375 virtual void InitRegisteredProtocolHandlers() = 0; |
395 | 376 |
396 // Returns the last directory that was chosen for uploading or opening a file. | 377 // Returns the last directory that was chosen for uploading or opening a file. |
397 virtual FilePath last_selected_directory() = 0; | 378 virtual FilePath last_selected_directory() = 0; |
398 virtual void set_last_selected_directory(const FilePath& path) = 0; | 379 virtual void set_last_selected_directory(const FilePath& path) = 0; |
399 | 380 |
400 // Returns the IO-thread-accessible profile data for this profile. | |
401 virtual ExtensionInfoMap* GetExtensionInfoMap() = 0; | |
402 | |
403 // Returns the PromoCounter for Instant, or NULL if not applicable. | 381 // Returns the PromoCounter for Instant, or NULL if not applicable. |
404 virtual PromoCounter* GetInstantPromoCounter() = 0; | 382 virtual PromoCounter* GetInstantPromoCounter() = 0; |
405 | 383 |
406 // Returns the ChromeURLDataManager for this profile. | 384 // Returns the ChromeURLDataManager for this profile. |
407 virtual ChromeURLDataManager* GetChromeURLDataManager() = 0; | 385 virtual ChromeURLDataManager* GetChromeURLDataManager() = 0; |
408 | 386 |
409 #if defined(OS_CHROMEOS) | 387 #if defined(OS_CHROMEOS) |
410 enum AppLocaleChangedVia { | 388 enum AppLocaleChangedVia { |
411 // Caused by chrome://settings change. | 389 // Caused by chrome://settings change. |
412 APP_LOCALE_CHANGED_VIA_SETTINGS, | 390 APP_LOCALE_CHANGED_VIA_SETTINGS, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 struct hash<Profile*> { | 500 struct hash<Profile*> { |
523 std::size_t operator()(Profile* const& p) const { | 501 std::size_t operator()(Profile* const& p) const { |
524 return reinterpret_cast<std::size_t>(p); | 502 return reinterpret_cast<std::size_t>(p); |
525 } | 503 } |
526 }; | 504 }; |
527 | 505 |
528 } // namespace BASE_HASH_NAMESPACE | 506 } // namespace BASE_HASH_NAMESPACE |
529 #endif | 507 #endif |
530 | 508 |
531 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ | 509 #endif // CHROME_BROWSER_PROFILES_PROFILE_H_ |
OLD | NEW |