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

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

Issue 12728008: Revert 186837 "Move pref backing up flags from local state to de..." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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
===================================================================
--- chrome/browser/chromeos/settings/device_settings_provider.cc (revision 187881)
+++ chrome/browser/chromeos/settings/device_settings_provider.cc (working copy)
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/string_util.h"
#include "base/threading/thread_restrictions.h"
@@ -27,7 +26,6 @@
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "chrome/browser/ui/options/options_util.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
using google::protobuf::RepeatedPtrField;
@@ -65,7 +63,6 @@
kStartUpUrls,
kStatsReportingPref,
kSystemTimezonePolicy,
- kStartUpFlags,
};
// Legacy policy file location. Used to detect migration from pre v12 ChromeOS.
@@ -277,14 +274,12 @@
em::UserWhitelistProto* whitelist_proto =
device_settings_.mutable_user_whitelist();
whitelist_proto->clear_user_whitelist();
- const base::ListValue* users;
- if (value->GetAsList(&users)) {
- for (base::ListValue::const_iterator i = users->begin();
- i != users->end(); ++i) {
- std::string email;
- if ((*i)->GetAsString(&email))
- whitelist_proto->add_user_whitelist(email);
- }
+ base::ListValue& users = static_cast<base::ListValue&>(*value);
+ for (base::ListValue::const_iterator i = users.begin();
+ i != users.end(); ++i) {
+ std::string email;
+ if ((*i)->GetAsString(&email))
+ whitelist_proto->add_user_whitelist(email.c_str());
}
} else if (prop == kAccountsPrefEphemeralUsersEnabled) {
em::EphemeralUsersEnabledProto* ephemeral_users_enabled =
@@ -306,19 +301,6 @@
} else {
NOTREACHED();
}
- } else if (prop == kStartUpFlags) {
- em::StartUpFlagsProto* flags_proto =
- device_settings_.mutable_start_up_flags();
- flags_proto->Clear();
- const base::ListValue* flags;
- if (value->GetAsList(&flags)) {
- for (base::ListValue::const_iterator i = flags->begin();
- i != flags->end(); ++i) {
- std::string flag;
- if ((*i)->GetAsString(&flag))
- flags_proto->add_flags(flag);
- }
- }
} else {
// The remaining settings don't support Set(), since they are not
// intended to be customizable by the user:
@@ -424,17 +406,6 @@
}
}
new_values_cache->SetValue(kAccountsPrefDeviceLocalAccounts, account_list);
-
- if (policy.has_start_up_flags()) {
- base::ListValue* list = new base::ListValue();
- const em::StartUpFlagsProto& flags_proto = policy.start_up_flags();
- const RepeatedPtrField<std::string>& flags = flags_proto.flags();
- for (RepeatedPtrField<std::string>::const_iterator it = flags.begin();
- it != flags.end(); ++it) {
- list->Append(new base::StringValue(*it));
- }
- new_values_cache->SetValue(kStartUpFlags, list);
- }
}
void DeviceSettingsProvider::DecodeKioskPolicies(
@@ -633,7 +604,6 @@
// TODO(pastarmovj): Remove this once migration is not needed anymore.
// If the value is not set we should try to migrate legacy consent file.
if (use_file) {
- UMA_HISTOGRAM_COUNTS("DeviceSettings.MetricsMigrated", 1);
new_value = HasOldMetricsFile();
// Make sure the values will get eventually written to the policy file.
migration_values_.SetValue(kStatsReportingPref,
@@ -673,24 +643,6 @@
else
ApplyMetricsSetting(true, false);
- // TODO(pastarmovj): Remove this after we don't need it anymore.
- // See: http://crosbug.com/39553
- // Migrate flags to device settings.
- PrefService* local_state = g_browser_process->local_state();
- if (local_state->HasPrefPath(prefs::kEnabledLabsExperiments)) {
- if (!settings.has_start_up_flags()) {
- const base::ListValue* flags =
- local_state->GetList(prefs::kEnabledLabsExperiments);
- migration_values_.SetValue(kStartUpFlags, flags->DeepCopy());
- AttemptMigration();
- } else {
- // Either it has been properly migrated or the user already specified new
- // flags in the device policy.
- UMA_HISTOGRAM_COUNTS("DeviceSettings.FlagsMigrated", 1);
- local_state->ClearPref(prefs::kEnabledLabsExperiments);
- }
- }
-
// Next set the roaming setting as needed.
ApplyRoamingSetting(
settings.has_data_roaming_enabled() ?
« no previous file with comments | « chrome/browser/chromeos/settings/cros_settings_names.cc ('k') | chrome/browser/policy/device_policy_decoder_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698