| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 "cr.webUIListenerCallback", | 106 "cr.webUIListenerCallback", |
| 107 base::Value("advanced-font-settings-installed"), | 107 base::Value("advanced-font-settings-installed"), |
| 108 base::Value(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(content::BrowserContext*, |
| 117 content::BrowserContext*, | 117 const extensions::Extension*, |
| 118 const extensions::Extension*, | 118 extensions::UnloadedExtensionReason) { |
| 119 extensions::UnloadedExtensionInfo::Reason) { | |
| 120 NotifyAdvancedFontSettingsAvailability(); | 119 NotifyAdvancedFontSettingsAvailability(); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void FontHandler::FontListHasLoaded(std::string callback_id, | 122 void FontHandler::FontListHasLoaded(std::string callback_id, |
| 124 std::unique_ptr<base::ListValue> list) { | 123 std::unique_ptr<base::ListValue> list) { |
| 125 // Font list. Selects the directionality for the fonts in the given list. | 124 // Font list. Selects the directionality for the fonts in the given list. |
| 126 for (size_t i = 0; i < list->GetSize(); i++) { | 125 for (size_t i = 0; i < list->GetSize(); i++) { |
| 127 base::ListValue* font; | 126 base::ListValue* font; |
| 128 bool has_font = list->GetList(i, &font); | 127 bool has_font = list->GetList(i, &font); |
| 129 DCHECK(has_font); | 128 DCHECK(has_font); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 141 | 140 |
| 142 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix()); | 141 GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix()); |
| 143 response.SetString( | 142 response.SetString( |
| 144 "extensionUrl", | 143 "extensionUrl", |
| 145 extension_url.Resolve(kAdvancedFontSettingsExtensionId).spec()); | 144 extension_url.Resolve(kAdvancedFontSettingsExtensionId).spec()); |
| 146 | 145 |
| 147 ResolveJavascriptCallback(base::Value(callback_id), response); | 146 ResolveJavascriptCallback(base::Value(callback_id), response); |
| 148 } | 147 } |
| 149 | 148 |
| 150 } // namespace settings | 149 } // namespace settings |
| OLD | NEW |