Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.h

Issue 2474843002: Add virtual keyboard item into opt-in IME menu. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chromeos/virtual_keyboard/virtual_keyboard_observer. h"
9 #include "ash/common/system/ime/ime_observer.h" 10 #include "ash/common/system/ime/ime_observer.h"
10 #include "ash/common/system/tray/ime_info.h" 11 #include "ash/common/system/tray/ime_info.h"
11 #include "ash/common/system/tray/tray_background_view.h" 12 #include "ash/common/system/tray/tray_background_view.h"
12 #include "ash/common/system/tray/tray_bubble_wrapper.h" 13 #include "ash/common/system/tray/tray_bubble_wrapper.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "ui/keyboard/keyboard_controller_observer.h" 15 #include "ui/keyboard/keyboard_controller_observer.h"
15 #include "ui/views/bubble/tray_bubble_view.h" 16 #include "ui/views/bubble/tray_bubble_view.h"
16 17
17 namespace views { 18 namespace views {
18 class Label; 19 class Label;
19 } // namespace views 20 } // namespace views
20 21
21 namespace ash { 22 namespace ash {
22 class ImeListView; 23 class ImeListView;
23 class StatusAreaWidget; 24 class StatusAreaWidget;
24 class WmWindow; 25 class WmWindow;
25 26
26 // The tray item for IME menu, which shows the detailed view of a null single 27 // The tray item for IME menu, which shows the detailed view of a null single
27 // item. 28 // item.
28 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView, 29 class ASH_EXPORT ImeMenuTray : public TrayBackgroundView,
29 public IMEObserver, 30 public IMEObserver,
30 public views::TrayBubbleView::Delegate, 31 public views::TrayBubbleView::Delegate,
31 public keyboard::KeyboardControllerObserver { 32 public keyboard::KeyboardControllerObserver,
33 public VirtualKeyboardObserver {
32 public: 34 public:
33 explicit ImeMenuTray(WmShelf* wm_shelf); 35 explicit ImeMenuTray(WmShelf* wm_shelf);
34 ~ImeMenuTray() override; 36 ~ImeMenuTray() override;
35 37
36 // Shows the IME menu bubble and highlights the button. 38 // Shows the IME menu bubble and highlights the button.
37 void ShowImeMenuBubble(); 39 void ShowImeMenuBubble();
38 40
39 // Hides the IME menu bubble and lowlights the button. 41 // Hides the IME menu bubble and lowlights the button.
40 void HideImeMenuBubble(); 42 void HideImeMenuBubble();
41 43
42 // Returns true if the IME menu bubble has been shown. 44 // Returns true if the IME menu bubble has been shown.
43 bool IsImeMenuBubbleShown(); 45 bool IsImeMenuBubbleShown();
44 46
45 // Shows the virtual keyboard with the given keyset: emoji, handwriting or 47 // Shows the virtual keyboard with the given keyset: emoji, handwriting or
46 // voice. 48 // voice.
47 void ShowKeyboardWithKeyset(const std::string& keyset); 49 void ShowKeyboardWithKeyset(const std::string& keyset);
48 50
49 // Returns true if it should block the auto hide behavior of the shelf. 51 // Returns true if it should block the auto hide behavior of the shelf.
50 bool ShouldBlockShelfAutoHide() const; 52 bool ShouldBlockShelfAutoHide() const;
51 53
54 // Returns whether the virtual keyboard toggle should be shown in the
55 // detailed view.
56 bool ShouldShowKeyboardToggle() const;
57
52 // TrayBackgroundView: 58 // TrayBackgroundView:
53 void SetShelfAlignment(ShelfAlignment alignment) override; 59 void SetShelfAlignment(ShelfAlignment alignment) override;
54 base::string16 GetAccessibleNameForTray() override; 60 base::string16 GetAccessibleNameForTray() override;
55 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; 61 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
56 void ClickedOutsideBubble() override; 62 void ClickedOutsideBubble() override;
57 bool PerformAction(const ui::Event& event) override; 63 bool PerformAction(const ui::Event& event) override;
58 64
59 // IMEObserver: 65 // IMEObserver:
60 void OnIMERefresh() override; 66 void OnIMERefresh() override;
61 void OnIMEMenuActivationChanged(bool is_activated) override; 67 void OnIMEMenuActivationChanged(bool is_activated) override;
(...skipping 10 matching lines...) Expand all
72 views::Widget* anchor_widget, 78 views::Widget* anchor_widget,
73 views::Widget* bubble_widget, 79 views::Widget* bubble_widget,
74 views::Widget::InitParams* params) const override; 80 views::Widget::InitParams* params) const override;
75 void HideBubble(const views::TrayBubbleView* bubble_view) override; 81 void HideBubble(const views::TrayBubbleView* bubble_view) override;
76 82
77 // keyboard::KeyboardControllerObserver: 83 // keyboard::KeyboardControllerObserver:
78 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 84 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
79 void OnKeyboardClosed() override; 85 void OnKeyboardClosed() override;
80 void OnKeyboardHidden() override; 86 void OnKeyboardHidden() override;
81 87
88 // VirtualKeyboardObserver.
89 void OnKeyboardSuppressionChanged(bool suppressed) override;
90
82 private: 91 private:
83 // To allow the test class to access |label_|. 92 // To allow the test class to access |label_|.
84 friend class ImeMenuTrayTest; 93 friend class ImeMenuTrayTest;
85 94
86 // Updates the text of the label on the tray. 95 // Updates the text of the label on the tray.
87 void UpdateTrayLabel(); 96 void UpdateTrayLabel();
88 97
89 // Bubble for default and detailed views. 98 // Bubble for default and detailed views.
90 std::unique_ptr<TrayBubbleWrapper> bubble_; 99 std::unique_ptr<TrayBubbleWrapper> bubble_;
91 ImeListView* ime_list_view_; 100 ImeListView* ime_list_view_;
92 101
93 views::Label* label_; 102 views::Label* label_;
94 IMEInfo current_ime_; 103 IMEInfo current_ime_;
95 bool show_keyboard_; 104 bool show_keyboard_;
96 bool force_show_keyboard_; 105 bool force_show_keyboard_;
97 bool should_block_shelf_auto_hide_; 106 bool should_block_shelf_auto_hide_;
107 bool keyboard_suppressed_;
98 108
99 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); 109 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray);
100 }; 110 };
101 111
102 } // namespace ash 112 } // namespace ash
103 113
104 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ 114 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698