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