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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, chrome::NOTIFICATION_EXTENSION_LOADED, |
116 content::NotificationService::AllSources()); | 116 content::NotificationService::AllSources()); |
117 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 117 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
118 content::NotificationService::AllSources()); | 118 content::NotificationService::AllSources()); |
119 } | 119 } |
120 | 120 |
121 void FontSettingsHandler::InitializePage() { | 121 void FontSettingsHandler::InitializePage() { |
122 DCHECK(web_ui()); | 122 DCHECK(web_ui()); |
123 SetUpStandardFontSample(); | 123 SetUpStandardFontSample(); |
124 SetUpSerifFontSample(); | 124 SetUpSerifFontSample(); |
125 SetUpSansSerifFontSample(); | 125 SetUpSansSerifFontSample(); |
126 SetUpFixedFontSample(); | 126 SetUpFixedFontSample(); |
127 SetUpMinimumFontSample(); | 127 SetUpMinimumFontSample(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 base::Unretained(this))); | 172 base::Unretained(this))); |
173 web_ui()->RegisterMessageCallback("openAdvancedFontSettingsOptions", | 173 web_ui()->RegisterMessageCallback("openAdvancedFontSettingsOptions", |
174 base::Bind(&FontSettingsHandler::HandleOpenAdvancedFontSettingsOptions, | 174 base::Bind(&FontSettingsHandler::HandleOpenAdvancedFontSettingsOptions, |
175 base::Unretained(this))); | 175 base::Unretained(this))); |
176 } | 176 } |
177 | 177 |
178 void FontSettingsHandler::Observe(int type, | 178 void FontSettingsHandler::Observe(int type, |
179 const content::NotificationSource& source, | 179 const content::NotificationSource& source, |
180 const content::NotificationDetails& details) { | 180 const content::NotificationDetails& details) { |
181 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || | 181 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || |
182 type == chrome::NOTIFICATION_EXTENSION_UNLOADED); | 182 type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); |
183 NotifyAdvancedFontSettingsAvailability(); | 183 NotifyAdvancedFontSettingsAvailability(); |
184 } | 184 } |
185 | 185 |
186 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { | 186 void FontSettingsHandler::HandleFetchFontsData(const base::ListValue* args) { |
187 content::GetFontListAsync( | 187 content::GetFontListAsync( |
188 base::Bind(&FontSettingsHandler::FontsListHasLoaded, | 188 base::Bind(&FontSettingsHandler::FontsListHasLoaded, |
189 base::Unretained(this))); | 189 base::Unretained(this))); |
190 } | 190 } |
191 | 191 |
192 void FontSettingsHandler::FontsListHasLoaded( | 192 void FontSettingsHandler::FontsListHasLoaded( |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 308 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
309 } | 309 } |
310 | 310 |
311 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { | 311 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { |
312 SetUpStandardFontSample(); | 312 SetUpStandardFontSample(); |
313 SetUpSerifFontSample(); | 313 SetUpSerifFontSample(); |
314 SetUpSansSerifFontSample(); | 314 SetUpSansSerifFontSample(); |
315 } | 315 } |
316 | 316 |
317 } // namespace options | 317 } // namespace options |
OLD | NEW |