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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
12 | 13 |
13 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
15 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/supports_user_data.h" | 18 #include "base/supports_user_data.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/public/browser/zoom_level_delegate.h" | 20 #include "content/public/browser/zoom_level_delegate.h" |
21 #include "content/public/common/push_event_payload.h" | 21 #include "content/public/common/push_event_payload.h" |
22 #include "content/public/common/push_messaging_status.h" | 22 #include "content/public/common/push_messaging_status.h" |
23 #include "net/url_request/url_request_interceptor.h" | 23 #include "net/url_request/url_request_interceptor.h" |
24 #include "net/url_request/url_request_job_factory.h" | 24 #include "net/url_request/url_request_job_factory.h" |
25 | 25 |
26 class GURL; | 26 class GURL; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const StoragePartitionCallback& callback); | 89 const StoragePartitionCallback& callback); |
90 static void AsyncObliterateStoragePartition( | 90 static void AsyncObliterateStoragePartition( |
91 BrowserContext* browser_context, | 91 BrowserContext* browser_context, |
92 const GURL& site, | 92 const GURL& site, |
93 const base::Closure& on_gc_required); | 93 const base::Closure& on_gc_required); |
94 | 94 |
95 // This function clears the contents of |active_paths| but does not take | 95 // This function clears the contents of |active_paths| but does not take |
96 // ownership of the pointer. | 96 // ownership of the pointer. |
97 static void GarbageCollectStoragePartitions( | 97 static void GarbageCollectStoragePartitions( |
98 BrowserContext* browser_context, | 98 BrowserContext* browser_context, |
99 scoped_ptr<base::hash_set<base::FilePath> > active_paths, | 99 std::unique_ptr<base::hash_set<base::FilePath>> active_paths, |
100 const base::Closure& done); | 100 const base::Closure& done); |
101 | 101 |
102 // DON'T USE THIS. GetDefaultStoragePartition() is going away. | 102 // DON'T USE THIS. GetDefaultStoragePartition() is going away. |
103 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. | 103 // Use GetStoragePartition() instead. Ask ajwong@ if you have problems. |
104 static content::StoragePartition* GetDefaultStoragePartition( | 104 static content::StoragePartition* GetDefaultStoragePartition( |
105 BrowserContext* browser_context); | 105 BrowserContext* browser_context); |
106 | 106 |
107 typedef base::Callback<void(scoped_ptr<BlobHandle>)> BlobCallback; | 107 typedef base::Callback<void(std::unique_ptr<BlobHandle>)> BlobCallback; |
108 | 108 |
109 // |callback| returns a nullptr scoped_ptr on failure. | 109 // |callback| returns a nullptr scoped_ptr on failure. |
110 static void CreateMemoryBackedBlob(BrowserContext* browser_context, | 110 static void CreateMemoryBackedBlob(BrowserContext* browser_context, |
111 const char* data, size_t length, | 111 const char* data, size_t length, |
112 const BlobCallback& callback); | 112 const BlobCallback& callback); |
113 | 113 |
114 // |callback| returns a nullptr scoped_ptr on failure. | 114 // |callback| returns a nullptr scoped_ptr on failure. |
115 static void CreateFileBackedBlob(BrowserContext* browser_context, | 115 static void CreateFileBackedBlob(BrowserContext* browser_context, |
116 const base::FilePath& path, | 116 const base::FilePath& path, |
117 int64_t offset, | 117 int64_t offset, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 const base::FilePath& path); | 150 const base::FilePath& path); |
151 | 151 |
152 // Returns a Mojo User ID associated with this BrowserContext. This ID is not | 152 // Returns a Mojo User ID associated with this BrowserContext. This ID is not |
153 // persistent across runs. See mojo/shell/public/interfaces/connector.mojom. | 153 // persistent across runs. See mojo/shell/public/interfaces/connector.mojom. |
154 static const std::string& GetMojoUserIdFor(BrowserContext* browser_context); | 154 static const std::string& GetMojoUserIdFor(BrowserContext* browser_context); |
155 | 155 |
156 ~BrowserContext() override; | 156 ~BrowserContext() override; |
157 | 157 |
158 // Creates a delegate to initialize a HostZoomMap and persist its information. | 158 // Creates a delegate to initialize a HostZoomMap and persist its information. |
159 // This is called during creation of each StoragePartition. | 159 // This is called during creation of each StoragePartition. |
160 virtual scoped_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( | 160 virtual std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate( |
161 const base::FilePath& partition_path) = 0; | 161 const base::FilePath& partition_path) = 0; |
162 | 162 |
163 // Returns the path of the directory where this context's data is stored. | 163 // Returns the path of the directory where this context's data is stored. |
164 virtual base::FilePath GetPath() const = 0; | 164 virtual base::FilePath GetPath() const = 0; |
165 | 165 |
166 // Return whether this context is incognito. Default is false. | 166 // Return whether this context is incognito. Default is false. |
167 virtual bool IsOffTheRecord() const = 0; | 167 virtual bool IsOffTheRecord() const = 0; |
168 | 168 |
169 // Returns the request context information associated with this context. Call | 169 // Returns the request context information associated with this context. Call |
170 // this only on the UI thread, since it can send notifications that should | 170 // this only on the UI thread, since it can send notifications that should |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( | 227 virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( |
228 const base::FilePath& partition_path, | 228 const base::FilePath& partition_path, |
229 bool in_memory, | 229 bool in_memory, |
230 ProtocolHandlerMap* protocol_handlers, | 230 ProtocolHandlerMap* protocol_handlers, |
231 URLRequestInterceptorScopedVector request_interceptors) = 0; | 231 URLRequestInterceptorScopedVector request_interceptors) = 0; |
232 }; | 232 }; |
233 | 233 |
234 } // namespace content | 234 } // namespace content |
235 | 235 |
236 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 236 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |