| OLD | NEW | 
|---|
|  | (Empty) | 
| 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 |  | 
| 3 // found in the LICENSE file. |  | 
| 4 |  | 
| 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |  | 
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |  | 
| 7 |  | 
| 8 #include "ash/ash_export.h" |  | 
| 9 #include "ash/common/system/tray/ime_info.h" |  | 
| 10 #include "ash/common/system/tray/tray_details_view.h" |  | 
| 11 #include "ui/views/controls/button/button.h" |  | 
| 12 |  | 
| 13 namespace ash { |  | 
| 14 class MaterialKeyboardStatusRowView; |  | 
| 15 |  | 
| 16 // The detailed view for showing IME list. |  | 
| 17 class ImeListView : public TrayDetailsView { |  | 
| 18  public: |  | 
| 19   enum SingleImeBehavior { |  | 
| 20     // Shows the IME menu if there's only one IME in system. |  | 
| 21     SHOW_SINGLE_IME, |  | 
| 22     // Hides the IME menu if there's only one IME in system. |  | 
| 23     HIDE_SINGLE_IME |  | 
| 24   }; |  | 
| 25 |  | 
| 26   ImeListView(SystemTrayItem* owner); |  | 
| 27 |  | 
| 28   ~ImeListView() override; |  | 
| 29 |  | 
| 30   // Initializes the contents of a newly-instantiated ImeListView. |  | 
| 31   void Init(bool show_keyboard_toggle, SingleImeBehavior single_ime_behavior); |  | 
| 32 |  | 
| 33   // Updates the view. |  | 
| 34   virtual void Update(const IMEInfoList& list, |  | 
| 35                       const IMEPropertyInfoList& property_list, |  | 
| 36                       bool show_keyboard_toggle, |  | 
| 37                       SingleImeBehavior single_ime_behavior); |  | 
| 38 |  | 
| 39   // Removes (and destroys) all child views. |  | 
| 40   virtual void ResetImeListView(); |  | 
| 41 |  | 
| 42   // Closes the view. |  | 
| 43   void CloseImeListView(); |  | 
| 44 |  | 
| 45   void set_last_item_selected_with_keyboard( |  | 
| 46       bool last_item_selected_with_keyboard) { |  | 
| 47     last_item_selected_with_keyboard_ = last_item_selected_with_keyboard; |  | 
| 48   } |  | 
| 49 |  | 
| 50   void set_should_focus_ime_after_selection_with_keyboard( |  | 
| 51       const bool focus_current_ime) { |  | 
| 52     should_focus_ime_after_selection_with_keyboard_ = focus_current_ime; |  | 
| 53   } |  | 
| 54 |  | 
| 55   bool should_focus_ime_after_selection_with_keyboard() const { |  | 
| 56     return should_focus_ime_after_selection_with_keyboard_; |  | 
| 57   } |  | 
| 58 |  | 
| 59   // TrayDetailsView: |  | 
| 60   void HandleViewClicked(views::View* view) override; |  | 
| 61   void HandleButtonPressed(views::Button* sender, |  | 
| 62                            const ui::Event& event) override; |  | 
| 63 |  | 
| 64   // views::View: |  | 
| 65   void VisibilityChanged(View* starting_from, bool is_visible) override; |  | 
| 66 |  | 
| 67  private: |  | 
| 68   friend class ImeListViewTestApi; |  | 
| 69 |  | 
| 70   // Appends the IMEs to the scrollable area of the detailed view. |  | 
| 71   void AppendIMEList(const IMEInfoList& list); |  | 
| 72 |  | 
| 73   // Appends the IME listed to the scrollable area of the detailed view. |  | 
| 74   void AppendIMEProperties(const IMEPropertyInfoList& property_list); |  | 
| 75 |  | 
| 76   // Appends the IMEs and properties to the scrollable area  in the material |  | 
| 77   // design IME menu. |  | 
| 78   void AppendImeListAndProperties(const IMEInfoList& list, |  | 
| 79                                   const IMEPropertyInfoList& property_list); |  | 
| 80 |  | 
| 81   // Appends the on-screen keyboard status to the last area of the detailed |  | 
| 82   // view. |  | 
| 83   void AppendKeyboardStatus(); |  | 
| 84 |  | 
| 85   // Inserts the material on-screen keyboard status in the detailed view. |  | 
| 86   void PrependMaterialKeyboardStatus(); |  | 
| 87 |  | 
| 88   // Requests focus on the current IME if it was selected with keyboard so that |  | 
| 89   // accessible text will alert the user of the IME change. |  | 
| 90   void FocusCurrentImeIfNeeded(); |  | 
| 91 |  | 
| 92   std::map<views::View*, std::string> ime_map_; |  | 
| 93   std::map<views::View*, std::string> property_map_; |  | 
| 94   // On-screen keyboard view which is not used in material design. |  | 
| 95   views::View* keyboard_status_; |  | 
| 96   // On-screen keyboard view which is only used in material design. |  | 
| 97   MaterialKeyboardStatusRowView* material_keyboard_status_view_; |  | 
| 98 |  | 
| 99   // The id of the last item selected with keyboard. It will be empty if the |  | 
| 100   // item is not selected with keyboard. |  | 
| 101   std::string last_selected_item_id_; |  | 
| 102 |  | 
| 103   // True if the last item is selected with keyboard. |  | 
| 104   bool last_item_selected_with_keyboard_; |  | 
| 105 |  | 
| 106   // True if focus should be requested after switching IMEs with keyboard in |  | 
| 107   // order to trigger spoken feedback with ChromeVox enabled. |  | 
| 108   bool should_focus_ime_after_selection_with_keyboard_; |  | 
| 109 |  | 
| 110   // The item view of the current selected IME. |  | 
| 111   views::View* current_ime_view_; |  | 
| 112 |  | 
| 113   DISALLOW_COPY_AND_ASSIGN(ImeListView); |  | 
| 114 }; |  | 
| 115 |  | 
| 116 class ASH_EXPORT ImeListViewTestApi { |  | 
| 117  public: |  | 
| 118   explicit ImeListViewTestApi(ImeListView* ime_list_view); |  | 
| 119   virtual ~ImeListViewTestApi(); |  | 
| 120 |  | 
| 121   views::View* GetToggleView() const; |  | 
| 122 |  | 
| 123   const std::map<views::View*, std::string>& ime_map() const { |  | 
| 124     return ime_list_view_->ime_map_; |  | 
| 125   } |  | 
| 126 |  | 
| 127  private: |  | 
| 128   ImeListView* ime_list_view_; |  | 
| 129 |  | 
| 130   DISALLOW_COPY_AND_ASSIGN(ImeListViewTestApi); |  | 
| 131 }; |  | 
| 132 |  | 
| 133 }  // namespace ash |  | 
| 134 |  | 
| 135 #endif  // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_LIST_VIEW_H_ |  | 
| OLD | NEW | 
|---|