| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 selected_values.AppendString(FontSettingsUtilities::MaybeGetLocalizedFontName( | 199 selected_values.AppendString(FontSettingsUtilities::MaybeGetLocalizedFontName( |
| 200 sans_serif_font_.GetValue())); | 200 sans_serif_font_.GetValue())); |
| 201 selected_values.AppendString( | 201 selected_values.AppendString( |
| 202 FontSettingsUtilities::MaybeGetLocalizedFontName(fixed_font_.GetValue())); | 202 FontSettingsUtilities::MaybeGetLocalizedFontName(fixed_font_.GetValue())); |
| 203 | 203 |
| 204 web_ui()->CallJavascriptFunctionUnsafe( | 204 web_ui()->CallJavascriptFunctionUnsafe( |
| 205 "FontSettings.setFontsData", *list.get(), selected_values); | 205 "FontSettings.setFontsData", *list.get(), selected_values); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void FontSettingsHandler::SetUpStandardFontSample() { | 208 void FontSettingsHandler::SetUpStandardFontSample() { |
| 209 base::StringValue font_value( | 209 base::Value font_value( |
| 210 FontSettingsUtilities::ResolveFontList(standard_font_.GetValue())); | 210 FontSettingsUtilities::ResolveFontList(standard_font_.GetValue())); |
| 211 base::Value size_value(default_font_size_.GetValue()); | 211 base::Value size_value(default_font_size_.GetValue()); |
| 212 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpStandardFontSample", | 212 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpStandardFontSample", |
| 213 font_value, size_value); | 213 font_value, size_value); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void FontSettingsHandler::SetUpSerifFontSample() { | 216 void FontSettingsHandler::SetUpSerifFontSample() { |
| 217 base::StringValue font_value( | 217 base::Value font_value( |
| 218 FontSettingsUtilities::ResolveFontList(serif_font_.GetValue())); | 218 FontSettingsUtilities::ResolveFontList(serif_font_.GetValue())); |
| 219 base::Value size_value(default_font_size_.GetValue()); | 219 base::Value size_value(default_font_size_.GetValue()); |
| 220 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpSerifFontSample", | 220 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpSerifFontSample", |
| 221 font_value, size_value); | 221 font_value, size_value); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void FontSettingsHandler::SetUpSansSerifFontSample() { | 224 void FontSettingsHandler::SetUpSansSerifFontSample() { |
| 225 base::StringValue font_value( | 225 base::Value font_value( |
| 226 FontSettingsUtilities::ResolveFontList(sans_serif_font_.GetValue())); | 226 FontSettingsUtilities::ResolveFontList(sans_serif_font_.GetValue())); |
| 227 base::Value size_value(default_font_size_.GetValue()); | 227 base::Value size_value(default_font_size_.GetValue()); |
| 228 web_ui()->CallJavascriptFunctionUnsafe( | 228 web_ui()->CallJavascriptFunctionUnsafe( |
| 229 "FontSettings.setUpSansSerifFontSample", font_value, size_value); | 229 "FontSettings.setUpSansSerifFontSample", font_value, size_value); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void FontSettingsHandler::SetUpFixedFontSample() { | 232 void FontSettingsHandler::SetUpFixedFontSample() { |
| 233 base::StringValue font_value( | 233 base::Value font_value( |
| 234 FontSettingsUtilities::ResolveFontList(fixed_font_.GetValue())); | 234 FontSettingsUtilities::ResolveFontList(fixed_font_.GetValue())); |
| 235 base::Value size_value(default_fixed_font_size_.GetValue()); | 235 base::Value size_value(default_fixed_font_size_.GetValue()); |
| 236 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpFixedFontSample", | 236 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpFixedFontSample", |
| 237 font_value, size_value); | 237 font_value, size_value); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void FontSettingsHandler::SetUpMinimumFontSample() { | 240 void FontSettingsHandler::SetUpMinimumFontSample() { |
| 241 base::Value size_value(minimum_font_size_.GetValue()); | 241 base::Value size_value(minimum_font_size_.GetValue()); |
| 242 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpMinimumFontSample", | 242 web_ui()->CallJavascriptFunctionUnsafe("FontSettings.setUpMinimumFontSample", |
| 243 size_value); | 243 size_value); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 268 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 268 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { | 271 void FontSettingsHandler::OnWebKitDefaultFontSizeChanged() { |
| 272 SetUpStandardFontSample(); | 272 SetUpStandardFontSample(); |
| 273 SetUpSerifFontSample(); | 273 SetUpSerifFontSample(); |
| 274 SetUpSansSerifFontSample(); | 274 SetUpSansSerifFontSample(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace options | 277 } // namespace options |
| OLD | NEW |