Chromium Code Reviews| 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..e19f135ff426260cc3e81a480005867de28632bf 100644 |
| --- a/chrome/browser/extensions/api/font_settings/font_settings_api.h |
| +++ b/chrome/browser/extensions/api/font_settings/font_settings_api.h |
| @@ -13,7 +13,6 @@ |
| #include <utility> |
|
falken
2012/11/14 14:09:24
Can we get rid of <map> and <utility> now?
Jói
2012/11/14 14:40:21
Done.
|
| #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 +20,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 +29,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 +36,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 OnFontFamilyPrefChanged(const std::string& pref_name); |
|
falken
2012/11/14 14:09:24
How about "OnFontFamilyMapPrefChanged"?
It's a bi
Jói
2012/11/14 14:40:21
Done.
|
| // 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_; |