| 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 new_pt.set_x(pt.x() + reverse_offset); | 42 new_pt.set_x(pt.x() + reverse_offset); |
| 43 } else { | 43 } else { |
| 44 new_pt.set_x(pt.x() - reverse_offset); | 44 new_pt.set_x(pt.x() - reverse_offset); |
| 45 } | 45 } |
| 46 language_menu().RunMenuAt(new_pt, views::Menu2::ALIGN_TOPLEFT); | 46 language_menu().RunMenuAt(new_pt, views::Menu2::ALIGN_TOPLEFT); |
| 47 } | 47 } |
| 48 | 48 |
| 49 std::wstring KeyboardSwitchMenu::GetCurrentKeyboardName() const { | 49 std::wstring KeyboardSwitchMenu::GetCurrentKeyboardName() const { |
| 50 const int count = GetItemCount(); | 50 const int count = GetItemCount(); |
| 51 for (int i = 0; i < count; ++i) { | 51 for (int i = 0; i < count; ++i) { |
| 52 if (IsItemCheckedAt(i)) { | 52 if (IsItemCheckedAt(i)) |
| 53 return UTF16ToWide(GetLabelAt(i)); | 53 return UTF16ToWide(GetLabelAt(i)); |
| 54 } | |
| 55 } | 54 } |
| 56 LOG(INFO) << "The input method menu is not ready yet. " | 55 VLOG(1) << "The input method menu is not ready yet. Show a language name " |
| 57 << "Show a language name that matches the hardware keyboard layout"; | 56 "that matches the hardware keyboard layout"; |
| 58 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); | 57 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); |
| 59 const std::string keyboard_layout_id = | 58 const std::string keyboard_layout_id = |
| 60 library->GetHardwareKeyboardLayoutName(); | 59 library->GetHardwareKeyboardLayoutName(); |
| 61 const std::string language_code = | 60 const std::string language_code = |
| 62 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); | 61 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); |
| 63 return input_method::GetLanguageDisplayNameFromCode(language_code); | 62 return input_method::GetLanguageDisplayNameFromCode(language_code); |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace chromeos | 65 } // namespace chromeos |
| OLD | NEW |