| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/settings/font_handler.h" | 5 #include "chrome/browser/ui/webui/settings/font_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 98 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 99 if (!service->IsExtensionEnabled(kAdvancedFontSettingsExtensionId)) | 99 if (!service->IsExtensionEnabled(kAdvancedFontSettingsExtensionId)) |
| 100 return nullptr; | 100 return nullptr; |
| 101 return service->GetInstalledExtension(kAdvancedFontSettingsExtensionId); | 101 return service->GetInstalledExtension(kAdvancedFontSettingsExtensionId); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void FontHandler::NotifyAdvancedFontSettingsAvailability() { | 104 void FontHandler::NotifyAdvancedFontSettingsAvailability() { |
| 105 CallJavascriptFunction( | 105 CallJavascriptFunction( |
| 106 "cr.webUIListenerCallback", | 106 "cr.webUIListenerCallback", |
| 107 base::StringValue("advanced-font-settings-installed"), | 107 base::StringValue("advanced-font-settings-installed"), |
| 108 base::FundamentalValue(GetAdvancedFontSettingsExtension() != nullptr)); | 108 base::Value(GetAdvancedFontSettingsExtension() != nullptr)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void FontHandler::OnExtensionLoaded(content::BrowserContext*, | 111 void FontHandler::OnExtensionLoaded(content::BrowserContext*, |
| 112 const extensions::Extension*) { | 112 const extensions::Extension*) { |
| 113 NotifyAdvancedFontSettingsAvailability(); | 113 NotifyAdvancedFontSettingsAvailability(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void FontHandler::OnExtensionUnloaded( | 116 void FontHandler::OnExtensionUnloaded( |
| 117 content::BrowserContext*, | 117 content::BrowserContext*, |
| 118 const extensions::Extension*, | 118 const extensions::Extension*, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 141 | 141 |
| 142 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix()); | 142 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix()); |
| 143 response.SetString( | 143 response.SetString( |
| 144 "extensionUrl", | 144 "extensionUrl", |
| 145 extension_url.Resolve(kAdvancedFontSettingsExtensionId).spec()); | 145 extension_url.Resolve(kAdvancedFontSettingsExtensionId).spec()); |
| 146 | 146 |
| 147 ResolveJavascriptCallback(base::StringValue(callback_id), response); | 147 ResolveJavascriptCallback(base::StringValue(callback_id), response); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace settings | 150 } // namespace settings |
| OLD | NEW |