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

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
« no previous file with comments | « no previous file | ash/common/system/chromeos/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
52 // Returns true if the menu should show emoji, handwriting and voice buttons 54 // 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 55 // 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. 56 // for non-MD UI, and a Settings button in the title row for MD.
55 bool ShouldShowEmojiHandwritingVoiceButtons() const; 57 bool ShouldShowEmojiHandwritingVoiceButtons() const;
56 58
59 // Returns whether the virtual keyboard toggle should be shown in shown in the
60 // opt-in IME menu.
61 bool ShouldShowKeyboardToggle() const;
62
57 // TrayBackgroundView: 63 // TrayBackgroundView:
58 void SetShelfAlignment(ShelfAlignment alignment) override; 64 void SetShelfAlignment(ShelfAlignment alignment) override;
59 base::string16 GetAccessibleNameForTray() override; 65 base::string16 GetAccessibleNameForTray() override;
60 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; 66 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
61 void ClickedOutsideBubble() override; 67 void ClickedOutsideBubble() override;
62 bool PerformAction(const ui::Event& event) override; 68 bool PerformAction(const ui::Event& event) override;
63 69
64 // IMEObserver: 70 // IMEObserver:
65 void OnIMERefresh() override; 71 void OnIMERefresh() override;
66 void OnIMEMenuActivationChanged(bool is_activated) override; 72 void OnIMEMenuActivationChanged(bool is_activated) override;
67 73
68 // views::TrayBubbleView::Delegate: 74 // views::TrayBubbleView::Delegate:
69 void BubbleViewDestroyed() override; 75 void BubbleViewDestroyed() override;
70 void OnMouseEnteredView() override; 76 void OnMouseEnteredView() override;
71 void OnMouseExitedView() override; 77 void OnMouseExitedView() override;
72 base::string16 GetAccessibleNameForBubble() override; 78 base::string16 GetAccessibleNameForBubble() override;
73 void OnBeforeBubbleWidgetInit( 79 void OnBeforeBubbleWidgetInit(
74 views::Widget* anchor_widget, 80 views::Widget* anchor_widget,
75 views::Widget* bubble_widget, 81 views::Widget* bubble_widget,
76 views::Widget::InitParams* params) const override; 82 views::Widget::InitParams* params) const override;
77 void HideBubble(const views::TrayBubbleView* bubble_view) override; 83 void HideBubble(const views::TrayBubbleView* bubble_view) override;
78 84
79 // keyboard::KeyboardControllerObserver: 85 // keyboard::KeyboardControllerObserver:
80 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 86 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
81 void OnKeyboardClosed() override; 87 void OnKeyboardClosed() override;
82 void OnKeyboardHidden() override; 88 void OnKeyboardHidden() override;
83 89
90 // VirtualKeyboardObserver:
91 void OnKeyboardSuppressionChanged(bool suppressed) override;
92
84 private: 93 private:
85 // To allow the test class to access |label_|. 94 // To allow the test class to access |label_|.
86 friend class ImeMenuTrayTest; 95 friend class ImeMenuTrayTest;
87 96
88 // Updates the text of the label on the tray. 97 // Updates the text of the label on the tray.
89 void UpdateTrayLabel(); 98 void UpdateTrayLabel();
90 99
91 // Bubble for default and detailed views. 100 // Bubble for default and detailed views.
92 std::unique_ptr<TrayBubbleWrapper> bubble_; 101 std::unique_ptr<TrayBubbleWrapper> bubble_;
93 ImeListView* ime_list_view_; 102 ImeListView* ime_list_view_;
94 103
95 views::Label* label_; 104 views::Label* label_;
96 IMEInfo current_ime_; 105 IMEInfo current_ime_;
97 bool show_keyboard_; 106 bool show_keyboard_;
98 bool force_show_keyboard_; 107 bool force_show_keyboard_;
99 bool should_block_shelf_auto_hide_; 108 bool should_block_shelf_auto_hide_;
109 bool keyboard_suppressed_;
100 110
101 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray); 111 DISALLOW_COPY_AND_ASSIGN(ImeMenuTray);
102 }; 112 };
103 113
104 } // namespace ash 114 } // namespace ash
105 115
106 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_ 116 #endif // ASH_COMMON_SYSTEM_CHROMEOS_IME_MENU_IME_MENU_TRAY_H_
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/chromeos/ime_menu/ime_menu_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698