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