| Index: chrome/browser/extensions/api/font_settings/font_settings_api.h
|
| diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.h b/chrome/browser/extensions/api/font_settings/font_settings_api.h
|
| index a81c7a9dc2a025979e789459ebc5bc76eb1169d6..8271aac738452cf89eea3bcee9532daf5c50c6a1 100644
|
| --- a/chrome/browser/extensions/api/font_settings/font_settings_api.h
|
| +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h
|
| @@ -8,12 +8,9 @@
|
| #ifndef CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__
|
| #define CHROME_BROWSER_EXTENSIONS_API_FONT_SETTINGS_FONT_SETTINGS_API_H__
|
|
|
| -#include <map>
|
| #include <string>
|
| -#include <utility>
|
|
|
| #include "base/prefs/public/pref_change_registrar.h"
|
| -#include "base/prefs/public/pref_observer.h"
|
| #include "chrome/browser/extensions/extension_function.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
|
|
| @@ -21,7 +18,7 @@ namespace extensions {
|
|
|
| // This class observes pref changed events on a profile and dispatches the
|
| // corresponding extension API events to extensions.
|
| -class FontSettingsEventRouter : public PrefObserver {
|
| +class FontSettingsEventRouter {
|
| public:
|
| // Constructor for observing pref changed events on |profile|. Stores a
|
| // pointer to |profile| but does not take ownership. |profile| must be
|
| @@ -30,13 +27,6 @@ class FontSettingsEventRouter : public PrefObserver {
|
| virtual ~FontSettingsEventRouter();
|
|
|
| private:
|
| - typedef std::pair<std::string, std::string> EventAndKeyPair;
|
| - // Map of pref name to a pair of event name and key (defined in the extension
|
| - // API) for dispatching a pref changed event. For example,
|
| - // "webkit.webprefs.default_font_size" to ("onDefaultFontSizedChanged",
|
| - // "pixelSize").
|
| - typedef std::map<std::string, EventAndKeyPair> PrefEventMap;
|
| -
|
| // Observes browser pref |pref_name|. When a change is observed, dispatches
|
| // event |event_name| to extensions. A JavaScript object is passed to the
|
| // extension event function with the new value of the pref in property |key|.
|
| @@ -44,39 +34,28 @@ class FontSettingsEventRouter : public PrefObserver {
|
| const char* event_name,
|
| const char* key);
|
|
|
| - // PrefObserver implementation.
|
| - virtual void OnPreferenceChanged(PrefServiceBase* service,
|
| - const std::string& pref_name) OVERRIDE;
|
| + // Decodes a preference change for a font family map and invokes
|
| + // OnFontNamePrefChange with the right parameters.
|
| + void OnFontFamilyMapPrefChanged(const std::string& pref_name);
|
|
|
| // Dispatches a changed event for the font setting for |generic_family| and
|
| // |script| to extensions. The new value of the setting is the value of
|
| - // browser pref |pref_name|. If the pref changed on the incognito profile,
|
| - // |incognito| must be set to true for extensions to get the appropriate
|
| - // event.
|
| - void OnFontNamePrefChanged(PrefServiceBase* pref_service,
|
| - const std::string& pref_name,
|
| + // browser pref |pref_name|.
|
| + void OnFontNamePrefChanged(const std::string& pref_name,
|
| const std::string& generic_family,
|
| - const std::string& script,
|
| - bool incognito);
|
| + const std::string& script);
|
|
|
| // Dispatches the setting changed event |event_name| to extensions. The new
|
| // value of the setting is the value of browser pref |pref_name|. This value
|
| // is passed in the JavaScript object argument to the extension event function
|
| - // under the key |key|. If the pref changed on the incognito profile,
|
| - // |incognito| must be set to true for extensions to get the appropriate
|
| - // event.
|
| - void OnFontPrefChanged(PrefServiceBase* pref_service,
|
| - const std::string& pref_name,
|
| - const std::string& event_name,
|
| + // under the key |key|.
|
| + void OnFontPrefChanged(const std::string& event_name,
|
| const std::string& key,
|
| - bool incognito);
|
| + const std::string& pref_name);
|
|
|
| // Manages pref observation registration.
|
| PrefChangeRegistrar registrar_;
|
|
|
| - // Maps browser pref names to extension API <event name, key> pairs.
|
| - PrefEventMap pref_event_map_;
|
| -
|
| // Weak, owns us (transitively via ExtensionService).
|
| Profile* profile_;
|
|
|
|
|