OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/options/font_settings_handler.h" | 5 #include "chrome/browser/dom_ui/options/font_settings_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL)); | 39 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL)); |
40 localized_strings->SetString("fontSettingsSansSerifLabel", | 40 localized_strings->SetString("fontSettingsSansSerifLabel", |
41 l10n_util::GetStringUTF16( | 41 l10n_util::GetStringUTF16( |
42 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL)); | 42 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL)); |
43 localized_strings->SetString("fontSettingsFixedWidthLabel", | 43 localized_strings->SetString("fontSettingsFixedWidthLabel", |
44 l10n_util::GetStringUTF16( | 44 l10n_util::GetStringUTF16( |
45 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL)); | 45 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL)); |
46 localized_strings->SetString("fontSettingsSizeLabel", | 46 localized_strings->SetString("fontSettingsSizeLabel", |
47 l10n_util::GetStringUTF16( | 47 l10n_util::GetStringUTF16( |
48 IDS_FONT_LANGUAGE_SETTING_FONT_SIZE_SELECTOR_LABEL)); | 48 IDS_FONT_LANGUAGE_SETTING_FONT_SIZE_SELECTOR_LABEL)); |
| 49 |
| 50 localized_strings->SetString("fontSettingsMinimumSizeTitle", |
| 51 l10n_util::GetStringUTF16( |
| 52 IDS_FONT_LANGUAGE_SETTING_MINIMUM_FONT_SIZE_TITLE)); |
| 53 |
49 localized_strings->SetString("fontSettingsEncodingTitle", | 54 localized_strings->SetString("fontSettingsEncodingTitle", |
50 l10n_util::GetStringUTF16( | 55 l10n_util::GetStringUTF16( |
51 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE)); | 56 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE)); |
52 localized_strings->SetString("fontSettingsEncodingLabel", | 57 localized_strings->SetString("fontSettingsEncodingLabel", |
53 l10n_util::GetStringUTF16( | 58 l10n_util::GetStringUTF16( |
54 IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL)); | 59 IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL)); |
55 | 60 |
56 // Fonts | 61 // Fonts |
57 ListValue* font_list = FontSettingsUtilities::GetFontsList(); | 62 ListValue* font_list = FontSettingsUtilities::GetFontsList(); |
58 if (font_list) localized_strings->Set("fontSettingsFontList", font_list); | 63 if (font_list) localized_strings->Set("fontSettingsFontList", font_list); |
59 | 64 |
60 // Font sizes | 65 // Font sizes |
61 int font_sizes[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, | 66 int font_sizes[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, |
62 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72 }; | 67 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72 }; |
63 int count = arraysize(font_sizes); | 68 int count = arraysize(font_sizes); |
64 ListValue* font_size_list = new ListValue; | 69 ListValue* font_size_list = new ListValue; |
65 for (int i = 0; i < count; i++) { | 70 for (int i = 0; i < count; i++) { |
66 ListValue* option = new ListValue(); | 71 ListValue* option = new ListValue(); |
67 option->Append(Value::CreateIntegerValue(font_sizes[i])); | 72 option->Append(Value::CreateIntegerValue(font_sizes[i])); |
68 option->Append(Value::CreateStringValue(base::IntToString(font_sizes[i]))); | 73 option->Append(Value::CreateStringValue(base::IntToString(font_sizes[i]))); |
69 font_size_list->Append(option); | 74 font_size_list->Append(option); |
70 } | 75 } |
71 localized_strings->Set("fontSettingsFontSizeList", font_size_list); | 76 localized_strings->Set("fontSettingsFontSizeList", font_size_list); |
72 | 77 |
| 78 // Miniumum font size |
| 79 int minimum_font_sizes[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, |
| 80 24 }; |
| 81 count = arraysize(minimum_font_sizes); |
| 82 ListValue* minimum_font_size_list = new ListValue; |
| 83 ListValue* default_option = new ListValue(); |
| 84 default_option->Append(Value::CreateIntegerValue(0)); |
| 85 default_option->Append(Value::CreateStringValue( |
| 86 l10n_util::GetStringUTF16( |
| 87 IDS_FONT_LANGUAGE_SETTING_NO_MINIMUM_FONT_SIZE_LABEL))); |
| 88 minimum_font_size_list->Append(default_option); |
| 89 for (int i = 0; i < count; i++) { |
| 90 ListValue* option = new ListValue(); |
| 91 option->Append(Value::CreateIntegerValue(minimum_font_sizes[i])); |
| 92 option->Append( |
| 93 Value::CreateStringValue(base::IntToString(minimum_font_sizes[i]))); |
| 94 minimum_font_size_list->Append(option); |
| 95 } |
| 96 localized_strings->Set("fontSettingsMinimumFontSizeList", |
| 97 minimum_font_size_list); |
| 98 |
73 // Encodings | 99 // Encodings |
74 count = CharacterEncoding::GetSupportCanonicalEncodingCount(); | 100 count = CharacterEncoding::GetSupportCanonicalEncodingCount(); |
75 ListValue* encoding_list = new ListValue; | 101 ListValue* encoding_list = new ListValue; |
76 for (int i = 0; i < count; ++i) { | 102 for (int i = 0; i < count; ++i) { |
77 int cmd_id = CharacterEncoding::GetEncodingCommandIdByIndex(i); | 103 int cmd_id = CharacterEncoding::GetEncodingCommandIdByIndex(i); |
78 std::string encoding = | 104 std::string encoding = |
79 CharacterEncoding::GetCanonicalEncodingNameByCommandId(cmd_id); | 105 CharacterEncoding::GetCanonicalEncodingNameByCommandId(cmd_id); |
80 string16 name = | 106 string16 name = |
81 CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId(cmd_id); | 107 CharacterEncoding::GetCanonicalEncodingDisplayNameByCommandId(cmd_id); |
82 | 108 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 L"FontSettings.setupSansSerifFontPreview", font_value, size_value); | 175 L"FontSettings.setupSansSerifFontPreview", font_value, size_value); |
150 } | 176 } |
151 | 177 |
152 void FontSettingsHandler::SetupFixedFontPreview() { | 178 void FontSettingsHandler::SetupFixedFontPreview() { |
153 DCHECK(dom_ui_); | 179 DCHECK(dom_ui_); |
154 StringValue font_value(fixed_font_.GetValue()); | 180 StringValue font_value(fixed_font_.GetValue()); |
155 FundamentalValue size_value(default_fixed_font_size_.GetValue()); | 181 FundamentalValue size_value(default_fixed_font_size_.GetValue()); |
156 dom_ui_->CallJavascriptFunction( | 182 dom_ui_->CallJavascriptFunction( |
157 L"FontSettings.setupFixedFontPreview", font_value, size_value); | 183 L"FontSettings.setupFixedFontPreview", font_value, size_value); |
158 } | 184 } |
OLD | NEW |