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

Unified Diff: chrome/browser/extensions/extension_preference_api.cc

Issue 10008076: Add onFontNameChanged event to Font Settings API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_preference_api.cc
diff --git a/chrome/browser/extensions/extension_preference_api.cc b/chrome/browser/extensions/extension_preference_api.cc
index d33850699a7e8cbc77ad0b8d6a3d202161cbd28c..464ec81d324157f6e6d451c4fadd2e935f0e753e 100644
--- a/chrome/browser/extensions/extension_preference_api.cc
+++ b/chrome/browser/extensions/extension_preference_api.cc
@@ -135,32 +135,6 @@ class InvertBooleanTransformer : public PrefTransformerInterface {
}
};
-// Returns a string constant (defined in the API) indicating the level of
-// control this extension has over the specified preference.
-const char* GetLevelOfControl(
- Profile* profile,
- const std::string& extension_id,
- const std::string& browser_pref,
- bool incognito) {
- PrefService* prefs = incognito ? profile->GetOffTheRecordPrefs()
- : profile->GetPrefs();
- const PrefService::Preference* pref =
- prefs->FindPreference(browser_pref.c_str());
- CHECK(pref);
- ExtensionPrefs* ep = profile->GetExtensionService()->extension_prefs();
-
- if (!pref->IsExtensionModifiable())
- return keys::kNotControllable;
-
- if (ep->DoesExtensionControlPref(extension_id, browser_pref, incognito))
- return keys::kControlledByThisExtension;
-
- if (ep->CanExtensionControlPref(extension_id, browser_pref, incognito))
- return keys::kControllableByThisExtension;
-
- return keys::kControlledByOtherExtensions;
-}
-
class PrefMapping {
public:
static PrefMapping* GetInstance() {
@@ -321,7 +295,8 @@ void ExtensionPreferenceEventRouter::OnPrefChanged(
(*it)->HasAPIPermission(permission) &&
(!incognito || extension_service->CanCrossIncognito(*it))) {
std::string level_of_control =
- GetLevelOfControl(profile_, extension_id, browser_pref, incognito);
+ helpers::GetLevelOfControl(profile_, extension_id, browser_pref,
+ incognito);
dict->SetString(keys::kLevelOfControl, level_of_control);
std::string json_args;
@@ -390,7 +365,8 @@ bool GetPreferenceFunction::RunImpl() {
// Retrieve level of control.
std::string level_of_control =
- GetLevelOfControl(profile_, extension_id(), browser_pref, incognito);
+ helpers::GetLevelOfControl(profile_, extension_id(), browser_pref,
+ incognito);
result->SetString(keys::kLevelOfControl, level_of_control);
// Retrieve pref value.

Powered by Google App Engine
This is Rietveld 408576698