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

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

Issue 10177003: Font Settings Extension API: Add functions to clear prefs. (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_font_settings_api.cc
diff --git a/chrome/browser/extensions/extension_font_settings_api.cc b/chrome/browser/extensions/extension_font_settings_api.cc
index 0b250d6d74c13148ca80b970ca27bf7a187e28bb..d606135fb111d722b3aec367d8ab2cf7199cf447 100644
--- a/chrome/browser/extensions/extension_font_settings_api.cc
+++ b/chrome/browser/extensions/extension_font_settings_api.cc
@@ -276,6 +276,24 @@ void ExtensionFontSettingsEventRouter::OnFontPrefChanged(
pref_name);
}
+bool ClearFontFunction::RunImpl() {
+ DictionaryValue* details = NULL;
+ EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
+
+ std::string pref_path;
+ EXTENSION_FUNCTION_VALIDATE(GetFontNamePrefPath(details, &pref_path));
+
+ // Ensure |pref_path| really is for a registered per-script font pref.
+ EXTENSION_FUNCTION_VALIDATE(
+ profile_->GetPrefs()->FindPreference(pref_path.c_str()));
+
+ ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs();
+ prefs->RemoveExtensionControlledPref(extension_id(),
+ pref_path.c_str(),
+ kExtensionPrefsScopeRegular);
+ return true;
+}
+
bool GetFontFunction::RunImpl() {
DictionaryValue* details = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
@@ -361,6 +379,14 @@ bool GetFontListFunction::CopyFontsToResult(ListValue* fonts) {
return true;
}
+bool ClearFontPrefExtensionFunction::RunImpl() {
+ ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs();
+ prefs->RemoveExtensionControlledPref(extension_id(),
+ GetPrefName(),
+ kExtensionPrefsScopeRegular);
+ return true;
+}
+
bool GetFontPrefExtensionFunction::RunImpl() {
PrefService* prefs = profile_->GetPrefs();
const PrefService::Preference* pref = prefs->FindPreference(GetPrefName());
@@ -387,6 +413,10 @@ bool SetFontPrefExtensionFunction::RunImpl() {
return true;
}
+const char* ClearDefaultFontSizeFunction::GetPrefName() {
+ return prefs::kWebKitGlobalDefaultFontSize;
+}
+
const char* GetDefaultFontSizeFunction::GetPrefName() {
return prefs::kWebKitGlobalDefaultFontSize;
}
@@ -403,6 +433,10 @@ const char* SetDefaultFontSizeFunction::GetKey() {
return kPixelSizeKey;
}
+const char* ClearDefaultFixedFontSizeFunction::GetPrefName() {
+ return prefs::kWebKitGlobalDefaultFixedFontSize;
+}
+
const char* GetDefaultFixedFontSizeFunction::GetPrefName() {
return prefs::kWebKitGlobalDefaultFixedFontSize;
}
@@ -419,6 +453,10 @@ const char* SetDefaultFixedFontSizeFunction::GetKey() {
return kPixelSizeKey;
}
+const char* ClearMinimumFontSizeFunction::GetPrefName() {
+ return prefs::kWebKitGlobalMinimumFontSize;
+}
+
const char* GetMinimumFontSizeFunction::GetPrefName() {
return prefs::kWebKitGlobalMinimumFontSize;
}
@@ -435,6 +473,10 @@ const char* SetMinimumFontSizeFunction::GetKey() {
return kPixelSizeKey;
}
+const char* ClearDefaultCharacterSetFunction::GetPrefName() {
+ return prefs::kGlobalDefaultCharset;
+}
+
const char* GetDefaultCharacterSetFunction::GetPrefName() {
return prefs::kGlobalDefaultCharset;
}
« no previous file with comments | « chrome/browser/extensions/extension_font_settings_api.h ('k') | chrome/browser/extensions/extension_font_settings_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698