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

Side by Side Diff: chrome/browser/extensions/api/music_manager_private/device_id_chromeos.cc

Issue 23903051: Eliminate CHECK from CryptohomeLibrary::LoadSystemSalt (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Access WeakPtr from UI thread only Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
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 4
5 #include "chrome/browser/extensions/api/music_manager_private/device_id.h" 5 #include "chrome/browser/extensions/api/music_manager_private/device_id.h"
6 6
7 #include "base/message_loop/message_loop.h"
7 #include "chromeos/cryptohome/cryptohome_library.h" 8 #include "chromeos/cryptohome/cryptohome_library.h"
8 9
9 namespace extensions { 10 namespace extensions {
10 namespace api { 11 namespace api {
11 12
12 // ChromeOS: Use the System Salt. 13 // ChromeOS: Use the System Salt.
13 /* static */ 14 /* static */
14 void DeviceId::GetMachineId(const IdCallback& callback) { 15 void DeviceId::GetMachineId(const IdCallback& callback) {
15 chromeos::CryptohomeLibrary* c_home = chromeos::CryptohomeLibrary::Get(); 16 chromeos::CryptohomeLibrary* c_home = chromeos::CryptohomeLibrary::Get();
16 std::string result = c_home->GetSystemSalt(); 17 std::string result = c_home->GetSystemSalt();
18 if (result.empty()) {
19 // cryptohome must not be running; re-request after a delay.
20 const int64 kRequestStstemSaltDelayMs = 500;
hashimoto 2013/09/18 05:53:19 nit: s/Ststem/System/?
stevenjb 2013/09/18 19:23:36 Done.
21 base::MessageLoop::current()->PostDelayedTask(
22 FROM_HERE,
23 base::Bind(&DeviceId::GetMachineId, callback),
24 base::TimeDelta::FromMilliseconds(kRequestStstemSaltDelayMs));
25 return;
26 }
17 callback.Run(result); 27 callback.Run(result);
18 } 28 }
19 29
20 } // namespace api 30 } // namespace api
21 } // namespace extensions 31 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698