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

Unified Diff: chrome/browser/extensions/api/settings_private/prefs_util.cc

Issue 1775803002: MD Settings: add a semi-functional System page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v2-md_history
Patch Set: stevenjb@ review Created 4 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/extensions/api/settings_private/prefs_util.cc
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc
index 01a6437380a4f9f255df6175d49757b818939ab1..ddc13071d5d2d62d41b1629514817344a67de7cd 100644
--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -59,6 +59,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
static PrefsUtil::TypedPrefMap* s_whitelist = nullptr;
if (s_whitelist)
return *s_whitelist;
+ // TODO(dbeam): why aren't we using kPrefName from pref_names.h?
s_whitelist = new PrefsUtil::TypedPrefMap();
(*s_whitelist)["alternate_error_pages.enabled"] =
settings_private::PrefType::PREF_TYPE_BOOLEAN;
@@ -243,6 +244,12 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetWhitelistedKeys() {
#else
(*s_whitelist)["intl.accept_languages"] =
settings_private::PrefType::PREF_TYPE_STRING;
+
+ // System settings.
+ (*s_whitelist)["background_mode.enabled"] =
+ settings_private::PrefType::PREF_TYPE_BOOLEAN;
+ (*s_whitelist)["hardware_acceleration_mode.enabled"] =
+ settings_private::PrefType::PREF_TYPE_BOOLEAN;
#endif
#if defined(GOOGLE_CHROME_BUILD)
@@ -553,10 +560,17 @@ bool PrefsUtil::IsPrefSupervisorControlled(const std::string& pref_name) {
}
bool PrefsUtil::IsPrefUserModifiable(const std::string& pref_name) {
- PrefService* pref_service = profile_->GetPrefs();
- const PrefService::Preference* pref =
- pref_service->FindPreference(pref_name.c_str());
- return pref && pref->IsUserModifiable();
+ const PrefService::Preference* profile_pref =
+ profile_->GetPrefs()->FindPreference(pref_name);
+ if (profile_pref)
+ return profile_pref->IsUserModifiable();
+
+ const PrefService::Preference* local_state_pref =
+ g_browser_process->local_state()->FindPreference(pref_name);
+ if (local_state_pref)
+ return local_state_pref->IsUserModifiable();
+
+ return false;
}
PrefService* PrefsUtil::FindServiceForPref(const std::string& pref_name) {

Powered by Google App Engine
This is Rietveld 408576698