Chromium Code Reviews| 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 // The salt should be stored in the current user profile and should be reset |
|
jam
2016/06/14 16:20:33
nit: don't mention user profile, since that's a ch
Guido Urdaneta
2016/06/14 17:30:57
Done.
| |
| 59 // should be stored in the current user profile and should be reset | 59 // if cookies are cleared. Returns a random string by default. |
| 60 // if cookies are cleared. The default is an empty string. | 60 virtual const std::string GetMediaDeviceIDSalt(); |
| 61 // | 61 |
| 62 // It is safe to hold on to the callback returned and use it without | 62 // Utility function useful for implementations |
|
jam
2016/06/14 16:20:33
nit: make it explicit that this only needs to be c
Guido Urdaneta
2016/06/14 17:30:57
Done.
| |
| 63 // regard to the lifetime of ResourceContext, although in general | 63 static std::string CreateRandomMediaDeviceIDSalt(); |
| 64 // you should not use it long after the profile has been destroyed. | 64 |
| 65 // | 65 private: |
| 66 // TODO(joi): We don't think it should be unnecessary to use this | 66 const std::string media_device_id_salt_; |
| 67 // after ResourceContext goes away. There is likely an underying bug | |
| 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 }; | 67 }; |
| 81 | 68 |
| 82 } // namespace content | 69 } // namespace content |
| 83 | 70 |
| 84 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 71 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
| OLD | NEW |