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 fileapi { | |
14 class FileSystemContext; | |
15 } | |
16 | |
17 namespace net { | 13 namespace net { |
18 class URLRequestContextGetter; | 14 class URLRequestContextGetter; |
19 } | 15 } |
20 | 16 |
21 namespace quota { | 17 namespace quota { |
22 class SpecialStoragePolicy; | 18 class SpecialStoragePolicy; |
23 } | 19 } |
24 | 20 |
25 class FilePath; | 21 class FilePath; |
26 class GURL; | 22 class GURL; |
(...skipping 13 matching lines...) Expand all Loading... |
40 // It lives on the UI thread. All these methods must only be called on the UI | 36 // It lives on the UI thread. All these methods must only be called on the UI |
41 // thread. | 37 // thread. |
42 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { | 38 class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { |
43 public: | 39 public: |
44 // Used in ForEachStoragePartition(). The first argument is the partition id. | 40 // Used in ForEachStoragePartition(). The first argument is the partition id. |
45 // The second argument is the StoragePartition object for that partition id. | 41 // The second argument is the StoragePartition object for that partition id. |
46 typedef base::Callback<void(const std::string&, StoragePartition*)> | 42 typedef base::Callback<void(const std::string&, StoragePartition*)> |
47 StoragePartitionCallback; | 43 StoragePartitionCallback; |
48 | 44 |
49 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); | 45 static DownloadManager* GetDownloadManager(BrowserContext* browser_context); |
50 static fileapi::FileSystemContext* GetFileSystemContext( | |
51 BrowserContext* browser_context); | |
52 | 46 |
53 static content::StoragePartition* GetStoragePartition( | 47 static content::StoragePartition* GetStoragePartition( |
54 BrowserContext* browser_context, SiteInstance* site_instance); | 48 BrowserContext* browser_context, SiteInstance* site_instance); |
55 static content::StoragePartition* GetStoragePartitionForSite( | 49 static content::StoragePartition* GetStoragePartitionForSite( |
56 BrowserContext* browser_context, const GURL& site); | 50 BrowserContext* browser_context, const GURL& site); |
57 static void ForEachStoragePartition( | 51 static void ForEachStoragePartition( |
58 BrowserContext* browser_context, | 52 BrowserContext* browser_context, |
59 const StoragePartitionCallback& callback); | 53 const StoragePartitionCallback& callback); |
60 | 54 |
61 // DON'T USE THIS. GetDefaultStoragePartition() is going away. | 55 // DON'T USE THIS. GetDefaultStoragePartition() is going away. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 98 |
105 // Returns the default request context for media resources associated with | 99 // Returns the default request context for media resources associated with |
106 // this context. | 100 // this context. |
107 // TODO(creis): Remove this version in favor of the one below. | 101 // TODO(creis): Remove this version in favor of the one below. |
108 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; | 102 virtual net::URLRequestContextGetter* GetMediaRequestContext() = 0; |
109 | 103 |
110 // Returns the request context for media resources associated with this | 104 // Returns the request context for media resources associated with this |
111 // context and renderer process. | 105 // context and renderer process. |
112 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( | 106 virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( |
113 int renderer_child_id) = 0; | 107 int renderer_child_id) = 0; |
| 108 virtual net::URLRequestContextGetter* |
| 109 GetMediaRequestContextForStoragePartition( |
| 110 const std::string& partition_id) = 0; |
114 | 111 |
115 // Returns the resource context. | 112 // Returns the resource context. |
116 virtual ResourceContext* GetResourceContext() = 0; | 113 virtual ResourceContext* GetResourceContext() = 0; |
117 | 114 |
118 // Returns the DownloadManagerDelegate for this context. This will be called | 115 // Returns the DownloadManagerDelegate for this context. This will be called |
119 // once per context. The embedder owns the delegate and is responsible for | 116 // once per context. The embedder owns the delegate and is responsible for |
120 // ensuring that it outlives DownloadManager. It's valid to return NULL. | 117 // ensuring that it outlives DownloadManager. It's valid to return NULL. |
121 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; | 118 virtual DownloadManagerDelegate* GetDownloadManagerDelegate() = 0; |
122 | 119 |
123 // Returns the geolocation permission context for this context. It's valid to | 120 // Returns the geolocation permission context for this context. It's valid to |
(...skipping 22 matching lines...) Expand all Loading... |
146 struct hash<content::BrowserContext*> { | 143 struct hash<content::BrowserContext*> { |
147 std::size_t operator()(content::BrowserContext* const& p) const { | 144 std::size_t operator()(content::BrowserContext* const& p) const { |
148 return reinterpret_cast<std::size_t>(p); | 145 return reinterpret_cast<std::size_t>(p); |
149 } | 146 } |
150 }; | 147 }; |
151 | 148 |
152 } // namespace BASE_HASH_NAMESPACE | 149 } // namespace BASE_HASH_NAMESPACE |
153 #endif | 150 #endif |
154 | 151 |
155 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 152 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |