| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |
| 7 | 7 |
| 8 #include "ash/common/system/tray/ime_info.h" | 8 #include "ash/common/system/tray/ime_info.h" |
| 9 #include "ash/common/system/tray/tray_details_view.h" | 9 #include "ash/common/system/tray/tray_details_view.h" |
| 10 #include "ui/views/controls/button/button.h" |
| 10 | 11 |
| 11 namespace ash { | 12 namespace ash { |
| 13 class MaterialKeyboardStatusRowView; |
| 14 |
| 12 // The detailed view for showing IME list. | 15 // The detailed view for showing IME list. |
| 13 class ImeListView : public TrayDetailsView { | 16 class ImeListView : public TrayDetailsView { |
| 14 public: | 17 public: |
| 15 enum SingleImeBehavior { | 18 enum SingleImeBehavior { |
| 16 // Shows the IME menu if there's only one IME in system. | 19 // Shows the IME menu if there's only one IME in system. |
| 17 SHOW_SINGLE_IME, | 20 SHOW_SINGLE_IME, |
| 18 // Hides the IME menu if there's only one IME in system. | 21 // Hides the IME menu if there's only one IME in system. |
| 19 HIDE_SINGLE_IME | 22 HIDE_SINGLE_IME |
| 20 }; | 23 }; |
| 21 | 24 |
| 22 ImeListView(SystemTrayItem* owner, | 25 ImeListView(SystemTrayItem* owner, |
| 23 bool show_keyboard_toggle, | 26 bool show_keyboard_toggle, |
| 24 SingleImeBehavior single_ime_behavior); | 27 SingleImeBehavior single_ime_behavior); |
| 25 | 28 |
| 26 ~ImeListView() override; | 29 ~ImeListView() override; |
| 27 | 30 |
| 28 // Updates the view. | 31 // Updates the view. |
| 29 virtual void Update(const IMEInfoList& list, | 32 virtual void Update(const IMEInfoList& list, |
| 30 const IMEPropertyInfoList& property_list, | 33 const IMEPropertyInfoList& property_list, |
| 31 bool show_keyboard_toggle, | 34 bool show_keyboard_toggle, |
| 32 SingleImeBehavior single_ime_behavior); | 35 SingleImeBehavior single_ime_behavior); |
| 33 | 36 |
| 34 // TrayDetailsView: | 37 // TrayDetailsView: |
| 35 void HandleViewClicked(views::View* view) override; | 38 void HandleViewClicked(views::View* view) override; |
| 36 | 39 |
| 40 // views::ButtonListener: |
| 41 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 42 |
| 37 private: | 43 private: |
| 38 // To allow the test class to access |ime_map_|. | 44 // To allow the test class to access |ime_map_|. |
| 39 friend class ImeMenuTrayTest; | 45 friend class ImeMenuTrayTest; |
| 40 | 46 |
| 47 // Removes (and destroys) all child views. |
| 48 void ResetImeListView(); |
| 49 |
| 41 // Appends the IMEs to the scrollable area of the detailed view. | 50 // Appends the IMEs to the scrollable area of the detailed view. |
| 42 void AppendIMEList(const IMEInfoList& list); | 51 void AppendIMEList(const IMEInfoList& list); |
| 43 | 52 |
| 44 // Appends the IME listed to the scrollable area of the detailed view. | 53 // Appends the IME listed to the scrollable area of the detailed view. |
| 45 void AppendIMEProperties(const IMEPropertyInfoList& property_list); | 54 void AppendIMEProperties(const IMEPropertyInfoList& property_list); |
| 46 | 55 |
| 47 // Appends the IMEs and properties to the scrollable area in the material | 56 // Appends the IMEs and properties to the scrollable area in the material |
| 48 // design IME menu. | 57 // design IME menu. |
| 49 void AppendImeListAndProperties(const IMEInfoList& list, | 58 void AppendImeListAndProperties(const IMEInfoList& list, |
| 50 const IMEPropertyInfoList& property_list); | 59 const IMEPropertyInfoList& property_list); |
| 51 | 60 |
| 52 // Appends the on-screen keyboard status to the last area of the detailed | 61 // Appends the on-screen keyboard status to the last area of the detailed |
| 53 // view. | 62 // view. |
| 54 void AppendKeyboardStatus(); | 63 void AppendKeyboardStatus(); |
| 55 | 64 |
| 65 // Appends the material on-screen keyboard status to the top area of the |
| 66 // detailed view. |
| 67 void AppendMaterialKeyboardStatus(); |
| 68 |
| 56 std::map<views::View*, std::string> ime_map_; | 69 std::map<views::View*, std::string> ime_map_; |
| 57 std::map<views::View*, std::string> property_map_; | 70 std::map<views::View*, std::string> property_map_; |
| 71 // On-screen keyboard view which is not used in material design. |
| 58 views::View* keyboard_status_; | 72 views::View* keyboard_status_; |
| 73 // On-screen keyboard view which is only used in material design. |
| 74 MaterialKeyboardStatusRowView* material_keyboard_statuts_view_; |
| 59 | 75 |
| 60 DISALLOW_COPY_AND_ASSIGN(ImeListView); | 76 DISALLOW_COPY_AND_ASSIGN(ImeListView); |
| 61 }; | 77 }; |
| 62 | 78 |
| 63 } // namespace ash | 79 } // namespace ash |
| 64 | 80 |
| 65 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ | 81 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |
| OLD | NEW |