| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/options/font_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/font_settings_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 GURL install_url(extension_urls::GetWebstoreItemDetailURLPrefix()); | 106 GURL install_url(extension_urls::GetWebstoreItemDetailURLPrefix()); |
| 107 localized_strings->SetString("advancedFontSettingsInstall", | 107 localized_strings->SetString("advancedFontSettingsInstall", |
| 108 l10n_util::GetStringFUTF16( | 108 l10n_util::GetStringFUTF16( |
| 109 IDS_FONT_LANGUAGE_SETTING_ADVANCED_FONT_SETTINGS_INSTALL, | 109 IDS_FONT_LANGUAGE_SETTING_ADVANCED_FONT_SETTINGS_INSTALL, |
| 110 base::UTF8ToUTF16( | 110 base::UTF8ToUTF16( |
| 111 install_url.Resolve(kAdvancedFontSettingsExtensionId).spec()))); | 111 install_url.Resolve(kAdvancedFontSettingsExtensionId).spec()))); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void FontSettingsHandler::InitializeHandler() { | 114 void FontSettingsHandler::InitializeHandler() { |
| 115 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 115 registrar_.Add(this, |
| 116 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 116 content::NotificationService::AllSources()); | 117 content::NotificationService::AllSources()); |
| 117 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 118 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 118 content::NotificationService::AllSources()); | 119 content::NotificationService::AllSources()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void FontSettingsHandler::InitializePage() { | 122 void FontSettingsHandler::InitializePage() { |
| 122 DCHECK(web_ui()); | 123 DCHECK(web_ui()); |
| 123 SetUpStandardFontSample(); | 124 SetUpStandardFontSample(); |
| 124 SetUpSerifFontSample(); | 125 SetUpSerifFontSample(); |
| 125 SetUpSansSerifFontSample(); | 126 SetUpSansSerifFontSample(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 base::Bind(&FontSettingsHandler::HandleFetchFontsData, | 172 base::Bind(&FontSettingsHandler::HandleFetchFontsData, |
| 172 base::Unretained(this))); | 173 base::Unretained(this))); |
| 173 web_ui()->RegisterMessageCallback("openAdvancedFontSettingsOptions", | 174 web_ui()->RegisterMessageCallback("openAdvancedFontSettingsOptions", |
| 174 base::Bind(&FontSettingsHandler::HandleOpenAdvancedFontSettingsOptions, | 175 base::Bind(&FontSettingsHandler::HandleOpenAdvancedFontSettingsOptions, |
| 175 base::Unretained(this))); | 176 base::Unretained(this))); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void FontSettingsHandler::Observe(int type, | 179 void FontSettingsHandler::Observe(int type, |
| 179 const content::NotificationSource& source, | 180 const content::NotificationSource& source, |
| 180 const content::NotificationDetails& details) { | 181 const content::NotificationDetails& details) { |
| 181 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || | 182 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || |
| 182 type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); | 183 type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); |
| 183 NotifyAdvancedFontSettingsAvailability(); | 184 NotifyAdvancedFontSettingsAvailability(); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { | 187 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { |
| 187 content::GetFontListAsync( | 188 content::GetFontListAsync( |
| 188 base::Bind(&FontSettingsHandler::FontsListHasLoaded, | 189 base::Bind(&FontSettingsHandler::FontsListHasLoaded, |
| 189 base::Unretained(this))); | 190 base::Unretained(this))); |
| 190 } | 191 } |
| 191 | 192 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 309 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
| 309 } | 310 } |
| 310 | 311 |
| 311 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { | 312 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { |
| 312 SetUpStandardFontSample(); | 313 SetUpStandardFontSample(); |
| 313 SetUpSerifFontSample(); | 314 SetUpSerifFontSample(); |
| 314 SetUpSansSerifFontSample(); | 315 SetUpSansSerifFontSample(); |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace options | 318 } // namespace options |
| OLD | NEW |