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 #include <memory> |
| 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
16 #include "base/containers/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
17 #include "base/memory/linked_ptr.h" | 18 #include "base/memory/linked_ptr.h" |
18 #include "base/supports_user_data.h" | 19 #include "base/supports_user_data.h" |
19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
20 #include "content/public/browser/zoom_level_delegate.h" | 21 #include "content/public/browser/zoom_level_delegate.h" |
21 #include "content/public/common/push_event_payload.h" | 22 #include "content/public/common/push_event_payload.h" |
22 #include "content/public/common/push_messaging_status.h" | 23 #include "content/public/common/push_messaging_status.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 static BrowserContext* GetBrowserContextForServiceUserId( | 165 static BrowserContext* GetBrowserContextForServiceUserId( |
165 const std::string& user_id); | 166 const std::string& user_id); |
166 | 167 |
167 // Returns a Connector associated with this BrowserContext, which can be used | 168 // Returns a Connector associated with this BrowserContext, which can be used |
168 // to connect to service instances bound as this user. | 169 // to connect to service instances bound as this user. |
169 static service_manager::Connector* GetConnectorFor( | 170 static service_manager::Connector* GetConnectorFor( |
170 BrowserContext* browser_context); | 171 BrowserContext* browser_context); |
171 static ServiceManagerConnection* GetServiceManagerConnectionFor( | 172 static ServiceManagerConnection* GetServiceManagerConnectionFor( |
172 BrowserContext* browser_context); | 173 BrowserContext* browser_context); |
173 | 174 |
| 175 BrowserContext(); |
| 176 |
174 ~BrowserContext() override; | 177 ~BrowserContext() override; |
175 | 178 |
176 // Shuts down the storage partitions associated to this browser context. | 179 // Shuts down the storage partitions associated to this browser context. |
177 // This must be called before the browser context is actually destroyed | 180 // This must be called before the browser context is actually destroyed |
178 // and before a clean-up task for its corresponding IO thread residents (e.g. | 181 // and before a clean-up task for its corresponding IO thread residents (e.g. |
179 // ResourceContext) is posted, so that the classes that hung on | 182 // ResourceContext) is posted, so that the classes that hung on |
180 // StoragePartition can have time to do necessary cleanups on IO thread. | 183 // StoragePartition can have time to do necessary cleanups on IO thread. |
181 void ShutdownStoragePartitions(); | 184 void ShutdownStoragePartitions(); |
182 | 185 |
183 // Creates a delegate to initialize a HostZoomMap and persist its information. | 186 // Creates a delegate to initialize a HostZoomMap and persist its information. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 virtual net::URLRequestContextGetter* | 247 virtual net::URLRequestContextGetter* |
245 CreateMediaRequestContextForStoragePartition( | 248 CreateMediaRequestContextForStoragePartition( |
246 const base::FilePath& partition_path, | 249 const base::FilePath& partition_path, |
247 bool in_memory) = 0; | 250 bool in_memory) = 0; |
248 | 251 |
249 using StaticServiceMap = std::map<std::string, ServiceInfo>; | 252 using StaticServiceMap = std::map<std::string, ServiceInfo>; |
250 | 253 |
251 // Registers per-browser-context services to be loaded in the browser process | 254 // Registers per-browser-context services to be loaded in the browser process |
252 // by the Service Manager. | 255 // by the Service Manager. |
253 virtual void RegisterInProcessServices(StaticServiceMap* services) {} | 256 virtual void RegisterInProcessServices(StaticServiceMap* services) {} |
| 257 |
| 258 // Returns a random salt string that is used for creating media device IDs. |
| 259 // Returns a random string by default. |
| 260 virtual std::string GetMediaDeviceIDSalt(); |
| 261 |
| 262 // Utility function useful for embedders. Only needs to be called if |
| 263 // 1) The embedder needs to use a new salt, and |
| 264 // 2) The embedder saves its salt across restarts. |
| 265 static std::string CreateRandomMediaDeviceIDSalt(); |
| 266 |
| 267 private: |
| 268 const std::string media_device_id_salt_; |
254 }; | 269 }; |
255 | 270 |
256 } // namespace content | 271 } // namespace content |
257 | 272 |
258 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ | 273 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CONTEXT_H_ |
OLD | NEW |