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_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | |
6 #define ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/system/ime/ime_observer.h" | |
10 #include "ash/system/tray/ime_info.h" | |
11 #include "ash/system/tray/tray_background_view.h" | |
12 #include "ash/system/tray/tray_bubble_wrapper.h" | |
13 #include "ash/system/virtual_keyboard/virtual_keyboard_observer.h" | |
14 #include "base/macros.h" | |
15 #include "ui/keyboard/keyboard_controller_observer.h" | |
16 #include "ui/views/bubble/tray_bubble_view.h" | |
17 | |
18 namespace views { | |
19 class Label; | |
20 } // namespace views | |
21 | |
22 namespace ash { | |
23 class ImeListView; | |
24 | |
25 // The tray item for IME menu, which shows the detailed view of a null single | |
26 // item. | |
27 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView, | |
28 public IMEObserver, | |
29 public views::TrayBubbleView::Delegate, | |
30 public keyboard::KeyboardControllerObserver, | |
31 public VirtualKeyboardObserver { | |
32 public: | |
33 explicit ImeMenuTray(WmShelf* wm_shelf); | |
34 ~ImeMenuTray() override; | |
35 | |
36 // Shows the IME menu bubble and highlights the button. | |
37 void ShowImeMenuBubble(); | |
38 | |
39 // Hides the IME menu bubble and lowlights the button. | |
40 void HideImeMenuBubble(); | |
41 | |
42 // Returns true if the IME menu bubble has been shown. | |
43 bool IsImeMenuBubbleShown(); | |
44 | |
45 // Shows the virtual keyboard with the given keyset: emoji, handwriting or | |
46 // voice. | |
47 void ShowKeyboardWithKeyset(const std::string& keyset); | |
48 | |
49 // Returns true if it should block the auto hide behavior of the shelf. | |
50 bool ShouldBlockShelfAutoHide() const; | |
51 | |
52 // Returns true if the menu should show emoji, handwriting and voice buttons | |
53 // on the bottom. Otherwise, the menu will show a 'Customize...' bottom row | |
54 // for non-MD UI, and a Settings button in the title row for MD. | |
55 bool ShouldShowEmojiHandwritingVoiceButtons() const; | |
56 | |
57 // Returns whether the virtual keyboard toggle should be shown in shown in the | |
58 // opt-in IME menu. | |
59 bool ShouldShowKeyboardToggle() const; | |
60 | |
61 // TrayBackgroundView: | |
62 void SetShelfAlignment(ShelfAlignment alignment) override; | |
63 base::string16 GetAccessibleNameForTray() override; | |
64 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | |
65 void ClickedOutsideBubble() override; | |
66 bool PerformAction(const ui::Event& event) override; | |
67 | |
68 // IMEObserver: | |
69 void OnIMERefresh() override; | |
70 void OnIMEMenuActivationChanged(bool is_activated) override; | |
71 | |
72 // views::TrayBubbleView::Delegate: | |
73 void BubbleViewDestroyed() override; | |
74 void OnMouseEnteredView() override; | |
75 void OnMouseExitedView() override; | |
76 base::string16 GetAccessibleNameForBubble() override; | |
77 void OnBeforeBubbleWidgetInit( | |
78 views::Widget* anchor_widget, | |
79 views::Widget* bubble_widget, | |
80 views::Widget::InitParams* params) const override; | |
81 void HideBubble(const views::TrayBubbleView* bubble_view) override; | |
82 | |
83 // keyboard::KeyboardControllerObserver: | |
84 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | |
85 void OnKeyboardClosed() override; | |
86 void OnKeyboardHidden() override; | |
87 | |
88 // VirtualKeyboardObserver: | |
89 void OnKeyboardSuppressionChanged(bool suppressed) override; | |
90 | |
91 private: | |
92 // To allow the test class to access |label_|. | |
93 friend class ImeMenuTrayTest; | |
94 | |
95 // Show the IME menu bubble immediately. | |
96 void ShowImeMenuBubbleInternal(); | |
97 | |
98 // Updates the text of the label on the tray. | |
99 void UpdateTrayLabel(); | |
100 | |
101 // Bubble for default and detailed views. | |
102 std::unique_ptr<TrayBubbleWrapper> bubble_; | |
103 ImeListView* ime_list_view_; | |
104 | |
105 views::Label* label_; | |
106 IMEInfo current_ime_; | |
107 bool show_keyboard_; | |
108 bool force_show_keyboard_; | |
109 bool should_block_shelf_auto_hide_; | |
110 bool keyboard_suppressed_; | |
111 bool show_bubble_after_keyboard_hidden_; | |
112 | |
113 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); | |
114 }; | |
115 | |
116 } // namespace ash | |
117 | |
118 #endif // ASH_SYSTEM_IME_MENU_IME_MENU_TRAY_H_ | |
OLD | NEW |