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

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

Issue 228553002: Preference dis/allowing supervised users creation is now available as owner setting, not only as de… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Default enable-supervised logic fixed. Duplicated subscriptions removed. Created 6 years, 8 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 | Annotate | Revision Log
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 else 208 else
209 NOTREACHED(); 209 NOTREACHED();
210 } else if (prop == kAccountsPrefAllowGuest) { 210 } else if (prop == kAccountsPrefAllowGuest) {
211 em::GuestModeEnabledProto* guest = 211 em::GuestModeEnabledProto* guest =
212 device_settings_.mutable_guest_mode_enabled(); 212 device_settings_.mutable_guest_mode_enabled();
213 bool guest_value; 213 bool guest_value;
214 if (value->GetAsBoolean(&guest_value)) 214 if (value->GetAsBoolean(&guest_value))
215 guest->set_guest_mode_enabled(guest_value); 215 guest->set_guest_mode_enabled(guest_value);
216 else 216 else
217 NOTREACHED(); 217 NOTREACHED();
218 } else if (prop == kAccountsPrefSupervisedUsersEnabled) {
219 em::SupervisedUsersSettingsProto* supervised =
220 device_settings_.mutable_supervised_users_settings();
221 bool supervised_value;
222 if (value->GetAsBoolean(&supervised_value))
223 supervised->set_supervised_users_enabled(supervised_value);
224 else
225 NOTREACHED();
218 } else if (prop == kAccountsPrefShowUserNamesOnSignIn) { 226 } else if (prop == kAccountsPrefShowUserNamesOnSignIn) {
219 em::ShowUserNamesOnSigninProto* show = 227 em::ShowUserNamesOnSigninProto* show =
220 device_settings_.mutable_show_user_names(); 228 device_settings_.mutable_show_user_names();
221 bool show_value; 229 bool show_value;
222 if (value->GetAsBoolean(&show_value)) 230 if (value->GetAsBoolean(&show_value))
223 show->set_show_user_names(show_value); 231 show->set_show_user_names(show_value);
224 else 232 else
225 NOTREACHED(); 233 NOTREACHED();
226 } else if (prop == kAccountsPrefDeviceLocalAccounts) { 234 } else if (prop == kAccountsPrefDeviceLocalAccounts) {
227 em::DeviceLocalAccountsProto* device_local_accounts = 235 em::DeviceLocalAccountsProto* device_local_accounts =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 device_settings_.mutable_attestation_settings(); 387 device_settings_.mutable_attestation_settings();
380 bool setting_enabled; 388 bool setting_enabled;
381 if (value->GetAsBoolean(&setting_enabled)) { 389 if (value->GetAsBoolean(&setting_enabled)) {
382 attestation_settings->set_content_protection_enabled(setting_enabled); 390 attestation_settings->set_content_protection_enabled(setting_enabled);
383 } else { 391 } else {
384 NOTREACHED(); 392 NOTREACHED();
385 } 393 }
386 } else { 394 } else {
387 // The remaining settings don't support Set(), since they are not 395 // The remaining settings don't support Set(), since they are not
388 // intended to be customizable by the user: 396 // intended to be customizable by the user:
389 // kAccountsPrefSupervisedUsersEnabled
390 // kAppPack 397 // kAppPack
391 // kDeviceAttestationEnabled 398 // kDeviceAttestationEnabled
392 // kDeviceOwner 399 // kDeviceOwner
393 // kIdleLogoutTimeout 400 // kIdleLogoutTimeout
394 // kIdleLogoutWarningDuration 401 // kIdleLogoutWarningDuration
395 // kReleaseChannelDelegated 402 // kReleaseChannelDelegated
396 // kReportDeviceActivityTimes 403 // kReportDeviceActivityTimes
397 // kReportDeviceBootMode 404 // kReportDeviceBootMode
398 // kReportDeviceLocation 405 // kReportDeviceLocation
399 // kReportDeviceVersionInfo 406 // kReportDeviceVersionInfo
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 policy.user_whitelist().user_whitelist_size() == 0); 460 policy.user_whitelist().user_whitelist_size() == 0);
454 } 461 }
455 462
456 new_values_cache->SetBoolean( 463 new_values_cache->SetBoolean(
457 kAccountsPrefAllowGuest, 464 kAccountsPrefAllowGuest,
458 !policy.has_guest_mode_enabled() || 465 !policy.has_guest_mode_enabled() ||
459 !policy.guest_mode_enabled().has_guest_mode_enabled() || 466 !policy.guest_mode_enabled().has_guest_mode_enabled() ||
460 policy.guest_mode_enabled().guest_mode_enabled()); 467 policy.guest_mode_enabled().guest_mode_enabled());
461 468
462 new_values_cache->SetBoolean( 469 new_values_cache->SetBoolean(
470 kAccountsPrefSupervisedUsersEnabled,
Nikita (slow) 2014/04/14 11:48:59 As discussed, please set different defaults here:
merkulova 2014/04/14 12:14:47 Done.
471 !policy.has_supervised_users_settings() ||
472 !policy.supervised_users_settings().has_supervised_users_enabled() ||
473 policy.supervised_users_settings().supervised_users_enabled());
474
475 new_values_cache->SetBoolean(
463 kAccountsPrefShowUserNamesOnSignIn, 476 kAccountsPrefShowUserNamesOnSignIn,
464 !policy.has_show_user_names() || 477 !policy.has_show_user_names() ||
465 !policy.show_user_names().has_show_user_names() || 478 !policy.show_user_names().has_show_user_names() ||
466 policy.show_user_names().show_user_names()); 479 policy.show_user_names().show_user_names());
467 480
468 new_values_cache->SetBoolean( 481 new_values_cache->SetBoolean(
469 kAccountsPrefEphemeralUsersEnabled, 482 kAccountsPrefEphemeralUsersEnabled,
470 policy.has_ephemeral_users_enabled() && 483 policy.has_ephemeral_users_enabled() &&
471 policy.ephemeral_users_enabled().has_ephemeral_users_enabled() && 484 policy.ephemeral_users_enabled().has_ephemeral_users_enabled() &&
472 policy.ephemeral_users_enabled().ephemeral_users_enabled()); 485 policy.ephemeral_users_enabled().ephemeral_users_enabled());
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 void DeviceSettingsProvider::AttemptMigration() { 985 void DeviceSettingsProvider::AttemptMigration() {
973 if (device_settings_service_->HasPrivateOwnerKey()) { 986 if (device_settings_service_->HasPrivateOwnerKey()) {
974 PrefValueMap::const_iterator i; 987 PrefValueMap::const_iterator i;
975 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 988 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
976 DoSet(i->first, *i->second); 989 DoSet(i->first, *i->second);
977 migration_values_.Clear(); 990 migration_values_.Clear();
978 } 991 }
979 } 992 }
980 993
981 } // namespace chromeos 994 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698