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 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
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" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace appcache { | |
14 class AppCacheService; | |
15 } | |
16 | |
17 namespace fileapi { | 13 namespace fileapi { |
18 class FileSystemContext; | 14 class FileSystemContext; |
19 } | 15 } |
20 | 16 |
21 namespace net { | 17 namespace net { |
22 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
23 } | 19 } |
24 | 20 |
25 namespace quota { | 21 namespace quota { |
26 class SpecialStoragePolicy; | 22 class SpecialStoragePolicy; |
27 } | 23 } |
28 | 24 |
29 namespace webkit_database { | |
30 class DatabaseTracker; | |
31 } | |
32 | |
33 class FilePath; | 25 class FilePath; |
34 class GURL; | 26 class GURL; |
35 | 27 |
36 namespace content { | 28 namespace content { |
37 | 29 |
38 class DOMStorageContext; | |
39 class DownloadManager; | 30 class DownloadManager; |
40 class DownloadManagerDelegate; | 31 class DownloadManagerDelegate; |
41 class GeolocationPermissionContext; | 32 class GeolocationPermissionContext; |
42 class IndexedDBContext; | 33 class IndexedDBContext; |
43 class ResourceContext; | 34 class ResourceContext; |
44 class SiteInstance; | 35 class SiteInstance; |
45 class SpeechRecognitionPreferences; | 36 class SpeechRecognitionPreferences; |
46 class StoragePartition; | 37 class StoragePartition; |
47 | 38 |
48 // This class holds the context needed for a browsing session. | 39 // This class holds the context needed for a browsing session. |
49 // It lives on the UI thread. All these methods must only be called on the UI | 40 // It lives on the UI thread. All these methods must only be called on the UI |
50 // thread. | 41 // thread. |
51 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 42 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
52 public: | 43 public: |
53 // Used in ForEachStoragePartition(). The first argument is the partition id. | 44 // Used in ForEachStoragePartition(). The first argument is the partition id. |
54 // The second argument is the StoragePartition object for that partition id. | 45 // The second argument is the StoragePartition object for that partition id. |
55 typedef base::Callback<void(const std::string&, StoragePartition*)> | 46 typedef base::Callback<void(const std::string&, StoragePartition*)> |
56 StoragePartitionCallback; | 47 StoragePartitionCallback; |
57 | 48 |
58 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 49 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
59 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); | 50 static IndexedDBContext* GetIndexedDBContext(BrowserContext* browser_context); |
60 static appcache::AppCacheService* GetAppCacheService( | |
61 BrowserContext* browser_context); | |
62 static fileapi::FileSystemContext* GetFileSystemContext( | 51 static fileapi::FileSystemContext* GetFileSystemContext( |
63 BrowserContext* browser_context); | 52 BrowserContext* browser_context); |
64 | 53 |
65 static content::StoragePartition* GetStoragePartition( | 54 static content::StoragePartition* GetStoragePartition( |
66 BrowserContext* browser_context, SiteInstance* site_instance); | 55 BrowserContext* browser_context, SiteInstance* site_instance); |
67 static content::StoragePartition* GetStoragePartitionForSite( | 56 static content::StoragePartition* GetStoragePartitionForSite( |
68 BrowserContext* browser_context, const GURL& site); | 57 BrowserContext* browser_context, const GURL& site); |
69 static void ForEachStoragePartition( | 58 static void ForEachStoragePartition( |
70 BrowserContext* browser_context, | 59 BrowserContext* browser_context, |
71 const StoragePartitionCallback& callback); | 60 const StoragePartitionCallback& callback); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 // happen on the UI thread. | 92 // happen on the UI thread. |
104 // TODO(creis): Remove this version in favor of the one below. | 93 // TODO(creis): Remove this version in favor of the one below. |
105 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | 94 virtual net::URLRequestContextGetter* GetRequestContext() = 0; |
106 | 95 |
107 // Returns the request context appropriate for the given renderer. If the | 96 // Returns the request context appropriate for the given renderer. If the |
108 // renderer process doesn't have an associated installed app, or if the | 97 // renderer process doesn't have an associated installed app, or if the |
109 // installed app's is_storage_isolated() returns false, this is equivalent to | 98 // installed app's is_storage_isolated() returns false, this is equivalent to |
110 // calling GetRequestContext(). | 99 // calling GetRequestContext(). |
111 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( | 100 virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( |
112 int renderer_child_id) = 0; | 101 int renderer_child_id) = 0; |
113 | 102 |
awong
2012/09/14 00:09:57
Needs a comment explaining this function and likel
| |
103 virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( | |
104 const std::string& partition_id) = 0; | |
105 | |
114 // Returns the default request context for media resources associated with | 106 // Returns the default request context for media resources associated with |
115 // this context. | 107 // this context. |
116 // TODO(creis): Remove this version in favor of the one below. | 108 // TODO(creis): Remove this version in favor of the one below. |
117 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; | 109 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; |
118 | 110 |
119 // Returns the request context for media resources associated with this | 111 // Returns the request context for media resources associated with this |
120 // context and renderer process. | 112 // context and renderer process. |
121 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 113 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
122 int renderer_child_id) = 0; | 114 int renderer_child_id) = 0; |
123 | 115 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 struct hash<content::BrowserContext*> { | 147 struct hash<content::BrowserContext*> { |
156 std::size_t operator()(content::BrowserContext* const& p) const { | 148 std::size_t operator()(content::BrowserContext* const& p) const { |
157 return reinterpret_cast<std::size_t>(p); | 149 return reinterpret_cast<std::size_t>(p); |
158 } | 150 } |
159 }; | 151 }; |
160 | 152 |
161 } // namespace BASE_HASH_NAMESPACE | 153 } // namespace BASE_HASH_NAMESPACE |
162 #endif | 154 #endif |
163 | 155 |
164 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 156 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |