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

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

Issue 14329002: Chrome OS device policy for Variations Restrict Parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/command_line.h" 10 #include "base/command_line.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 kReportDeviceLocation, 60 kReportDeviceLocation,
61 kReportDeviceVersionInfo, 61 kReportDeviceVersionInfo,
62 kScreenSaverExtensionId, 62 kScreenSaverExtensionId,
63 kScreenSaverTimeout, 63 kScreenSaverTimeout,
64 kSettingProxyEverywhere, 64 kSettingProxyEverywhere,
65 kSignedDataRoamingEnabled, 65 kSignedDataRoamingEnabled,
66 kStartUpUrls, 66 kStartUpUrls,
67 kStatsReportingPref, 67 kStatsReportingPref,
68 kSystemTimezonePolicy, 68 kSystemTimezonePolicy,
69 kStartUpFlags, 69 kStartUpFlags,
70 kVariationsRestrictParameter,
70 }; 71 };
71 72
72 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. 73 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS.
73 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; 74 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences";
74 75
75 bool HasOldMetricsFile() { 76 bool HasOldMetricsFile() {
76 // TODO(pastarmovj): Remove this once migration is not needed anymore. 77 // TODO(pastarmovj): Remove this once migration is not needed anymore.
77 // If the value is not set we should try to migrate legacy consent file. 78 // If the value is not set we should try to migrate legacy consent file.
78 // Loading consent file state causes us to do blocking IO on UI thread. 79 // Loading consent file state causes us to do blocking IO on UI thread.
79 // Temporarily allow it until we fix http://crbug.com/62626 80 // Temporarily allow it until we fix http://crbug.com/62626
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // kIdleLogoutWarningDuration 346 // kIdleLogoutWarningDuration
346 // kReleaseChannelDelegated 347 // kReleaseChannelDelegated
347 // kReportDeviceVersionInfo 348 // kReportDeviceVersionInfo
348 // kReportDeviceActivityTimes 349 // kReportDeviceActivityTimes
349 // kReportDeviceBootMode 350 // kReportDeviceBootMode
350 // kReportDeviceLocation 351 // kReportDeviceLocation
351 // kScreenSaverExtensionId 352 // kScreenSaverExtensionId
352 // kScreenSaverTimeout 353 // kScreenSaverTimeout
353 // kStartUpUrls 354 // kStartUpUrls
354 // kSystemTimezonePolicy 355 // kSystemTimezonePolicy
356 // kVariationsRestrictParameter
355 357
356 LOG(FATAL) << "Device setting " << prop << " is read-only."; 358 LOG(FATAL) << "Device setting " << prop << " is read-only.";
357 } 359 }
358 360
359 em::PolicyData data; 361 em::PolicyData data;
360 data.set_username(device_settings_service_->GetUsername()); 362 data.set_username(device_settings_service_->GetUsername());
361 CHECK(device_settings_.SerializeToString(data.mutable_policy_value())); 363 CHECK(device_settings_.SerializeToString(data.mutable_policy_value()));
362 364
363 // Set the cache to the updated value. 365 // Set the cache to the updated value.
364 UpdateValuesCache(data, device_settings_, trusted_status_); 366 UpdateValuesCache(data, device_settings_, trusted_status_);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 613
612 if (policy.has_allow_redeem_offers()) { 614 if (policy.has_allow_redeem_offers()) {
613 new_values_cache->SetBoolean( 615 new_values_cache->SetBoolean(
614 kAllowRedeemChromeOsRegistrationOffers, 616 kAllowRedeemChromeOsRegistrationOffers,
615 policy.allow_redeem_offers().allow_redeem_offers()); 617 policy.allow_redeem_offers().allow_redeem_offers());
616 } else { 618 } else {
617 new_values_cache->SetBoolean( 619 new_values_cache->SetBoolean(
618 kAllowRedeemChromeOsRegistrationOffers, 620 kAllowRedeemChromeOsRegistrationOffers,
619 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged()); 621 !g_browser_process->browser_policy_connector()->IsEnterpriseManaged());
620 } 622 }
623
624 if (policy.has_variations_restrict_parameter() &&
625 policy.variations_restrict_parameter().has_parameter()) {
626 new_values_cache->SetString(
627 kVariationsRestrictParameter,
628 policy.variations_restrict_parameter().parameter());
629 } else {
630 new_values_cache->SetString(kVariationsRestrictParameter, "");
Mattias Nissler (ping if slow) 2013/04/17 17:36:50 The default value is an empty string, so you can s
Mathieu 2013/04/17 20:04:58 Done.
631 }
621 } 632 }
622 633
623 void DeviceSettingsProvider::UpdateValuesCache( 634 void DeviceSettingsProvider::UpdateValuesCache(
624 const em::PolicyData& policy_data, 635 const em::PolicyData& policy_data,
625 const em::ChromeDeviceSettingsProto& settings, 636 const em::ChromeDeviceSettingsProto& settings,
626 TrustedStatus trusted_status) { 637 TrustedStatus trusted_status) {
627 PrefValueMap new_values_cache; 638 PrefValueMap new_values_cache;
628 639
629 if (policy_data.has_username() && !policy_data.has_request_token()) 640 if (policy_data.has_username() && !policy_data.has_request_token())
630 new_values_cache.SetString(kDeviceOwner, policy_data.username()); 641 new_values_cache.SetString(kDeviceOwner, policy_data.username());
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 void DeviceSettingsProvider::AttemptMigration() { 867 void DeviceSettingsProvider::AttemptMigration() {
857 if (device_settings_service_->HasPrivateOwnerKey()) { 868 if (device_settings_service_->HasPrivateOwnerKey()) {
858 PrefValueMap::const_iterator i; 869 PrefValueMap::const_iterator i;
859 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 870 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
860 DoSet(i->first, *i->second); 871 DoSet(i->first, *i->second);
861 migration_values_.Clear(); 872 migration_values_.Clear();
862 } 873 }
863 } 874 }
864 875
865 } // namespace chromeos 876 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698