OLD | NEW |
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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } else if (path == kAccountsPrefDeviceLocalAccounts) { | 467 } else if (path == kAccountsPrefDeviceLocalAccounts) { |
468 em::DeviceLocalAccountsProto* device_local_accounts = | 468 em::DeviceLocalAccountsProto* device_local_accounts = |
469 settings.mutable_device_local_accounts(); | 469 settings.mutable_device_local_accounts(); |
470 device_local_accounts->clear_account(); | 470 device_local_accounts->clear_account(); |
471 const base::ListValue* accounts_list = NULL; | 471 const base::ListValue* accounts_list = NULL; |
472 if (value.GetAsList(&accounts_list)) { | 472 if (value.GetAsList(&accounts_list)) { |
473 for (base::ListValue::const_iterator entry(accounts_list->begin()); | 473 for (base::ListValue::const_iterator entry(accounts_list->begin()); |
474 entry != accounts_list->end(); | 474 entry != accounts_list->end(); |
475 ++entry) { | 475 ++entry) { |
476 const base::DictionaryValue* entry_dict = NULL; | 476 const base::DictionaryValue* entry_dict = NULL; |
477 if ((*entry)->GetAsDictionary(&entry_dict)) { | 477 if (entry->GetAsDictionary(&entry_dict)) { |
478 em::DeviceLocalAccountInfoProto* account = | 478 em::DeviceLocalAccountInfoProto* account = |
479 device_local_accounts->add_account(); | 479 device_local_accounts->add_account(); |
480 std::string account_id; | 480 std::string account_id; |
481 if (entry_dict->GetStringWithoutPathExpansion( | 481 if (entry_dict->GetStringWithoutPathExpansion( |
482 kAccountsPrefDeviceLocalAccountsKeyId, &account_id)) { | 482 kAccountsPrefDeviceLocalAccountsKeyId, &account_id)) { |
483 account->set_account_id(account_id); | 483 account->set_account_id(account_id); |
484 } | 484 } |
485 int type; | 485 int type; |
486 if (entry_dict->GetIntegerWithoutPathExpansion( | 486 if (entry_dict->GetIntegerWithoutPathExpansion( |
487 kAccountsPrefDeviceLocalAccountsKeyType, &type)) { | 487 kAccountsPrefDeviceLocalAccountsKeyType, &type)) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 NOTREACHED(); | 565 NOTREACHED(); |
566 } else if (path == kAccountsPrefUsers) { | 566 } else if (path == kAccountsPrefUsers) { |
567 em::UserWhitelistProto* whitelist_proto = settings.mutable_user_whitelist(); | 567 em::UserWhitelistProto* whitelist_proto = settings.mutable_user_whitelist(); |
568 whitelist_proto->clear_user_whitelist(); | 568 whitelist_proto->clear_user_whitelist(); |
569 const base::ListValue* users; | 569 const base::ListValue* users; |
570 if (value.GetAsList(&users)) { | 570 if (value.GetAsList(&users)) { |
571 for (base::ListValue::const_iterator i = users->begin(); | 571 for (base::ListValue::const_iterator i = users->begin(); |
572 i != users->end(); | 572 i != users->end(); |
573 ++i) { | 573 ++i) { |
574 std::string email; | 574 std::string email; |
575 if ((*i)->GetAsString(&email)) | 575 if (i->GetAsString(&email)) |
576 whitelist_proto->add_user_whitelist(email); | 576 whitelist_proto->add_user_whitelist(email); |
577 } | 577 } |
578 } | 578 } |
579 } else if (path == kAccountsPrefEphemeralUsersEnabled) { | 579 } else if (path == kAccountsPrefEphemeralUsersEnabled) { |
580 em::EphemeralUsersEnabledProto* ephemeral_users_enabled = | 580 em::EphemeralUsersEnabledProto* ephemeral_users_enabled = |
581 settings.mutable_ephemeral_users_enabled(); | 581 settings.mutable_ephemeral_users_enabled(); |
582 bool ephemeral_users_enabled_value = false; | 582 bool ephemeral_users_enabled_value = false; |
583 if (value.GetAsBoolean(&ephemeral_users_enabled_value)) { | 583 if (value.GetAsBoolean(&ephemeral_users_enabled_value)) { |
584 ephemeral_users_enabled->set_ephemeral_users_enabled( | 584 ephemeral_users_enabled->set_ephemeral_users_enabled( |
585 ephemeral_users_enabled_value); | 585 ephemeral_users_enabled_value); |
(...skipping 11 matching lines...) Expand all Loading... |
597 } | 597 } |
598 } else if (path == kStartUpFlags) { | 598 } else if (path == kStartUpFlags) { |
599 em::StartUpFlagsProto* flags_proto = settings.mutable_start_up_flags(); | 599 em::StartUpFlagsProto* flags_proto = settings.mutable_start_up_flags(); |
600 flags_proto->Clear(); | 600 flags_proto->Clear(); |
601 const base::ListValue* flags; | 601 const base::ListValue* flags; |
602 if (value.GetAsList(&flags)) { | 602 if (value.GetAsList(&flags)) { |
603 for (base::ListValue::const_iterator i = flags->begin(); | 603 for (base::ListValue::const_iterator i = flags->begin(); |
604 i != flags->end(); | 604 i != flags->end(); |
605 ++i) { | 605 ++i) { |
606 std::string flag; | 606 std::string flag; |
607 if ((*i)->GetAsString(&flag)) | 607 if (i->GetAsString(&flag)) |
608 flags_proto->add_flags(flag); | 608 flags_proto->add_flags(flag); |
609 } | 609 } |
610 } | 610 } |
611 } else if (path == kSystemUse24HourClock) { | 611 } else if (path == kSystemUse24HourClock) { |
612 em::SystemUse24HourClockProto* use_24hour_clock_proto = | 612 em::SystemUse24HourClockProto* use_24hour_clock_proto = |
613 settings.mutable_use_24hour_clock(); | 613 settings.mutable_use_24hour_clock(); |
614 use_24hour_clock_proto->Clear(); | 614 use_24hour_clock_proto->Clear(); |
615 bool use_24hour_clock_value; | 615 bool use_24hour_clock_value; |
616 if (value.GetAsBoolean(&use_24hour_clock_value)) { | 616 if (value.GetAsBoolean(&use_24hour_clock_value)) { |
617 use_24hour_clock_proto->set_use_24hour_clock(use_24hour_clock_value); | 617 use_24hour_clock_proto->set_use_24hour_clock(use_24hour_clock_value); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 745 |
746 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( | 746 void OwnerSettingsServiceChromeOS::ReportStatusAndContinueStoring( |
747 bool success) { | 747 bool success) { |
748 store_settings_factory_.InvalidateWeakPtrs(); | 748 store_settings_factory_.InvalidateWeakPtrs(); |
749 for (auto& observer : observers_) | 749 for (auto& observer : observers_) |
750 observer.OnSignedPolicyStored(success); | 750 observer.OnSignedPolicyStored(success); |
751 StorePendingChanges(); | 751 StorePendingChanges(); |
752 } | 752 } |
753 | 753 |
754 } // namespace chromeos | 754 } // namespace chromeos |
OLD | NEW |