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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 2902183002: Improve determination of managed state in DeviceSettingsProvider (Closed)
Patch Set: Addressed comments Created 3 years, 6 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
« no previous file with comments | « no previous file | components/policy/proto/device_management_backend.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 UpdateValuesCache(policy_data, device_settings_, trusted_status_); 736 UpdateValuesCache(policy_data, device_settings_, trusted_status_);
737 } 737 }
738 738
739 void DeviceSettingsProvider::UpdateValuesCache( 739 void DeviceSettingsProvider::UpdateValuesCache(
740 const em::PolicyData& policy_data, 740 const em::PolicyData& policy_data,
741 const em::ChromeDeviceSettingsProto& settings, 741 const em::ChromeDeviceSettingsProto& settings,
742 TrustedStatus trusted_status) { 742 TrustedStatus trusted_status) {
743 PrefValueMap new_values_cache; 743 PrefValueMap new_values_cache;
744 744
745 // Determine whether device is unmanaged. See PolicyData::management_mode
746 // docs for details.
747 bool unmanaged = false;
Roman Sorokin (ftl) 2017/05/29 16:19:53 why not "managed = true" ? Negative name is confu
Thiemo Nagel 2017/05/30 12:25:07 Done.
748 if (policy_data.has_management_mode()) {
749 if (policy_data.management_mode() != em::PolicyData::ENTERPRISE_MANAGED)
750 unmanaged = true;
751 } else if (!policy_data.has_request_token()) {
752 unmanaged = true;
753 }
754
745 // If the device is not managed, we set the device owner value. 755 // If the device is not managed, we set the device owner value.
746 if (policy_data.has_username() && !policy_data.has_request_token()) 756 if (policy_data.has_username() && unmanaged)
747 new_values_cache.SetString(kDeviceOwner, policy_data.username()); 757 new_values_cache.SetString(kDeviceOwner, policy_data.username());
748 758
749 if (policy_data.has_service_account_identity()) { 759 if (policy_data.has_service_account_identity()) {
750 new_values_cache.SetString(kServiceAccountIdentity, 760 new_values_cache.SetString(kServiceAccountIdentity,
751 policy_data.service_account_identity()); 761 policy_data.service_account_identity());
752 } 762 }
753 763
754 DecodeLoginPolicies(settings, &new_values_cache); 764 DecodeLoginPolicies(settings, &new_values_cache);
755 DecodeNetworkPolicies(settings, &new_values_cache); 765 DecodeNetworkPolicies(settings, &new_values_cache);
756 DecodeAutoUpdatePolicies(settings, &new_values_cache); 766 DecodeAutoUpdatePolicies(settings, &new_values_cache);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 // Notify the observers we are done. 910 // Notify the observers we are done.
901 std::vector<base::Closure> callbacks; 911 std::vector<base::Closure> callbacks;
902 callbacks.swap(callbacks_); 912 callbacks.swap(callbacks_);
903 for (size_t i = 0; i < callbacks.size(); ++i) 913 for (size_t i = 0; i < callbacks.size(); ++i)
904 callbacks[i].Run(); 914 callbacks[i].Run();
905 915
906 return settings_loaded; 916 return settings_loaded;
907 } 917 }
908 918
909 } // namespace chromeos 919 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | components/policy/proto/device_management_backend.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698