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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager. h" 15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager. h"
15 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_ factory.h" 16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_ factory.h"
16 #include "components/proximity_auth/logging/logging.h" 17 #include "components/proximity_auth/logging/logging.h"
17 #include "components/signin/core/account_id/account_id.h" 18 #include "components/signin/core/account_id/account_id.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList( 164 void EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList(
164 const AccountId& account_id, 165 const AccountId& account_id,
165 const EasyUnlockDeviceKeyDataList& data_list, 166 const EasyUnlockDeviceKeyDataList& data_list,
166 base::ListValue* device_list) { 167 base::ListValue* device_list) {
167 device_list->Clear(); 168 device_list->Clear();
168 for (size_t i = 0; i < data_list.size(); ++i) { 169 for (size_t i = 0; i < data_list.size(); ++i) {
169 std::unique_ptr<base::DictionaryValue> device_dict( 170 std::unique_ptr<base::DictionaryValue> device_dict(
170 new base::DictionaryValue); 171 new base::DictionaryValue);
171 DeviceDataToRemoteDeviceDictionary(account_id, data_list[i], 172 DeviceDataToRemoteDeviceDictionary(account_id, data_list[i],
172 device_dict.get()); 173 device_dict.get());
173 device_list->Append(device_dict.release()); 174 device_list->Append(std::move(device_dict));
174 } 175 }
175 } 176 }
176 177
177 // static 178 // static
178 bool EasyUnlockKeyManager::RemoteDeviceListToDeviceDataList( 179 bool EasyUnlockKeyManager::RemoteDeviceListToDeviceDataList(
179 const base::ListValue& device_list, 180 const base::ListValue& device_list,
180 EasyUnlockDeviceKeyDataList* data_list) { 181 EasyUnlockDeviceKeyDataList* data_list) {
181 EasyUnlockDeviceKeyDataList parsed_devices; 182 EasyUnlockDeviceKeyDataList parsed_devices;
182 for (base::ListValue::const_iterator it = device_list.begin(); 183 for (base::ListValue::const_iterator it = device_list.begin();
183 it != device_list.end(); 184 it != device_list.end();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 const EasyUnlockDeviceKeyDataList& fetched_data) { 234 const EasyUnlockDeviceKeyDataList& fetched_data) {
234 if (!callback.is_null()) 235 if (!callback.is_null())
235 callback.Run(fetch_success, fetched_data); 236 callback.Run(fetch_success, fetched_data);
236 237
237 DCHECK(pending_read_operation_); 238 DCHECK(pending_read_operation_);
238 pending_read_operation_.reset(); 239 pending_read_operation_.reset();
239 RunNextOperation(); 240 RunNextOperation();
240 } 241 }
241 242
242 } // namespace chromeos 243 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698