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