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

Side by Side Diff: chrome/browser/media/media_device_id_salt.h

Issue 54863002: Implement a salt for MediaSource IDs that can be cleared by a user. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments- unit tests still don't compile Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // MediaDeviceIDSalt is responsible for creating and retrieving a salt string
6 // that is used for creating MediaSource IDs that can be cached by a web
7 // service. If the cache is cleared, the MediaSourceIds are invalidated.
8
9 #ifndef CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_
10 #define CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_
11
12 #include <string>
13
14 #include "base/prefs/pref_member.h"
15 #include "base/synchronization/lock.h"
16 #include "components/user_prefs/pref_registry_syncable.h"
17
18 class PrefService;
19
20 class MediaDeviceIDSalt {
21 public:
22 MediaDeviceIDSalt(PrefService* pref_service,
23 bool incognito);
24 ~MediaDeviceIDSalt();
25
26 std::string GetSalt();
27
28 // Registers the preferences related to Media Stream default devices.
29 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
30 static void Reset(PrefService* pref_service);
31
32 private:
33 void OnValueReset(const std::string& pref_name);
34
35 // |lock_| is used for protecting |salt_| if cookies are cleared.
36 base::Lock lock_;
37 // |salt_| is initialized in ctor on UI thread but only read and changed on
Jói 2013/10/31 17:19:35 This is no longer strictly true. You can say "salt
perkj_chrome 2013/11/01 13:39:34 logic is now changed. On 2013/10/31 17:19:35, Jói
38 // the IO thread.
39 std::string salt_;
40 mutable StringPrefMember media_device_id_salt_;
41 };
42
43 #endif // CHROME_BROWSER_MEDIA_MEDIA_DEVICE_ID_SALT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698