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

Side by Side Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 years, 9 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/ownership/owner_settings_service_chromeos.h" 5 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
6 6
7 #include <keyhi.h> 7 #include <keyhi.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } else if (path == kAccountsPrefDeviceLocalAccounts) { 454 } else if (path == kAccountsPrefDeviceLocalAccounts) {
455 em::DeviceLocalAccountsProto* device_local_accounts = 455 em::DeviceLocalAccountsProto* device_local_accounts =
456 settings.mutable_device_local_accounts(); 456 settings.mutable_device_local_accounts();
457 device_local_accounts->clear_account(); 457 device_local_accounts->clear_account();
458 const base::ListValue* accounts_list = NULL; 458 const base::ListValue* accounts_list = NULL;
459 if (value.GetAsList(&accounts_list)) { 459 if (value.GetAsList(&accounts_list)) {
460 for (base::ListValue::const_iterator entry(accounts_list->begin()); 460 for (base::ListValue::const_iterator entry(accounts_list->begin());
461 entry != accounts_list->end(); 461 entry != accounts_list->end();
462 ++entry) { 462 ++entry) {
463 const base::DictionaryValue* entry_dict = NULL; 463 const base::DictionaryValue* entry_dict = NULL;
464 if ((*entry)->GetAsDictionary(&entry_dict)) { 464 if (entry->GetAsDictionary(&entry_dict)) {
465 em::DeviceLocalAccountInfoProto* account = 465 em::DeviceLocalAccountInfoProto* account =
466 device_local_accounts->add_account(); 466 device_local_accounts->add_account();
467 std::string account_id; 467 std::string account_id;
468 if (entry_dict->GetStringWithoutPathExpansion( 468 if (entry_dict->GetStringWithoutPathExpansion(
469 kAccountsPrefDeviceLocalAccountsKeyId, &account_id)) { 469 kAccountsPrefDeviceLocalAccountsKeyId, &account_id)) {
470 account->set_account_id(account_id); 470 account->set_account_id(account_id);
471 } 471 }
472 int type; 472 int type;
473 if (entry_dict->GetIntegerWithoutPathExpansion( 473 if (entry_dict->GetIntegerWithoutPathExpansion(
474 kAccountsPrefDeviceLocalAccountsKeyType, &type)) { 474 kAccountsPrefDeviceLocalAccountsKeyType, &type)) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 NOTREACHED(); 552 NOTREACHED();
553 } else if (path == kAccountsPrefUsers) { 553 } else if (path == kAccountsPrefUsers) {
554 em::UserWhitelistProto* whitelist_proto = settings.mutable_user_whitelist(); 554 em::UserWhitelistProto* whitelist_proto = settings.mutable_user_whitelist();
555 whitelist_proto->clear_user_whitelist(); 555 whitelist_proto->clear_user_whitelist();
556 const base::ListValue* users; 556 const base::ListValue* users;
557 if (value.GetAsList(&users)) { 557 if (value.GetAsList(&users)) {
558 for (base::ListValue::const_iterator i = users->begin(); 558 for (base::ListValue::const_iterator i = users->begin();
559 i != users->end(); 559 i != users->end();
560 ++i) { 560 ++i) {
561 std::string email; 561 std::string email;
562 if ((*i)->GetAsString(&email)) 562 if (i->GetAsString(&email))
563 whitelist_proto->add_user_whitelist(email); 563 whitelist_proto->add_user_whitelist(email);
564 } 564 }
565 } 565 }
566 } else if (path == kAccountsPrefEphemeralUsersEnabled) { 566 } else if (path == kAccountsPrefEphemeralUsersEnabled) {
567 em::EphemeralUsersEnabledProto* ephemeral_users_enabled = 567 em::EphemeralUsersEnabledProto* ephemeral_users_enabled =
568 settings.mutable_ephemeral_users_enabled(); 568 settings.mutable_ephemeral_users_enabled();
569 bool ephemeral_users_enabled_value = false; 569 bool ephemeral_users_enabled_value = false;
570 if (value.GetAsBoolean(&ephemeral_users_enabled_value)) { 570 if (value.GetAsBoolean(&ephemeral_users_enabled_value)) {
571 ephemeral_users_enabled->set_ephemeral_users_enabled( 571 ephemeral_users_enabled->set_ephemeral_users_enabled(
572 ephemeral_users_enabled_value); 572 ephemeral_users_enabled_value);
(...skipping 11 matching lines...) Expand all
584 } 584 }
585 } else if (path == kStartUpFlags) { 585 } else if (path == kStartUpFlags) {
586 em::StartUpFlagsProto* flags_proto = settings.mutable_start_up_flags(); 586 em::StartUpFlagsProto* flags_proto = settings.mutable_start_up_flags();
587 flags_proto->Clear(); 587 flags_proto->Clear();
588 const base::ListValue* flags; 588 const base::ListValue* flags;
589 if (value.GetAsList(&flags)) { 589 if (value.GetAsList(&flags)) {
590 for (base::ListValue::const_iterator i = flags->begin(); 590 for (base::ListValue::const_iterator i = flags->begin();
591 i != flags->end(); 591 i != flags->end();
592 ++i) { 592 ++i) {
593 std::string flag; 593 std::string flag;
594 if ((*i)->GetAsString(&flag)) 594 if (i->GetAsString(&flag))
595 flags_proto->add_flags(flag); 595 flags_proto->add_flags(flag);
596 } 596 }
597 } 597 }
598 } else if (path == kSystemUse24HourClock) { 598 } else if (path == kSystemUse24HourClock) {
599 em::SystemUse24HourClockProto* use_24hour_clock_proto = 599 em::SystemUse24HourClockProto* use_24hour_clock_proto =
600 settings.mutable_use_24hour_clock(); 600 settings.mutable_use_24hour_clock();
601 use_24hour_clock_proto->Clear(); 601 use_24hour_clock_proto->Clear();
602 bool use_24hour_clock_value; 602 bool use_24hour_clock_value;
603 if (value.GetAsBoolean(&use_24hour_clock_value)) { 603 if (value.GetAsBoolean(&use_24hour_clock_value)) {
604 use_24hour_clock_proto->set_use_24hour_clock(use_24hour_clock_value); 604 use_24hour_clock_proto->set_use_24hour_clock(use_24hour_clock_value);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( 730 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring(
731 bool success) { 731 bool success) {
732 store_settings_factory_.InvalidateWeakPtrs(); 732 store_settings_factory_.InvalidateWeakPtrs();
733 for (auto& observer : observers_) 733 for (auto& observer : observers_)
734 observer.OnSignedPolicyStored(success); 734 observer.OnSignedPolicyStored(success);
735 StorePendingChanges(); 735 StorePendingChanges();
736 } 736 }
737 737
738 } // namespace chromeos 738 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698