| 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_hangul_config_view.h" | 5 #include "chrome/browser/chromeos/options/language_hangul_config_view.h" |
| 6 | 6 |
| 7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 contents_->SetBounds(0, 0, width(), height()); | 104 contents_->SetBounds(0, 0, width(), height()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 int LanguageHangulConfigView::GetDialogButtons() const { | 107 int LanguageHangulConfigView::GetDialogButtons() const { |
| 108 return MessageBoxFlags::DIALOGBUTTON_OK; | 108 return MessageBoxFlags::DIALOGBUTTON_OK; |
| 109 } | 109 } |
| 110 | 110 |
| 111 std::wstring LanguageHangulConfigView::GetDialogButtonLabel( | 111 std::wstring LanguageHangulConfigView::GetDialogButtonLabel( |
| 112 MessageBoxFlags::DialogButton button) const { | 112 MessageBoxFlags::DialogButton button) const { |
| 113 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { | 113 if (button == MessageBoxFlags::DIALOGBUTTON_OK) { |
| 114 return l10n_util::GetString(IDS_OK); | 114 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK)); |
| 115 } | 115 } |
| 116 return L""; | 116 return L""; |
| 117 } | 117 } |
| 118 | 118 |
| 119 std::wstring LanguageHangulConfigView::GetWindowTitle() const { | 119 std::wstring LanguageHangulConfigView::GetWindowTitle() const { |
| 120 return l10n_util::GetString( | 120 return UTF16ToWide(l10n_util::GetStringUTF16( |
| 121 IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_TITLE); | 121 IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_TITLE)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 gfx::Size LanguageHangulConfigView::GetPreferredSize() { | 124 gfx::Size LanguageHangulConfigView::GetPreferredSize() { |
| 125 // TODO(satorux): Create our own localized content size once the UI is done. | 125 // TODO(satorux): Create our own localized content size once the UI is done. |
| 126 return gfx::Size(views::Window::GetLocalizedContentsSize( | 126 return gfx::Size(views::Window::GetLocalizedContentsSize( |
| 127 IDS_LANGUAGES_INPUT_DIALOG_WIDTH_CHARS, | 127 IDS_LANGUAGES_INPUT_DIALOG_WIDTH_CHARS, |
| 128 IDS_LANGUAGES_INPUT_DIALOG_HEIGHT_LINES)); | 128 IDS_LANGUAGES_INPUT_DIALOG_HEIGHT_LINES)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void LanguageHangulConfigView::InitControlLayout() { | 131 void LanguageHangulConfigView::InitControlLayout() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 143 const int kColumnSetId = 0; | 143 const int kColumnSetId = 0; |
| 144 ColumnSet* column_set = layout->AddColumnSet(kColumnSetId); | 144 ColumnSet* column_set = layout->AddColumnSet(kColumnSetId); |
| 145 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 145 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 146 GridLayout::USE_PREF, 0, 0); | 146 GridLayout::USE_PREF, 0, 0); |
| 147 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 147 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
| 148 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 148 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 149 GridLayout::USE_PREF, 0, 0); | 149 GridLayout::USE_PREF, 0, 0); |
| 150 layout->StartRow(0, kColumnSetId); | 150 layout->StartRow(0, kColumnSetId); |
| 151 | 151 |
| 152 // Settings for the Hangul IME. | 152 // Settings for the Hangul IME. |
| 153 layout->AddView(new views::Label( | 153 layout->AddView(new views::Label(UTF16ToWide( |
| 154 l10n_util::GetString(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT))); | 154 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT)))); |
| 155 | 155 |
| 156 hangul_keyboard_combobox_ | 156 hangul_keyboard_combobox_ |
| 157 = new views::Combobox(hangul_keyboard_combobox_model_.get()); | 157 = new views::Combobox(hangul_keyboard_combobox_model_.get()); |
| 158 hangul_keyboard_combobox_->set_listener(this); | 158 hangul_keyboard_combobox_->set_listener(this); |
| 159 | 159 |
| 160 // Initialize the combobox to what's saved in user preferences. Otherwise, | 160 // Initialize the combobox to what's saved in user preferences. Otherwise, |
| 161 // ItemChanged() will be called with |new_index| == 0. | 161 // ItemChanged() will be called with |new_index| == 0. |
| 162 NotifyPrefChanged(); | 162 NotifyPrefChanged(); |
| 163 layout->AddView(hangul_keyboard_combobox_); | 163 layout->AddView(hangul_keyboard_combobox_); |
| 164 } | 164 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 176 | 176 |
| 177 void LanguageHangulConfigView::NotifyPrefChanged() { | 177 void LanguageHangulConfigView::NotifyPrefChanged() { |
| 178 const std::string id = keyboard_pref_.GetValue(); | 178 const std::string id = keyboard_pref_.GetValue(); |
| 179 const int index = | 179 const int index = |
| 180 hangul_keyboard_combobox_model_->GetIndexFromID(id); | 180 hangul_keyboard_combobox_model_->GetIndexFromID(id); |
| 181 if (index >= 0) | 181 if (index >= 0) |
| 182 hangul_keyboard_combobox_->SetSelectedItem(index); | 182 hangul_keyboard_combobox_->SetSelectedItem(index); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace chromeos | 185 } // namespace chromeos |
| OLD | NEW |