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

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 2902183002: Improve determination of managed state in DeviceSettingsProvider (Closed)
Patch Set: Refactor logic to make it more readable Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/policy/proto/device_management_backend.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/settings/device_settings_provider.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc
index de64b1aec1bc0c6229d10eaa525cd7fbc3351dda..6e0e106ad7c4e18b0bac19ba6d53fb4ce4ce8098 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -742,8 +742,18 @@ void DeviceSettingsProvider::UpdateValuesCache(
TrustedStatus trusted_status) {
PrefValueMap new_values_cache;
+ // Determine whether device is managed. See PolicyData::management_mode docs
+ // for details.
+ bool managed = false;
+ if (policy_data.has_management_mode()) {
+ managed =
+ (policy_data.management_mode() == em::PolicyData::ENTERPRISE_MANAGED);
+ } else {
+ managed = policy_data.has_request_token();
+ }
+
// If the device is not managed, we set the device owner value.
- if (policy_data.has_username() && !policy_data.has_request_token())
+ if (policy_data.has_username() && !managed)
new_values_cache.SetString(kDeviceOwner, policy_data.username());
if (policy_data.has_service_account_identity()) {
« 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