| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/notification_type.h" | 11 #include "chrome/common/notification_type.h" |
| 11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 12 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 13 #include "chrome/browser/chromeos/cros/input_method_library.h" | 14 #include "chrome/browser/chromeos/cros/input_method_library.h" |
| 14 #include "chrome/browser/chromeos/language_preferences.h" | 15 #include "chrome/browser/chromeos/language_preferences.h" |
| 15 #include "chrome/browser/chromeos/preferences.h" | 16 #include "chrome/browser/chromeos/preferences.h" |
| 16 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "grit/locale_settings.h" | 19 #include "grit/locale_settings.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 language_prefs::kHangulKeyboardNameIDPairs[i].keyboard_id)); | 37 language_prefs::kHangulKeyboardNameIDPairs[i].keyboard_id)); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 // Implements ComboboxModel interface. | 41 // Implements ComboboxModel interface. |
| 41 virtual int GetItemCount() { | 42 virtual int GetItemCount() { |
| 42 return static_cast<int>(layouts_.size()); | 43 return static_cast<int>(layouts_.size()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 // Implements ComboboxModel interface. | 46 // Implements ComboboxModel interface. |
| 46 virtual std::wstring GetItemAt(int index) { | 47 virtual string16 GetItemAt(int index) { |
| 47 if (index < 0 || index > GetItemCount()) { | 48 if (index < 0 || index > GetItemCount()) { |
| 48 LOG(ERROR) << "Index is out of bounds: " << index; | 49 LOG(ERROR) << "Index is out of bounds: " << index; |
| 49 return L""; | 50 return string16(); |
| 50 } | 51 } |
| 51 return UTF8ToWide(layouts_.at(index).first); | 52 return UTF8ToUTF16(layouts_.at(index).first); |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Gets a keyboard layout ID (e.g. "2", "3f", ..) for an item at zero-origin | 55 // Gets a keyboard layout ID (e.g. "2", "3f", ..) for an item at zero-origin |
| 55 // |index|. This function is NOT part of the ComboboxModel interface. | 56 // |index|. This function is NOT part of the ComboboxModel interface. |
| 56 std::string GetItemIDAt(int index) { | 57 std::string GetItemIDAt(int index) { |
| 57 if (index < 0 || index > GetItemCount()) { | 58 if (index < 0 || index > GetItemCount()) { |
| 58 LOG(ERROR) << "Index is out of bounds: " << index; | 59 LOG(ERROR) << "Index is out of bounds: " << index; |
| 59 return ""; | 60 return ""; |
| 60 } | 61 } |
| 61 return layouts_.at(index).second; | 62 return layouts_.at(index).second; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 176 |
| 176 void LanguageHangulConfigView::NotifyPrefChanged() { | 177 void LanguageHangulConfigView::NotifyPrefChanged() { |
| 177 const std::string id = keyboard_pref_.GetValue(); | 178 const std::string id = keyboard_pref_.GetValue(); |
| 178 const int index = | 179 const int index = |
| 179 hangul_keyboard_combobox_model_->GetIndexFromID(id); | 180 hangul_keyboard_combobox_model_->GetIndexFromID(id); |
| 180 if (index >= 0) | 181 if (index >= 0) |
| 181 hangul_keyboard_combobox_->SetSelectedItem(index); | 182 hangul_keyboard_combobox_->SetSelectedItem(index); |
| 182 } | 183 } |
| 183 | 184 |
| 184 } // namespace chromeos | 185 } // namespace chromeos |
| OLD | NEW |