| 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_MENU_TRAY_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/system/ime/ime_observer.h" | 9 #include "ash/common/system/ime/ime_observer.h" |
| 10 #include "ash/common/system/tray/ime_info.h" | 10 #include "ash/common/system/tray/ime_info.h" |
| 11 #include "ash/common/system/tray/tray_background_view.h" | 11 #include "ash/common/system/tray/tray_background_view.h" |
| 12 #include "ash/common/system/tray/tray_bubble_wrapper.h" | 12 #include "ash/common/system/tray/tray_bubble_wrapper.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/keyboard/keyboard_controller_observer.h" |
| 14 #include "ui/views/bubble/tray_bubble_view.h" | 15 #include "ui/views/bubble/tray_bubble_view.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class Label; | 18 class Label; |
| 18 } // namespace views | 19 } // namespace views |
| 19 | 20 |
| 20 namespace ash { | 21 namespace ash { |
| 21 class ImeListView; | 22 class ImeListView; |
| 22 class StatusAreaWidget; | 23 class StatusAreaWidget; |
| 23 class WmWindow; | 24 class WmWindow; |
| 24 | 25 |
| 25 // The tray item for IME menu, which shows the detailed view of a null single | 26 // The tray item for IME menu, which shows the detailed view of a null single |
| 26 // item. | 27 // item. |
| 27 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView, | 28 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView, |
| 28 public IMEObserver, | 29 public IMEObserver, |
| 29 public views::TrayBubbleView::Delegate { | 30 public views::TrayBubbleView::Delegate, |
| 31 public keyboard::KeyboardControllerObserver { |
| 30 public: | 32 public: |
| 31 explicit ImeMenuTray(WmShelf* wm_shelf); | 33 explicit ImeMenuTray(WmShelf* wm_shelf); |
| 32 ~ImeMenuTray() override; | 34 ~ImeMenuTray() override; |
| 33 | 35 |
| 34 // Shows the IME menu bubble and highlights the button. | 36 // Shows the IME menu bubble and highlights the button. |
| 35 void ShowImeMenuBubble(); | 37 void ShowImeMenuBubble(); |
| 36 | 38 |
| 39 // Hides the IME menu bubble and lowlights the button. |
| 40 void HideImeMenuBubble(); |
| 41 |
| 37 // Returns true if the IME menu bubble has been shown. | 42 // Returns true if the IME menu bubble has been shown. |
| 38 bool IsImeMenuBubbleShown(); | 43 bool IsImeMenuBubbleShown(); |
| 39 | 44 |
| 45 // Shows the virtual keyboard with the given keyset: emoji, handwriting or |
| 46 // voice. |
| 47 void ShowKeyboardWithKeyset(const std::string& keyset); |
| 48 |
| 40 // TrayBackgroundView: | 49 // TrayBackgroundView: |
| 41 void SetShelfAlignment(ShelfAlignment alignment) override; | 50 void SetShelfAlignment(ShelfAlignment alignment) override; |
| 42 base::string16 GetAccessibleNameForTray() override; | 51 base::string16 GetAccessibleNameForTray() override; |
| 43 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | 52 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; |
| 44 void ClickedOutsideBubble() override; | 53 void ClickedOutsideBubble() override; |
| 45 bool PerformAction(const ui::Event& event) override; | 54 bool PerformAction(const ui::Event& event) override; |
| 46 | 55 |
| 47 // IMEObserver: | 56 // IMEObserver: |
| 48 void OnIMERefresh() override; | 57 void OnIMERefresh() override; |
| 49 void OnIMEMenuActivationChanged(bool is_activated) override; | 58 void OnIMEMenuActivationChanged(bool is_activated) override; |
| 50 | 59 |
| 51 // views::TrayBubbleView::Delegate: | 60 // views::TrayBubbleView::Delegate: |
| 52 void BubbleViewDestroyed() override; | 61 void BubbleViewDestroyed() override; |
| 53 void OnMouseEnteredView() override; | 62 void OnMouseEnteredView() override; |
| 54 void OnMouseExitedView() override; | 63 void OnMouseExitedView() override; |
| 55 base::string16 GetAccessibleNameForBubble() override; | 64 base::string16 GetAccessibleNameForBubble() override; |
| 56 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, | 65 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, |
| 57 AnchorType anchor_type, | 66 AnchorType anchor_type, |
| 58 AnchorAlignment anchor_alignment) const override; | 67 AnchorAlignment anchor_alignment) const override; |
| 59 void OnBeforeBubbleWidgetInit( | 68 void OnBeforeBubbleWidgetInit( |
| 60 views::Widget* anchor_widget, | 69 views::Widget* anchor_widget, |
| 61 views::Widget* bubble_widget, | 70 views::Widget* bubble_widget, |
| 62 views::Widget::InitParams* params) const override; | 71 views::Widget::InitParams* params) const override; |
| 63 void HideBubble(const views::TrayBubbleView* bubble_view) override; | 72 void HideBubble(const views::TrayBubbleView* bubble_view) override; |
| 64 | 73 |
| 74 // keyboard::KeyboardControllerObserver: |
| 75 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 76 void OnKeyboardClosed() override; |
| 77 void OnKeyboardHidden() override; |
| 78 |
| 65 private: | 79 private: |
| 66 // To allow the test class to access |label_|. | 80 // To allow the test class to access |label_|. |
| 67 friend class ImeMenuTrayTest; | 81 friend class ImeMenuTrayTest; |
| 68 | 82 |
| 69 // Updates the text of the label on the tray. | 83 // Updates the text of the label on the tray. |
| 70 void UpdateTrayLabel(); | 84 void UpdateTrayLabel(); |
| 71 | 85 |
| 72 // Hides the IME menu bubble and lowlights the button. | |
| 73 void HideImeMenuBubble(); | |
| 74 | |
| 75 // Bubble for default and detailed views. | 86 // Bubble for default and detailed views. |
| 76 std::unique_ptr<TrayBubbleWrapper> bubble_; | 87 std::unique_ptr<TrayBubbleWrapper> bubble_; |
| 77 ImeListView* ime_list_view_; | 88 ImeListView* ime_list_view_; |
| 78 | 89 |
| 79 views::Label* label_; | 90 views::Label* label_; |
| 80 IMEInfo current_ime_; | 91 IMEInfo current_ime_; |
| 92 bool show_keyboard_; |
| 93 bool force_show_keyboard_; |
| 81 | 94 |
| 82 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); | 95 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); |
| 83 }; | 96 }; |
| 84 | 97 |
| 85 } // namespace ash | 98 } // namespace ash |
| 86 | 99 |
| 87 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ | 100 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ |
| OLD | NEW |