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/login/keyboard_switch_menu.h" | 5 #include "chrome/browser/chromeos/login/keyboard_switch_menu.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Keyboard switch menu is aligned on left by default. | 42 // Keyboard switch menu is aligned on left by default. |
43 int reverse_offset = button->width() + button->menu_offset().x() * 2; | 43 int reverse_offset = button->width() + button->menu_offset().x() * 2; |
44 if (base::i18n::IsRTL()) { | 44 if (base::i18n::IsRTL()) { |
45 new_pt.set_x(pt.x() + reverse_offset); | 45 new_pt.set_x(pt.x() + reverse_offset); |
46 } else { | 46 } else { |
47 new_pt.set_x(pt.x() - reverse_offset); | 47 new_pt.set_x(pt.x() - reverse_offset); |
48 } | 48 } |
49 input_method_menu().RunMenuAt(new_pt, views::Menu2::ALIGN_TOPLEFT); | 49 input_method_menu().RunMenuAt(new_pt, views::Menu2::ALIGN_TOPLEFT); |
50 } | 50 } |
51 | 51 |
52 std::wstring KeyboardSwitchMenu::GetCurrentKeyboardName() const { | 52 string16 KeyboardSwitchMenu::GetCurrentKeyboardName() const { |
53 const int count = GetItemCount(); | 53 const int count = GetItemCount(); |
54 for (int i = 0; i < count; ++i) { | 54 for (int i = 0; i < count; ++i) { |
55 if (IsItemCheckedAt(i)) | 55 if (IsItemCheckedAt(i)) |
56 return UTF16ToWide(GetLabelAt(i)); | 56 return GetLabelAt(i); |
57 } | 57 } |
58 VLOG(1) << "The input method menu is not ready yet. Show a language name " | 58 VLOG(1) << "The input method menu is not ready yet. Show a language name " |
59 "that matches the hardware keyboard layout"; | 59 "that matches the hardware keyboard layout"; |
60 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); | 60 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); |
61 const std::string keyboard_layout_id = | 61 const std::string keyboard_layout_id = |
62 library->GetHardwareKeyboardLayoutName(); | 62 library->GetHardwareKeyboardLayoutName(); |
63 const std::string language_code = | 63 const std::string language_code = |
64 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); | 64 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); |
65 return input_method::GetLanguageDisplayNameFromCode(language_code); | 65 return input_method::GetLanguageDisplayNameFromCode(language_code); |
66 } | 66 } |
67 | 67 |
68 } // namespace chromeos | 68 } // namespace chromeos |
OLD | NEW |