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_RESOURCE_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 #include <string> | |
12 | |
13 #include "base/callback.h" | |
14 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
15 #include "build/build_config.h" | |
16 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
17 | 10 |
18 namespace net { | 11 namespace net { |
19 class HostResolver; | 12 class HostResolver; |
20 class URLRequestContext; | 13 class URLRequestContext; |
21 } | 14 } |
22 | 15 |
23 namespace content { | 16 namespace content { |
24 | 17 |
25 // ResourceContext contains the relevant context information required for | 18 // ResourceContext contains the relevant context information required for |
26 // resource loading. It lives on the IO thread, although it is constructed on | 19 // resource loading. It lives on the IO thread, although it is constructed on |
27 // the UI thread. It must be destructed on the IO thread. | 20 // the UI thread. It must be destructed on the IO thread. |
| 21 // TODO(mmenke): Get rid of this class. |
28 class CONTENT_EXPORT ResourceContext : public base::SupportsUserData { | 22 class CONTENT_EXPORT ResourceContext : public base::SupportsUserData { |
29 public: | 23 public: |
30 ResourceContext(); | 24 ResourceContext(); |
31 ~ResourceContext() override; | 25 ~ResourceContext() override; |
32 virtual net::HostResolver* GetHostResolver() = 0; | 26 virtual net::HostResolver* GetHostResolver() = 0; |
33 | 27 |
34 // DEPRECATED: This is no longer a valid given isolated apps/sites and | 28 // DEPRECATED: This is no longer a valid given isolated apps/sites and |
35 // storage partitioning. This getter returns the default context associated | 29 // storage partitioning. This getter returns the default context associated |
36 // with a BrowsingContext. | 30 // with a BrowsingContext. |
37 virtual net::URLRequestContext* GetRequestContext() = 0; | 31 virtual net::URLRequestContext* GetRequestContext() = 0; |
38 | |
39 // Returns a random salt string that is used for creating media device IDs. | |
40 // Returns a random string by default. | |
41 virtual std::string GetMediaDeviceIDSalt(); | |
42 | |
43 // Utility function useful for embedders. Only needs to be called if | |
44 // 1) The embedder needs to use a new salt, and | |
45 // 2) The embedder saves its salt across restarts. | |
46 static std::string CreateRandomMediaDeviceIDSalt(); | |
47 | |
48 private: | |
49 const std::string media_device_id_salt_; | |
50 }; | 32 }; |
51 | 33 |
52 } // namespace content | 34 } // namespace content |
53 | 35 |
54 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 36 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
OLD | NEW |