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

Side by Side Diff: chromeos/cryptohome/system_salt_getter.cc

Issue 39443002: settings: Add async system salt retrieval logic in DeviceOAuth2TokenServiceFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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
« no previous file with comments | « chromeos/cryptohome/system_salt_getter.h ('k') | chromeos/dbus/fake_cryptohome_client.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/cryptohome/system_salt_getter.h" 5 #include "chromeos/cryptohome/system_salt_getter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 20 matching lines...) Expand all
31 base::Bind(&SystemSaltGetter::GetSystemSaltInternal, 31 base::Bind(&SystemSaltGetter::GetSystemSaltInternal,
32 weak_ptr_factory_.GetWeakPtr(), 32 weak_ptr_factory_.GetWeakPtr(),
33 callback)); 33 callback));
34 } 34 }
35 35
36 std::string SystemSaltGetter::GetSystemSaltSync() { 36 std::string SystemSaltGetter::GetSystemSaltSync() {
37 LoadSystemSalt(); // no-op if it's already loaded. 37 LoadSystemSalt(); // no-op if it's already loaded.
38 return system_salt_; 38 return system_salt_;
39 } 39 }
40 40
41 std::string SystemSaltGetter::GetCachedSystemSalt() {
42 return system_salt_;
43 }
44
45 void SystemSaltGetter::GetSystemSaltInternal( 41 void SystemSaltGetter::GetSystemSaltInternal(
46 const GetSystemSaltCallback& callback, 42 const GetSystemSaltCallback& callback,
47 bool service_is_available) { 43 bool service_is_available) {
48 LOG_IF(ERROR, !service_is_available) << "WaitForServiceToBeAvailable failed."; 44 LOG_IF(ERROR, !service_is_available) << "WaitForServiceToBeAvailable failed.";
49 // TODO(hashimoto): Stop using GetSystemSaltSync(). crbug.com/141009 45 // TODO(hashimoto): Stop using GetSystemSaltSync(). crbug.com/141009
50 callback.Run(GetSystemSaltSync()); 46 callback.Run(GetSystemSaltSync());
51 } 47 }
52 48
53 void SystemSaltGetter::LoadSystemSalt() { 49 void SystemSaltGetter::LoadSystemSalt() {
54 if (!system_salt_.empty()) 50 if (!system_salt_.empty())
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 84 }
89 85
90 // static 86 // static
91 std::string SystemSaltGetter::ConvertRawSaltToHexString( 87 std::string SystemSaltGetter::ConvertRawSaltToHexString(
92 const std::vector<uint8>& salt) { 88 const std::vector<uint8>& salt) {
93 return StringToLowerASCII(base::HexEncode( 89 return StringToLowerASCII(base::HexEncode(
94 reinterpret_cast<const void*>(salt.data()), salt.size())); 90 reinterpret_cast<const void*>(salt.data()), salt.size()));
95 } 91 }
96 92
97 } // namespace chromeos 93 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/cryptohome/system_salt_getter.h ('k') | chromeos/dbus/fake_cryptohome_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698