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 "ash/common/system/tray/view_click_listener.h" |
10 | 11 |
11 namespace ash { | 12 namespace ash { |
12 // The detailed view for showing IME list. | 13 // The detailed view for showing IME list. |
13 class ImeListView : public TrayDetailsView { | 14 class ImeListView : public TrayDetailsView, public ViewClickListener { |
14 public: | 15 public: |
15 enum SingleImeBehavior { | 16 enum SingleImeBehavior { |
16 // Shows the IME menu if there's only one IME in system. | 17 // Shows the IME menu if there's only one IME in system. |
17 SHOW_SINGLE_IME, | 18 SHOW_SINGLE_IME, |
18 // Hides the IME menu if there's only one IME in system. | 19 // Hides the IME menu if there's only one IME in system. |
19 HIDE_SINGLE_IME | 20 HIDE_SINGLE_IME |
20 }; | 21 }; |
21 | 22 |
22 ImeListView(SystemTrayItem* owner, | 23 ImeListView(SystemTrayItem* owner, |
23 bool show_keyboard_toggle, | 24 bool show_keyboard_toggle, |
24 SingleImeBehavior single_ime_behavior); | 25 SingleImeBehavior single_ime_behavior); |
25 | 26 |
26 ~ImeListView() override; | 27 ~ImeListView() override; |
27 | 28 |
28 // Updates the view. | 29 // Updates the view. |
29 virtual void Update(const IMEInfoList& list, | 30 virtual void Update(const IMEInfoList& list, |
30 const IMEPropertyInfoList& property_list, | 31 const IMEPropertyInfoList& property_list, |
31 bool show_keyboard_toggle, | 32 bool show_keyboard_toggle, |
32 SingleImeBehavior single_ime_behavior); | 33 SingleImeBehavior single_ime_behavior); |
33 | 34 |
34 protected: | 35 protected: |
35 // TrayDetailsView: | 36 // ViewClickListener: |
36 void HandleViewClicked(views::View* view) override; | 37 void OnViewClicked(views::View* sender) override; |
37 | 38 |
38 private: | 39 private: |
39 // To allow the test class to access |ime_map_|. | 40 // To allow the test class to access |ime_map_|. |
40 friend class ImeMenuTrayTest; | 41 friend class ImeMenuTrayTest; |
41 | 42 |
42 // Appends the IMEs to the scrollable area of the detailed view. | 43 // Appends the IMEs to the scrollable area of the detailed view. |
43 void AppendIMEList(const IMEInfoList& list); | 44 void AppendIMEList(const IMEInfoList& list); |
44 | 45 |
45 // Appends the IME listed to the scrollable area of the detailed view. | 46 // Appends the IME listed to the scrollable area of the detailed view. |
46 void AppendIMEProperties(const IMEPropertyInfoList& property_list); | 47 void AppendIMEProperties(const IMEPropertyInfoList& property_list); |
47 | 48 |
48 // Appends the on-screen keyboard status to the last area of the detailed | 49 // Appends the on-screen keyboard status to the last area of the detailed |
49 // view. | 50 // view. |
50 void AppendKeyboardStatus(); | 51 void AppendKeyboardStatus(); |
51 | 52 |
52 std::map<views::View*, std::string> ime_map_; | 53 std::map<views::View*, std::string> ime_map_; |
53 std::map<views::View*, std::string> property_map_; | 54 std::map<views::View*, std::string> property_map_; |
54 views::View* keyboard_status_; | 55 views::View* keyboard_status_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(ImeListView); | 57 DISALLOW_COPY_AND_ASSIGN(ImeListView); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace ash | 60 } // namespace ash |
60 | 61 |
61 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ | 62 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |
OLD | NEW |