OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/media/media_device_id_salt.h" | 4 #include "chrome/browser/media/media_device_id_salt.h" |
5 | 5 |
6 #include "base/base64.h" | 6 #include "base/base64.h" |
7 #include "base/prefs/pref_service.h" | |
8 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
9 #include "chrome/browser/profiles/profile_io_data.h" | 8 #include "chrome/browser/profiles/profile_io_data.h" |
10 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "components/prefs/pref_service.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 | 12 |
13 using content::BrowserThread; | 13 using content::BrowserThread; |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 std::string CreateSalt() { | 17 std::string CreateSalt() { |
18 std::string salt; | 18 std::string salt; |
19 base::Base64Encode(base::RandBytesAsString(16), &salt); | 19 base::Base64Encode(base::RandBytesAsString(16), &salt); |
20 DCHECK(!salt.empty()); | 20 DCHECK(!salt.empty()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 void MediaDeviceIDSalt::RegisterProfilePrefs( | 59 void MediaDeviceIDSalt::RegisterProfilePrefs( |
60 user_prefs::PrefRegistrySyncable* registry) { | 60 user_prefs::PrefRegistrySyncable* registry) { |
61 registry->RegisterStringPref(prefs::kMediaDeviceIdSalt, std::string()); | 61 registry->RegisterStringPref(prefs::kMediaDeviceIdSalt, std::string()); |
62 } | 62 } |
63 | 63 |
64 void MediaDeviceIDSalt::Reset(PrefService* pref_service) { | 64 void MediaDeviceIDSalt::Reset(PrefService* pref_service) { |
65 pref_service->SetString(prefs::kMediaDeviceIdSalt, | 65 pref_service->SetString(prefs::kMediaDeviceIdSalt, |
66 CreateSalt()); | 66 CreateSalt()); |
67 } | 67 } |
OLD | NEW |