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