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; |