Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2269)

Unified Diff: content/public/browser/resource_context.h

Issue 1987643002: Make default media device ID salts random by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change return type from const string to string as it makes no difference Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/browser/media_device_id.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/resource_context.h
diff --git a/content/public/browser/resource_context.h b/content/public/browser/resource_context.h
index 039ad94006ded4e49f25ad2a3784d3ed9d7e6b40..022a338f8f34025581ce40a5084e9e94b85136b5 100644
--- a/content/public/browser/resource_context.h
+++ b/content/public/browser/resource_context.h
@@ -54,29 +54,17 @@ class CONTENT_EXPORT ResourceContext : public base::SupportsUserData {
const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>&
callback);
- // Returns a callback that can be invoked to get a random salt
- // string that is used for creating media device IDs. The salt
- // should be stored in the current user profile and should be reset
- // if cookies are cleared. The default is an empty string.
- //
- // It is safe to hold on to the callback returned and use it without
- // regard to the lifetime of ResourceContext, although in general
- // you should not use it long after the profile has been destroyed.
- //
- // TODO(joi): We don't think it should be unnecessary to use this
- // after ResourceContext goes away. There is likely an underying bug
- // in the lifetime of ProfileIOData vs. ResourceProcessHost, where
- // sometimes ProfileIOData has gone away before RPH has finished
- // being torn down (on the IO thread). The current interface that
- // allows using the salt object after ResourceContext has gone away
- // was put in place to fix http://crbug.com/341211 but I intend to
- // try to figure out how the lifetime should be fixed properly. The
- // original interface was just a method that returns a string.
- //
- // TODO(perkj): Make this method pure virtual when crbug/315022 is
- // fixed.
- typedef base::Callback<std::string()> SaltCallback;
- virtual SaltCallback GetMediaDeviceIDSalt();
+ // Returns a random salt string that is used for creating media device IDs.
+ // Returns a random string by default.
+ virtual std::string GetMediaDeviceIDSalt();
+
+ // Utility function useful for embedders. Only needs to be called if
+ // 1) The embedder needs to use a new salt, and
+ // 2) The embedder saves its salt across restarts.
+ static std::string CreateRandomMediaDeviceIDSalt();
+
+ private:
+ const std::string media_device_id_salt_;
};
} // namespace content
« no previous file with comments | « content/public/browser/media_device_id.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698