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

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

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 kAccountsPrefDeviceLocalAccountAutoLoginDelay, 46 kAccountsPrefDeviceLocalAccountAutoLoginDelay,
47 kAccountsPrefDeviceLocalAccountAutoLoginId, 47 kAccountsPrefDeviceLocalAccountAutoLoginId,
48 kAccountsPrefDeviceLocalAccountPromptForNetworkWhenOffline, 48 kAccountsPrefDeviceLocalAccountPromptForNetworkWhenOffline,
49 kAccountsPrefEphemeralUsersEnabled, 49 kAccountsPrefEphemeralUsersEnabled,
50 kAccountsPrefShowUserNamesOnSignIn, 50 kAccountsPrefShowUserNamesOnSignIn,
51 kAccountsPrefSupervisedUsersEnabled, 51 kAccountsPrefSupervisedUsersEnabled,
52 kAccountsPrefTransferSAMLCookies, 52 kAccountsPrefTransferSAMLCookies,
53 kAccountsPrefUsers, 53 kAccountsPrefUsers,
54 kAllowRedeemChromeOsRegistrationOffers, 54 kAllowRedeemChromeOsRegistrationOffers,
55 kAllowedConnectionTypesForUpdate, 55 kAllowedConnectionTypesForUpdate,
56 kAppPack,
57 kAttestationForContentProtectionEnabled, 56 kAttestationForContentProtectionEnabled,
58 kDeviceAttestationEnabled, 57 kDeviceAttestationEnabled,
59 kDeviceOwner, 58 kDeviceOwner,
60 kIdleLogoutTimeout,
61 kIdleLogoutWarningDuration,
62 kPolicyMissingMitigationMode, 59 kPolicyMissingMitigationMode,
63 kReleaseChannel, 60 kReleaseChannel,
64 kReleaseChannelDelegated, 61 kReleaseChannelDelegated,
65 kReportDeviceActivityTimes, 62 kReportDeviceActivityTimes,
66 kReportDeviceBootMode, 63 kReportDeviceBootMode,
67 kReportDeviceLocation, 64 kReportDeviceLocation,
68 kReportDeviceNetworkInterfaces, 65 kReportDeviceNetworkInterfaces,
69 kReportDeviceUsers, 66 kReportDeviceUsers,
70 kReportDeviceHardwareStatus, 67 kReportDeviceHardwareStatus,
71 kReportDeviceVersionInfo, 68 kReportDeviceVersionInfo,
72 kScreenSaverExtensionId,
73 kScreenSaverTimeout,
74 kServiceAccountIdentity, 69 kServiceAccountIdentity,
75 kSignedDataRoamingEnabled, 70 kSignedDataRoamingEnabled,
76 kStartUpFlags, 71 kStartUpFlags,
77 kStartUpUrls,
78 kStatsReportingPref, 72 kStatsReportingPref,
79 kSystemTimezonePolicy, 73 kSystemTimezonePolicy,
80 kSystemUse24HourClock, 74 kSystemUse24HourClock,
81 kUpdateDisabled, 75 kUpdateDisabled,
82 kVariationsRestrictParameter, 76 kVariationsRestrictParameter,
83 kDeviceDisabled, 77 kDeviceDisabled,
84 kDeviceDisabledMessage, 78 kDeviceDisabledMessage,
85 kRebootOnShutdown, 79 kRebootOnShutdown,
86 }; 80 };
87 81
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 new_values_cache->SetValue(kStartUpFlags, list); 236 new_values_cache->SetValue(kStartUpFlags, list);
243 } 237 }
244 238
245 if (policy.has_saml_settings()) { 239 if (policy.has_saml_settings()) {
246 new_values_cache->SetBoolean( 240 new_values_cache->SetBoolean(
247 kAccountsPrefTransferSAMLCookies, 241 kAccountsPrefTransferSAMLCookies,
248 policy.saml_settings().transfer_saml_cookies()); 242 policy.saml_settings().transfer_saml_cookies());
249 } 243 }
250 } 244 }
251 245
252 void DecodeKioskPolicies(
253 const em::ChromeDeviceSettingsProto& policy,
254 PrefValueMap* new_values_cache) {
255 if (policy.has_forced_logout_timeouts()) {
256 if (policy.forced_logout_timeouts().has_idle_logout_timeout()) {
257 new_values_cache->SetInteger(
258 kIdleLogoutTimeout,
259 policy.forced_logout_timeouts().idle_logout_timeout());
260 }
261
262 if (policy.forced_logout_timeouts().has_idle_logout_warning_duration()) {
263 new_values_cache->SetInteger(
264 kIdleLogoutWarningDuration,
265 policy.forced_logout_timeouts().idle_logout_warning_duration());
266 }
267 }
268
269 if (policy.has_login_screen_saver()) {
270 if (policy.login_screen_saver().has_screen_saver_timeout()) {
271 new_values_cache->SetInteger(
272 kScreenSaverTimeout,
273 policy.login_screen_saver().screen_saver_timeout());
274 }
275
276 if (policy.login_screen_saver().has_screen_saver_extension_id()) {
277 new_values_cache->SetString(
278 kScreenSaverExtensionId,
279 policy.login_screen_saver().screen_saver_extension_id());
280 }
281 }
282
283 if (policy.has_app_pack()) {
284 typedef RepeatedPtrField<em::AppPackEntryProto> proto_type;
285 base::ListValue* list = new base::ListValue;
286 const proto_type& app_pack = policy.app_pack().app_pack();
287 for (proto_type::const_iterator it = app_pack.begin();
288 it != app_pack.end(); ++it) {
289 base::DictionaryValue* entry = new base::DictionaryValue;
290 if (it->has_extension_id()) {
291 entry->SetStringWithoutPathExpansion(kAppPackKeyExtensionId,
292 it->extension_id());
293 }
294 if (it->has_update_url()) {
295 entry->SetStringWithoutPathExpansion(kAppPackKeyUpdateUrl,
296 it->update_url());
297 }
298 list->Append(entry);
299 }
300 new_values_cache->SetValue(kAppPack, list);
301 }
302
303 if (policy.has_start_up_urls()) {
304 base::ListValue* list = new base::ListValue();
305 const em::StartUpUrlsProto& urls_proto = policy.start_up_urls();
306 const RepeatedPtrField<std::string>& urls = urls_proto.start_up_urls();
307 for (RepeatedPtrField<std::string>::const_iterator it = urls.begin();
308 it != urls.end(); ++it) {
309 list->Append(new base::StringValue(*it));
310 }
311 new_values_cache->SetValue(kStartUpUrls, list);
312 }
313 }
314
315 void DecodeNetworkPolicies( 246 void DecodeNetworkPolicies(
316 const em::ChromeDeviceSettingsProto& policy, 247 const em::ChromeDeviceSettingsProto& policy,
317 PrefValueMap* new_values_cache) { 248 PrefValueMap* new_values_cache) {
318 // kSignedDataRoamingEnabled has a default value of false. 249 // kSignedDataRoamingEnabled has a default value of false.
319 new_values_cache->SetBoolean( 250 new_values_cache->SetBoolean(
320 kSignedDataRoamingEnabled, 251 kSignedDataRoamingEnabled,
321 policy.has_data_roaming_enabled() && 252 policy.has_data_roaming_enabled() &&
322 policy.data_roaming_enabled().has_data_roaming_enabled() && 253 policy.data_roaming_enabled().has_data_roaming_enabled() &&
323 policy.data_roaming_enabled().data_roaming_enabled()); 254 policy.data_roaming_enabled().data_roaming_enabled());
324 } 255 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 policy::MANAGEMENT_MODE_CONSUMER_MANAGED)) { 565 policy::MANAGEMENT_MODE_CONSUMER_MANAGED)) {
635 new_values_cache.SetString(kDeviceOwner, policy_data.username()); 566 new_values_cache.SetString(kDeviceOwner, policy_data.username());
636 } 567 }
637 568
638 if (policy_data.has_service_account_identity()) { 569 if (policy_data.has_service_account_identity()) {
639 new_values_cache.SetString(kServiceAccountIdentity, 570 new_values_cache.SetString(kServiceAccountIdentity,
640 policy_data.service_account_identity()); 571 policy_data.service_account_identity());
641 } 572 }
642 573
643 DecodeLoginPolicies(settings, &new_values_cache); 574 DecodeLoginPolicies(settings, &new_values_cache);
644 DecodeKioskPolicies(settings, &new_values_cache);
645 DecodeNetworkPolicies(settings, &new_values_cache); 575 DecodeNetworkPolicies(settings, &new_values_cache);
646 DecodeAutoUpdatePolicies(settings, &new_values_cache); 576 DecodeAutoUpdatePolicies(settings, &new_values_cache);
647 DecodeReportingPolicies(settings, &new_values_cache); 577 DecodeReportingPolicies(settings, &new_values_cache);
648 DecodeGenericPolicies(settings, &new_values_cache); 578 DecodeGenericPolicies(settings, &new_values_cache);
649 DecodeDeviceState(policy_data, &new_values_cache); 579 DecodeDeviceState(policy_data, &new_values_cache);
650 580
651 // Collect all notifications but send them only after we have swapped the 581 // Collect all notifications but send them only after we have swapped the
652 // cache so that if somebody actually reads the cache will be already valid. 582 // cache so that if somebody actually reads the cache will be already valid.
653 std::vector<std::string> notifications; 583 std::vector<std::string> notifications;
654 // Go through the new values and verify in the old ones. 584 // Go through the new values and verify in the old ones.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 void DeviceSettingsProvider::AttemptMigration() { 761 void DeviceSettingsProvider::AttemptMigration() {
832 if (device_settings_service_->HasPrivateOwnerKey()) { 762 if (device_settings_service_->HasPrivateOwnerKey()) {
833 PrefValueMap::const_iterator i; 763 PrefValueMap::const_iterator i;
834 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 764 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
835 DoSet(i->first, *i->second); 765 DoSet(i->first, *i->second);
836 migration_values_.Clear(); 766 migration_values_.Clear();
837 } 767 }
838 } 768 }
839 769
840 } // namespace chromeos 770 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698