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