| OLD | NEW |
| 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/settings/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
| 6 | 6 |
| 7 #include <memory.h> | 7 #include <memory.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 676 |
| 677 UpdateValuesCache(policy_data, device_settings_, trusted_status_); | 677 UpdateValuesCache(policy_data, device_settings_, trusted_status_); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void DeviceSettingsProvider::UpdateValuesCache( | 680 void DeviceSettingsProvider::UpdateValuesCache( |
| 681 const em::PolicyData& policy_data, | 681 const em::PolicyData& policy_data, |
| 682 const em::ChromeDeviceSettingsProto& settings, | 682 const em::ChromeDeviceSettingsProto& settings, |
| 683 TrustedStatus trusted_status) { | 683 TrustedStatus trusted_status) { |
| 684 PrefValueMap new_values_cache; | 684 PrefValueMap new_values_cache; |
| 685 | 685 |
| 686 // If the device is not managed, or is consumer-managed, we set the device | 686 // If the device is not managed, we set the device owner value. |
| 687 // owner value. | 687 if (policy_data.has_username() && !policy_data.has_request_token()) |
| 688 if (policy_data.has_username() && | |
| 689 (policy::GetManagementMode(policy_data) == | |
| 690 policy::MANAGEMENT_MODE_LOCAL_OWNER || | |
| 691 policy::GetManagementMode(policy_data) == | |
| 692 policy::MANAGEMENT_MODE_CONSUMER_MANAGED)) { | |
| 693 new_values_cache.SetString(kDeviceOwner, policy_data.username()); | 688 new_values_cache.SetString(kDeviceOwner, policy_data.username()); |
| 694 } | |
| 695 | 689 |
| 696 if (policy_data.has_service_account_identity()) { | 690 if (policy_data.has_service_account_identity()) { |
| 697 new_values_cache.SetString(kServiceAccountIdentity, | 691 new_values_cache.SetString(kServiceAccountIdentity, |
| 698 policy_data.service_account_identity()); | 692 policy_data.service_account_identity()); |
| 699 } | 693 } |
| 700 | 694 |
| 701 DecodeLoginPolicies(settings, &new_values_cache); | 695 DecodeLoginPolicies(settings, &new_values_cache); |
| 702 DecodeNetworkPolicies(settings, &new_values_cache); | 696 DecodeNetworkPolicies(settings, &new_values_cache); |
| 703 DecodeAutoUpdatePolicies(settings, &new_values_cache); | 697 DecodeAutoUpdatePolicies(settings, &new_values_cache); |
| 704 DecodeReportingPolicies(settings, &new_values_cache); | 698 DecodeReportingPolicies(settings, &new_values_cache); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 // Notify the observers we are done. | 841 // Notify the observers we are done. |
| 848 std::vector<base::Closure> callbacks; | 842 std::vector<base::Closure> callbacks; |
| 849 callbacks.swap(callbacks_); | 843 callbacks.swap(callbacks_); |
| 850 for (size_t i = 0; i < callbacks.size(); ++i) | 844 for (size_t i = 0; i < callbacks.size(); ++i) |
| 851 callbacks[i].Run(); | 845 callbacks[i].Run(); |
| 852 | 846 |
| 853 return settings_loaded; | 847 return settings_loaded; |
| 854 } | 848 } |
| 855 | 849 |
| 856 } // namespace chromeos | 850 } // namespace chromeos |
| OLD | NEW |