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

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

Issue 2902183002: Improve determination of managed state in DeviceSettingsProvider (Closed)
Patch Set: Minor improvements 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
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..7d10f3173006cc424ece9afd2b58821cda65257e 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 unmanaged. See PolicyData::management_mode
ljusten (tachyonic) 2017/05/29 12:43:01 Nit: Remove one space. I don't think it's common t
Thiemo Nagel 2017/05/29 15:07:16 Agreed. There is some usage across the codebase,
ljusten (tachyonic) 2017/05/30 08:55:10 Aaaarggghhhh!
Thiemo Nagel 2017/05/30 12:25:06 Acknowledged.
+ // docs for details.
+ bool unmanaged = false;
ljusten (tachyonic) 2017/05/29 12:43:01 Nit: Split this off into a separate IsEnterpriseMa
Thiemo Nagel 2017/05/29 15:07:16 Which other code would that match? I don't think
ljusten (tachyonic) 2017/05/30 08:55:10 CL:518045/CL:506159 for instance. Granted, not the
Thiemo Nagel 2017/05/30 12:25:06 Done.
+ if (policy_data.has_management_mode()) {
+ if (policy_data.management_mode() != em::PolicyData::ENTERPRISE_MANAGED)
+ unmanaged = true;
+ } else if (!policy_data.has_request_token()) {
+ unmanaged = true;
+ }
+
// 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() && unmanaged)
new_values_cache.SetString(kDeviceOwner, policy_data.username());
if (policy_data.has_service_account_identity()) {

Powered by Google App Engine
This is Rietveld 408576698