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> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 // Create a platform KeygenHandler and pass it to |callback|. The |callback| | 48 // Create a platform KeygenHandler and pass it to |callback|. The |callback| |
49 // may be run synchronously. | 49 // may be run synchronously. |
50 virtual void CreateKeygenHandler( | 50 virtual void CreateKeygenHandler( |
51 uint32_t key_size_in_bits, | 51 uint32_t key_size_in_bits, |
52 const std::string& challenge_string, | 52 const std::string& challenge_string, |
53 const GURL& url, | 53 const GURL& url, |
54 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& | 54 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& |
55 callback); | 55 callback); |
56 | 56 |
57 // Returns a callback that can be invoked to get a random salt | 57 // Returns a random salt string that is used for creating media device IDs. |
58 // string that is used for creating media device IDs. The salt | 58 // Returns a random string by default. |
59 // should be stored in the current user profile and should be reset | 59 virtual std::string GetMediaDeviceIDSalt(); |
60 // if cookies are cleared. The default is an empty string. | 60 |
61 // | 61 // Utility function useful for embedders. Only needs to be called if |
62 // It is safe to hold on to the callback returned and use it without | 62 // 1) The embedder needs to use a new salt, and |
63 // regard to the lifetime of ResourceContext, although in general | 63 // 2) The embedder saves its salt across restarts. |
64 // you should not use it long after the profile has been destroyed. | 64 static std::string CreateRandomMediaDeviceIDSalt(); |
65 // | 65 |
66 // TODO(joi): We don't think it should be unnecessary to use this | 66 private: |
67 // after ResourceContext goes away. There is likely an underying bug | 67 const std::string media_device_id_salt_; |
68 // in the lifetime of ProfileIOData vs. ResourceProcessHost, where | |
69 // sometimes ProfileIOData has gone away before RPH has finished | |
70 // being torn down (on the IO thread). The current interface that | |
71 // allows using the salt object after ResourceContext has gone away | |
72 // was put in place to fix http://crbug.com/341211 but I intend to | |
73 // try to figure out how the lifetime should be fixed properly. The | |
74 // original interface was just a method that returns a string. | |
75 // | |
76 // TODO(perkj): Make this method pure virtual when crbug/315022 is | |
77 // fixed. | |
78 typedef base::Callback<std::string()> SaltCallback; | |
79 virtual SaltCallback GetMediaDeviceIDSalt(); | |
80 }; | 68 }; |
81 | 69 |
82 } // namespace content | 70 } // namespace content |
83 | 71 |
84 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 72 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
OLD | NEW |