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

Unified Diff: chrome/browser/extensions/api/font_settings/font_settings_api.cc

Issue 11336008: When a font family pref changes to the empty string, pass it to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 2 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 | chrome/browser/ui/prefs/prefs_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/font_settings/font_settings_api.cc
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
index 82d63cca003624daa9ca3e32a9b1bde97d2876fe..88a114920afcbaa5c45f9d3463aeae45336047f0 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -20,6 +20,7 @@
#include "chrome/common/extensions/api/font_settings.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_names_util.h"
#include "content/public/browser/font_list_async.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
@@ -55,7 +56,6 @@ const char kOnMinimumFontSizeChanged[] =
// Format for font name preference paths.
const char kWebKitFontPrefFormat[] = "webkit.webprefs.fonts.%s.%s";
-const char kWebKitFontPrefPrefix[] = "webkit.webprefs.fonts.";
// Gets the font name preference path for |generic_family| and |script|. If
// |script| is NULL, uses prefs::kWebKitCommonScript.
@@ -70,22 +70,6 @@ std::string GetFontNamePrefPath(fonts::GenericFamily generic_family_enum,
script.c_str());
}
-// Extracts the generic family and script from font name pref path |pref_path|.
-bool ParseFontNamePrefPath(std::string pref_path,
- std::string* generic_family,
- std::string* script) {
- if (!StartsWithASCII(pref_path, kWebKitFontPrefPrefix, true))
- return false;
-
- size_t start = strlen(kWebKitFontPrefPrefix);
- size_t pos = pref_path.find('.', start);
- if (pos == std::string::npos || pos + 1 == pref_path.length())
- return false;
- *generic_family = pref_path.substr(start, pos - start);
- *script = pref_path.substr(pos + 1);
- return true;
-}
-
// Returns the localized name of a font so that it can be matched within the
// list of system fonts. On Windows, the list of system fonts has names only
// for the system locale, but the pref value may be in the English name.
@@ -177,7 +161,8 @@ void FontSettingsEventRouter::Observe(
std::string generic_family;
std::string script;
- if (ParseFontNamePrefPath(pref_name, &generic_family, &script)) {
+ if (pref_names_util::ParseFontNamePrefPath(pref_name, &generic_family,
+ &script)) {
OnFontNamePrefChanged(pref_service, pref_name, generic_family, script,
incognito);
return;
« no previous file with comments | « no previous file | chrome/browser/ui/prefs/prefs_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698