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

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

Issue 2720503007: MD Settings: add more extension controlled pref handling. (Closed)
Patch Set: add comments Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e32baa11f46eac2beb28f262c0c407389ba09654..75083f20321e6eeba77a23b76be31dc30a504867 100644
--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -478,6 +478,7 @@ std::unique_ptr<settings_private::PrefObject> PrefsUtil::GetPref(
#endif
const Extension* extension = GetExtensionControllingPref(*pref_object);
+
if (extension) {
pref_object->controlled_by =
settings_private::ControlledBy::CONTROLLED_BY_EXTENSION;
@@ -738,7 +739,12 @@ const Extension* PrefsUtil::GetExtensionControllingPref(
if (pref_object.key == proxy_config::prefs::kProxy)
return GetExtensionOverridingProxy(profile_);
- return nullptr;
+ // If it's none of the above, attempt a more general strategy.
+ std::string extension_id =
+ ExtensionPrefValueMapFactory::GetForBrowserContext(profile_)
+ ->GetExtensionControllingPref(pref_object.key);
Dan Beam 2017/02/28 17:52:45 if (extension_id.empty()) return nullptr;
scottchen 2017/02/28 18:56:14 Done.
+ return ExtensionRegistry::Get(profile_)->
+ GetExtensionById(extension_id, ExtensionRegistry::ENABLED);
}
} // namespace extensions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698