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/chromeos/options/language_pinyin_config_view.h" | 5 #include "chrome/browser/chromeos/options/language_pinyin_config_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/input_method_library.h" | 10 #include "chrome/browser/chromeos/cros/input_method_library.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 contents_->SetBounds(0, 0, width(), height()); | 69 contents_->SetBounds(0, 0, width(), height()); |
70 } | 70 } |
71 | 71 |
72 int LanguagePinyinConfigView::GetDialogButtons() const { | 72 int LanguagePinyinConfigView::GetDialogButtons() const { |
73 return MessageBoxFlags::DIALOGBUTTON_OK; | 73 return MessageBoxFlags::DIALOGBUTTON_OK; |
74 } | 74 } |
75 | 75 |
76 std::wstring LanguagePinyinConfigView::GetDialogButtonLabel( | 76 std::wstring LanguagePinyinConfigView::GetDialogButtonLabel( |
77 MessageBoxFlags::DialogButton button) const { | 77 MessageBoxFlags::DialogButton button) const { |
78 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { | 78 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { |
79 return l10n_util::GetString(IDS_OK); | 79 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK)); |
80 } | 80 } |
81 return L""; | 81 return L""; |
82 } | 82 } |
83 | 83 |
84 std::wstring LanguagePinyinConfigView::GetWindowTitle() const { | 84 std::wstring LanguagePinyinConfigView::GetWindowTitle() const { |
85 return l10n_util::GetString( | 85 return UTF16ToWide(l10n_util::GetStringUTF16( |
86 IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTINGS_TITLE); | 86 IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTINGS_TITLE)); |
87 } | 87 } |
88 | 88 |
89 gfx::Size LanguagePinyinConfigView::GetPreferredSize() { | 89 gfx::Size LanguagePinyinConfigView::GetPreferredSize() { |
90 // TODO(satorux): Create our own localized content size once the UI is done. | 90 // TODO(satorux): Create our own localized content size once the UI is done. |
91 return gfx::Size(views::Window::GetLocalizedContentsSize( | 91 return gfx::Size(views::Window::GetLocalizedContentsSize( |
92 IDS_LANGUAGES_INPUT_DIALOG_WIDTH_CHARS, | 92 IDS_LANGUAGES_INPUT_DIALOG_WIDTH_CHARS, |
93 IDS_LANGUAGES_INPUT_DIALOG_HEIGHT_LINES)); | 93 IDS_LANGUAGES_INPUT_DIALOG_HEIGHT_LINES)); |
94 } | 94 } |
95 | 95 |
96 void LanguagePinyinConfigView::InitControlLayout() { | 96 void LanguagePinyinConfigView::InitControlLayout() { |
(...skipping 11 matching lines...) Expand all Loading... |
108 const int kColumnSetId = 0; | 108 const int kColumnSetId = 0; |
109 ColumnSet* column_set = layout->AddColumnSet(kColumnSetId); | 109 ColumnSet* column_set = layout->AddColumnSet(kColumnSetId); |
110 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 110 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
111 GridLayout::USE_PREF, 0, 0); | 111 GridLayout::USE_PREF, 0, 0); |
112 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 112 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
113 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 113 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
114 GridLayout::USE_PREF, 0, 0); | 114 GridLayout::USE_PREF, 0, 0); |
115 | 115 |
116 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { | 116 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { |
117 pinyin_boolean_checkboxes_[i] = new views::Checkbox( | 117 pinyin_boolean_checkboxes_[i] = new views::Checkbox( |
118 l10n_util::GetString( | 118 UTF16ToWide(l10n_util::GetStringUTF16( |
119 language_prefs::kPinyinBooleanPrefs[i].message_id)); | 119 language_prefs::kPinyinBooleanPrefs[i].message_id))); |
120 pinyin_boolean_checkboxes_[i]->set_listener(this); | 120 pinyin_boolean_checkboxes_[i]->set_listener(this); |
121 pinyin_boolean_checkboxes_[i]->set_tag(i); | 121 pinyin_boolean_checkboxes_[i]->set_tag(i); |
122 } | 122 } |
123 double_pinyin_schema_.combobox = | 123 double_pinyin_schema_.combobox = |
124 new LanguageCombobox(double_pinyin_schema_.combobox_model); | 124 new LanguageCombobox(double_pinyin_schema_.combobox_model); |
125 double_pinyin_schema_.combobox->set_listener(this); | 125 double_pinyin_schema_.combobox->set_listener(this); |
126 | 126 |
127 NotifyPrefChanged(); | 127 NotifyPrefChanged(); |
128 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { | 128 for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) { |
129 layout->StartRow(0, kColumnSetId); | 129 layout->StartRow(0, kColumnSetId); |
(...skipping 21 matching lines...) Expand all Loading... |
151 const int value = double_pinyin_schema_.multiple_choice_pref.GetValue(); | 151 const int value = double_pinyin_schema_.multiple_choice_pref.GetValue(); |
152 for (int i = 0; i < double_pinyin_schema_.combobox_model->num_items(); ++i) { | 152 for (int i = 0; i < double_pinyin_schema_.combobox_model->num_items(); ++i) { |
153 if (double_pinyin_schema_.combobox_model->GetConfigValueAt(i) == value) { | 153 if (double_pinyin_schema_.combobox_model->GetConfigValueAt(i) == value) { |
154 double_pinyin_schema_.combobox->SetSelectedItem(i); | 154 double_pinyin_schema_.combobox->SetSelectedItem(i); |
155 break; | 155 break; |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 } // namespace chromeos | 160 } // namespace chromeos |
OLD | NEW |