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

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

Issue 11975009: Prevent a DCHECK when starting a chromeos=1 build with --stub-cros-settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: IsDeviceSettings() Created 7 years, 11 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 8f662117e586701cbb76656bfd5eff0a1ed84326..f60f5445fc60662b41b5d35e859f25362091d5d2 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -67,11 +67,6 @@ const char* kKnownSettings[] = {
// Legacy policy file location. Used to detect migration from pre v12 ChromeOS.
const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences";
-bool IsControlledSetting(const std::string& pref_path) {
- const char** end = kKnownSettings + arraysize(kKnownSettings);
- return std::find(kKnownSettings, end, pref_path) != end;
-}
-
bool HasOldMetricsFile() {
// TODO(pastarmovj): Remove this once migration is not needed anymore.
// If the value is not set we should try to migrate legacy consent file.
@@ -103,6 +98,12 @@ DeviceSettingsProvider::~DeviceSettingsProvider() {
device_settings_service_->RemoveObserver(this);
}
+// static
+bool DeviceSettingsProvider::IsDeviceSetting(const std::string& name) {
+ const char** end = kKnownSettings + arraysize(kKnownSettings);
+ return std::find(kKnownSettings, end, name) != end;
+}
+
void DeviceSettingsProvider::DoSet(const std::string& path,
const base::Value& in_value) {
// Make sure that either the current user is the device owner or the
@@ -116,7 +117,7 @@ void DeviceSettingsProvider::DoSet(const std::string& path,
return;
}
- if (IsControlledSetting(path)) {
+ if (IsDeviceSetting(path)) {
pending_changes_.push_back(PendingQueueElement(path, in_value.DeepCopy()));
if (!store_callback_factory_.HasWeakPtrs())
SetInPolicy();
@@ -657,7 +658,7 @@ bool DeviceSettingsProvider::MitigateMissingPolicy() {
}
const base::Value* DeviceSettingsProvider::Get(const std::string& path) const {
- if (IsControlledSetting(path)) {
+ if (IsDeviceSetting(path)) {
const base::Value* value;
if (values_cache_.GetValue(path, &value))
return value;
@@ -677,7 +678,7 @@ DeviceSettingsProvider::TrustedStatus
}
bool DeviceSettingsProvider::HandlesSetting(const std::string& path) const {
- return IsControlledSetting(path);
+ return IsDeviceSetting(path);
}
DeviceSettingsProvider::TrustedStatus

Powered by Google App Engine
This is Rietveld 408576698