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

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

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_http_user_agent_settings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 7 #include "base/prefs/pref_service.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "chrome/browser/profiles/profile_io_data.h" 9 #include "chrome/browser/profiles/profile_io_data.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 18 matching lines...) Expand all
29 29
30 if (incognito) { 30 if (incognito) {
31 incognito_salt_ = CreateSalt(); 31 incognito_salt_ = CreateSalt();
32 return; 32 return;
33 } 33 }
34 34
35 media_device_id_salt_.Init(prefs::kMediaDeviceIdSalt, pref_service); 35 media_device_id_salt_.Init(prefs::kMediaDeviceIdSalt, pref_service);
36 if (media_device_id_salt_.GetValue().empty()) 36 if (media_device_id_salt_.GetValue().empty())
37 media_device_id_salt_.SetValue(CreateSalt()); 37 media_device_id_salt_.SetValue(CreateSalt());
38 38
39 media_device_id_salt_.MoveToThread( 39 media_device_id_salt_.UseAlternateTaskRunner(
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
41 } 41 }
42 42
43 MediaDeviceIDSalt::~MediaDeviceIDSalt() { 43 MediaDeviceIDSalt::~MediaDeviceIDSalt() {
44 } 44 }
45 45
46 void MediaDeviceIDSalt::ShutdownOnUIThread() { 46 void MediaDeviceIDSalt::ShutdownOnUIThread() {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
48 if (incognito_salt_.empty()) 48 if (incognito_salt_.empty())
49 media_device_id_salt_.Destroy(); 49 media_device_id_salt_.Destroy();
(...skipping 11 matching lines...) Expand all
61 registry->RegisterStringPref( 61 registry->RegisterStringPref(
62 prefs::kMediaDeviceIdSalt, 62 prefs::kMediaDeviceIdSalt,
63 std::string(), 63 std::string(),
64 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 64 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
65 } 65 }
66 66
67 void MediaDeviceIDSalt::Reset(PrefService* pref_service) { 67 void MediaDeviceIDSalt::Reset(PrefService* pref_service) {
68 pref_service->SetString(prefs::kMediaDeviceIdSalt, 68 pref_service->SetString(prefs::kMediaDeviceIdSalt,
69 CreateSalt()); 69 CreateSalt());
70 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/chrome_http_user_agent_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698