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

Side by Side Diff: chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.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 (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 "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h " 5 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h "
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 PrefValueMap* prefs) { 321 PrefValueMap* prefs) {
322 PolicyErrorMap errors; 322 PolicyErrorMap errors;
323 const base::Value* policy_value = policies.GetValue(policy_name()); 323 const base::Value* policy_value = policies.GetValue(policy_name());
324 const base::ListValue* policy_list = NULL; 324 const base::ListValue* policy_list = NULL;
325 if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) { 325 if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) {
326 std::unique_ptr<base::ListValue> pinned_apps_list(new base::ListValue()); 326 std::unique_ptr<base::ListValue> pinned_apps_list(new base::ListValue());
327 for (base::ListValue::const_iterator entry(policy_list->begin()); 327 for (base::ListValue::const_iterator entry(policy_list->begin());
328 entry != policy_list->end(); ++entry) { 328 entry != policy_list->end(); ++entry) {
329 std::string id; 329 std::string id;
330 if ((*entry)->GetAsString(&id)) { 330 if ((*entry)->GetAsString(&id)) {
331 base::DictionaryValue* app_dict = new base::DictionaryValue(); 331 auto app_dict = base::MakeUnique<base::DictionaryValue>();
332 app_dict->SetString(ash::launcher::kPinnedAppsPrefAppIDPath, id); 332 app_dict->SetString(ash::launcher::kPinnedAppsPrefAppIDPath, id);
333 pinned_apps_list->Append(app_dict); 333 pinned_apps_list->Append(std::move(app_dict));
334 } 334 }
335 } 335 }
336 prefs->SetValue(pref_path(), std::move(pinned_apps_list)); 336 prefs->SetValue(pref_path(), std::move(pinned_apps_list));
337 } 337 }
338 } 338 }
339 339
340 ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler() 340 ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler()
341 : IntRangePolicyHandlerBase(key::kScreenMagnifierType, 341 : IntRangePolicyHandlerBase(key::kScreenMagnifierType,
342 0, 342 0,
343 ash::MAGNIFIER_FULL, 343 ash::MAGNIFIER_FULL,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 value = GetValue(dict, kScreenLockDelayAC); 480 value = GetValue(dict, kScreenLockDelayAC);
481 if (value) 481 if (value)
482 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value)); 482 prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, std::move(value));
483 value = GetValue(dict, kScreenLockDelayBattery); 483 value = GetValue(dict, kScreenLockDelayBattery);
484 if (value) 484 if (value)
485 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value)); 485 prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, std::move(value));
486 } 486 }
487 487
488 } // namespace policy 488 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698