Chromium Code Reviews| 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 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 namespace webkit_database { | 30 namespace webkit_database { |
| 31 class DatabaseTracker; | 31 class DatabaseTracker; |
| 32 } | 32 } |
| 33 | 33 |
| 34 class FilePath; | 34 class FilePath; |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 class DOMStorageContext; | 38 class DOMStorageContext; |
| 39 class DownloadManager; | 39 class DownloadManager; |
| 40 class DownloadManagerDelegate; | |
| 40 class GeolocationPermissionContext; | 41 class GeolocationPermissionContext; |
| 41 class IndexedDBContext; | 42 class IndexedDBContext; |
| 42 class ResourceContext; | 43 class ResourceContext; |
| 43 class SpeechRecognitionPreferences; | 44 class SpeechRecognitionPreferences; |
| 44 | 45 |
| 45 // This class holds the context needed for a browsing session. | 46 // This class holds the context needed for a browsing session. |
| 46 // It lives on the UI thread. | 47 // It lives on the UI thread. |
| 47 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 48 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
| 48 public: | 49 public: |
| 50 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | |
| 49 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); | 51 static quota::QuotaManager* GetQuotaManager(BrowserContext* browser_context); |
| 50 static DOMStorageContext* GetDOMStorageContext( | 52 static DOMStorageContext* GetDOMStorageContext( |
| 51 BrowserContext* browser_context); | 53 BrowserContext* browser_context); |
| 52 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); | 54 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); |
| 53 static webkit_database::DatabaseTracker* GetDatabaseTracker( | 55 static webkit_database::DatabaseTracker* GetDatabaseTracker( |
| 54 BrowserContext* browser_context); | 56 BrowserContext* browser_context); |
| 55 static appcache::AppCacheService* GetAppCacheService( | 57 static appcache::AppCacheService* GetAppCacheService( |
| 56 BrowserContext* browser_context); | 58 BrowserContext* browser_context); |
| 57 static fileapi::FileSystemContext* GetFileSystemContext( | 59 static fileapi::FileSystemContext* GetFileSystemContext( |
| 58 BrowserContext* browser_context); | 60 BrowserContext* browser_context); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 73 | 75 |
| 74 virtual ~BrowserContext(); | 76 virtual ~BrowserContext(); |
| 75 | 77 |
| 76 // Returns the path of the directory where this context's data is stored. | 78 // Returns the path of the directory where this context's data is stored. |
| 77 virtual FilePath GetPath() = 0; | 79 virtual FilePath GetPath() = 0; |
| 78 | 80 |
| 79 // Return whether this context is incognito. Default is false. | 81 // Return whether this context is incognito. Default is false. |
| 80 // This doesn't belong here; http://crbug.com/89628 | 82 // This doesn't belong here; http://crbug.com/89628 |
| 81 virtual bool IsOffTheRecord() const = 0; | 83 virtual bool IsOffTheRecord() const = 0; |
| 82 | 84 |
| 83 // Returns the DownloadManager associated with this context. | |
| 84 virtual content::DownloadManager* GetDownloadManager() = 0; | |
| 85 | |
| 86 // Returns the request context information associated with this context. Call | 85 // Returns the request context information associated with this context. Call |
| 87 // this only on the UI thread, since it can send notifications that should | 86 // this only on the UI thread, since it can send notifications that should |
| 88 // happen on the UI thread. | 87 // happen on the UI thread. |
| 89 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | 88 virtual net::URLRequestContextGetter* GetRequestContext() = 0; |
| 90 | 89 |
| 91 // Returns the request context appropriate for the given renderer. If the | 90 // Returns the request context appropriate for the given renderer. If the |
| 92 // renderer process doesn't have an associated installed app, or if the | 91 // renderer process doesn't have an associated installed app, or if the |
| 93 // installed app's is_storage_isolated() returns false, this is equivalent to | 92 // installed app's is_storage_isolated() returns false, this is equivalent to |
| 94 // calling GetRequestContext(). | 93 // calling GetRequestContext(). |
| 95 // TODO(creis): After isolated app storage is no longer an experimental | 94 // TODO(creis): After isolated app storage is no longer an experimental |
| 96 // feature, consider making this the default contract for GetRequestContext. | 95 // feature, consider making this the default contract for GetRequestContext. |
| 97 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 96 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
| 98 int renderer_child_id) = 0; | 97 int renderer_child_id) = 0; |
| 99 | 98 |
| 100 // Returns the request context for media resources associated with this | 99 // Returns the request context for media resources associated with this |
| 101 // context. | 100 // context. |
| 102 virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; | 101 virtual net::URLRequestContextGetter* GetRequestContextForMedia() = 0; |
| 103 | 102 |
| 104 // Returns the resource context. | 103 // Returns the resource context. |
| 105 virtual ResourceContext* GetResourceContext() = 0; | 104 virtual ResourceContext* GetResourceContext() = 0; |
| 106 | 105 |
| 106 // Returns the DownloadManagerDelegate for this context. This will be called | |
| 107 // once per context. It's valid to return NULL. | |
| 108 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | |
|
Randy Smith (Not in Mondays)
2012/06/06 15:51:59
What's the conceptual reason for not having the Do
jam
2012/06/06 16:06:15
The reason is that BrowserContext is an interface
Randy Smith (Not in Mondays)
2012/06/06 16:34:45
Makes sense; thanks for the explanation.
| |
| 109 | |
| 107 // Returns the geolocation permission context for this context. | 110 // Returns the geolocation permission context for this context. |
| 108 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; | 111 virtual GeolocationPermissionContext* GetGeolocationPermissionContext() = 0; |
| 109 | 112 |
| 110 // Returns the speech input preferences. SpeechRecognitionPreferences is a | 113 // Returns the speech input preferences. SpeechRecognitionPreferences is a |
| 111 // ref counted class, so callers should take a reference if needed. | 114 // ref counted class, so callers should take a reference if needed. |
| 112 virtual SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() = 0; | 115 virtual SpeechRecognitionPreferences* GetSpeechRecognitionPreferences() = 0; |
| 113 | 116 |
| 114 // Returns true if the last time this context was open it was exited cleanly. | 117 // Returns true if the last time this context was open it was exited cleanly. |
| 115 // This doesn't belong here; http://crbug.com/90737 | 118 // This doesn't belong here; http://crbug.com/90737 |
| 116 virtual bool DidLastSessionExitCleanly() = 0; | 119 virtual bool DidLastSessionExitCleanly() = 0; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 128 struct hash<content::BrowserContext*> { | 131 struct hash<content::BrowserContext*> { |
| 129 std::size_t operator()(content::BrowserContext* const& p) const { | 132 std::size_t operator()(content::BrowserContext* const& p) const { |
| 130 return reinterpret_cast<std::size_t>(p); | 133 return reinterpret_cast<std::size_t>(p); |
| 131 } | 134 } |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 } // namespace BASE_HASH_NAMESPACE | 137 } // namespace BASE_HASH_NAMESPACE |
| 135 #endif | 138 #endif |
| 136 | 139 |
| 137 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 140 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
| OLD | NEW |