| Index: chrome/browser/ui/webui/settings/font_handler.cc
|
| diff --git a/chrome/browser/ui/webui/settings/font_handler.cc b/chrome/browser/ui/webui/settings/font_handler.cc
|
| index 9192acd162776b396ee9033ec44fbcd552e8d2d1..2c10ff2aa7f04a9de623607433532ad198347fd9 100644
|
| --- a/chrome/browser/ui/webui/settings/font_handler.cc
|
| +++ b/chrome/browser/ui/webui/settings/font_handler.cc
|
| @@ -59,6 +59,15 @@ void FontHandler::RegisterMessages() {
|
| base::Unretained(this)));
|
| }
|
|
|
| +void FontHandler::OnJavascriptAllowed() {
|
| + extension_registry_observer_.Add(
|
| + extensions::ExtensionRegistry::Get(profile_));
|
| +}
|
| +
|
| +void FontHandler::OnJavascriptDisallowed() {
|
| + extension_registry_observer_.RemoveAll();
|
| +}
|
| +
|
| void FontHandler::HandleFetchFontsData(const base::ListValue* args) {
|
| CHECK_EQ(1U, args->GetSize());
|
| std::string callback_id;
|
| @@ -71,10 +80,7 @@ void FontHandler::HandleFetchFontsData(const base::ListValue* args) {
|
|
|
| void FontHandler::HandleObserveAdvancedFontExtensionAvailable(
|
| const base::ListValue* /*args*/) {
|
| - extensions::ExtensionRegistry* observer =
|
| - extensions::ExtensionRegistry::Get(profile_);
|
| - if (!extension_registry_observer_.IsObserving(observer))
|
| - extension_registry_observer_.Add(observer);
|
| + AllowJavascript();
|
| NotifyAdvancedFontSettingsAvailability();
|
| }
|
|
|
| @@ -97,7 +103,7 @@ const extensions::Extension* FontHandler::GetAdvancedFontSettingsExtension() {
|
| }
|
|
|
| void FontHandler::NotifyAdvancedFontSettingsAvailability() {
|
| - web_ui()->CallJavascriptFunction(
|
| + CallJavascriptFunction(
|
| "cr.webUIListenerCallback",
|
| base::StringValue("advanced-font-settings-installed"),
|
| base::FundamentalValue(GetAdvancedFontSettingsExtension() != nullptr));
|
| @@ -171,8 +177,4 @@ void FontHandler::FontListHasLoaded(std::string callback_id,
|
| ResolveJavascriptCallback(base::StringValue(callback_id), response);
|
| }
|
|
|
| -void FontHandler::RenderViewReused() {
|
| - extension_registry_observer_.RemoveAll();
|
| -}
|
| -
|
| } // namespace settings
|
|
|