| 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" |
| 11 #include "chrome/browser/chromeos/cros/keyboard_library.h" | 11 #include "chrome/browser/chromeos/cros/keyboard_library.h" |
| 12 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 12 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "views/widget/widget_gtk.h" | 14 #include "views/widget/widget_gtk.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 KeyboardSwitchMenu::KeyboardSwitchMenu() | 18 KeyboardSwitchMenu::KeyboardSwitchMenu() |
| 19 : InputMethodMenu(NULL /* pref_service */, | 19 : InputMethodMenu(NULL /* pref_service */, |
| 20 false /* is_browser_mode */, | 20 false /* is_browser_mode */, |
| 21 false /* is_screen_locker_mode */, | 21 false /* is_screen_locker_mode */, |
| 22 true /* is_out_of_box_experience_mode */) { | 22 true /* is_out_of_box_experience_mode */) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 26 // InputMethodMenu::InputMethodMenuHost implementation. | 26 // InputMethodMenu::InputMethodMenuHost implementation. |
| 27 void KeyboardSwitchMenu::UpdateUI( | 27 void KeyboardSwitchMenu::UpdateUI(const std::string& input_method_id, |
| 28 const std::wstring& name, const std::wstring& tooltip) { | 28 const std::wstring& name, |
| 29 const std::wstring& tooltip, |
| 30 size_t num_active_input_methods) { |
| 29 // Update all view hierarchies so that the new input method name is shown in | 31 // Update all view hierarchies so that the new input method name is shown in |
| 30 // the menu button. | 32 // the menu button. |
| 31 views::Widget::NotifyLocaleChanged(); | 33 views::Widget::NotifyLocaleChanged(); |
| 32 } | 34 } |
| 33 | 35 |
| 34 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 35 // views::ViewMenuDelegate implementation. | 37 // views::ViewMenuDelegate implementation. |
| 36 void KeyboardSwitchMenu::RunMenu(views::View* source, const gfx::Point& pt) { | 38 void KeyboardSwitchMenu::RunMenu(views::View* source, const gfx::Point& pt) { |
| 37 PrepareForMenuOpen(); | 39 PrepareForMenuOpen(); |
| 38 gfx::Point new_pt(pt); | 40 gfx::Point new_pt(pt); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 57 "that matches the hardware keyboard layout"; | 59 "that matches the hardware keyboard layout"; |
| 58 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); | 60 KeyboardLibrary *library = CrosLibrary::Get()->GetKeyboardLibrary(); |
| 59 const std::string keyboard_layout_id = | 61 const std::string keyboard_layout_id = |
| 60 library->GetHardwareKeyboardLayoutName(); | 62 library->GetHardwareKeyboardLayoutName(); |
| 61 const std::string language_code = | 63 const std::string language_code = |
| 62 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); | 64 input_method::GetLanguageCodeFromInputMethodId(keyboard_layout_id); |
| 63 return input_method::GetLanguageDisplayNameFromCode(language_code); | 65 return input_method::GetLanguageDisplayNameFromCode(language_code); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace chromeos | 68 } // namespace chromeos |
| OLD | NEW |