OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 ANCHOR_ALIGNMENT_BOTTOM, | 41 ANCHOR_ALIGNMENT_BOTTOM, |
42 ANCHOR_ALIGNMENT_LEFT, | 42 ANCHOR_ALIGNMENT_LEFT, |
43 ANCHOR_ALIGNMENT_RIGHT, | 43 ANCHOR_ALIGNMENT_RIGHT, |
44 }; | 44 }; |
45 | 45 |
46 class VIEWS_EXPORT Delegate { | 46 class VIEWS_EXPORT Delegate { |
47 public: | 47 public: |
48 typedef TrayBubbleView::AnchorAlignment AnchorAlignment; | 48 typedef TrayBubbleView::AnchorAlignment AnchorAlignment; |
49 | 49 |
50 Delegate() {} | 50 Delegate() {} |
51 virtual ~Delegate() {} | 51 virtual ~Delegate(); |
52 | 52 |
53 // Called when the view is destroyed. Any pointers to the view should be | 53 // Called when the view is destroyed. Any pointers to the view should be |
54 // cleared when this gets called. | 54 // cleared when this gets called. |
55 virtual void BubbleViewDestroyed() = 0; | 55 virtual void BubbleViewDestroyed(); |
56 | 56 |
57 // Called when the mouse enters/exits the view. | 57 // Called when the mouse enters/exits the view. |
58 // Note: This event will only be called if the mouse gets actively moved by | 58 // Note: This event will only be called if the mouse gets actively moved by |
59 // the user to enter the view. | 59 // the user to enter the view. |
60 virtual void OnMouseEnteredView() = 0; | 60 virtual void OnMouseEnteredView(); |
61 virtual void OnMouseExitedView() = 0; | 61 virtual void OnMouseExitedView(); |
62 | 62 |
63 // Called to register/unregister accelerators for TrayBubbleView. | 63 // Called to register/unregister accelerators for TrayBubbleView. |
64 // TrayBubbleView wants to register those accelerators at the global level. | 64 // TrayBubbleView wants to register those accelerators at the global level. |
65 // Those accelerators are used to activate TrayBubbleView, i.e. those | 65 // Those accelerators are used to activate TrayBubbleView, i.e. those |
66 // accelerators need to be processed even if TrayBubbleView is not active. | 66 // accelerators need to be processed even if TrayBubbleView is not active. |
67 // UnregisterAllAccelerators can be called even if RegisterAccelerators is | 67 // UnregisterAllAccelerators can be called even if RegisterAccelerators is |
68 // not called. | 68 // not called. |
69 virtual void RegisterAccelerators( | 69 virtual void RegisterAccelerators( |
70 const std::vector<ui::Accelerator>& accelerators, | 70 const std::vector<ui::Accelerator>& accelerators, |
71 TrayBubbleView* tray_bubble_view) = 0; | 71 TrayBubbleView* tray_bubble_view); |
72 virtual void UnregisterAllAccelerators( | 72 virtual void UnregisterAllAccelerators(TrayBubbleView* tray_bubble_view); |
73 TrayBubbleView* tray_bubble_view) = 0; | |
74 | 73 |
75 // Called from GetAccessibleNodeData(); should return the appropriate | 74 // Called from GetAccessibleNodeData(); should return the appropriate |
76 // accessible name for the bubble. | 75 // accessible name for the bubble. |
77 virtual base::string16 GetAccessibleNameForBubble() = 0; | 76 virtual base::string16 GetAccessibleNameForBubble(); |
78 | 77 |
79 // Should return true if extra keyboard accessibility is enabled. | 78 // Should return true if extra keyboard accessibility is enabled. |
80 // TrayBubbleView will put focus on the default item if extra keyboard | 79 // TrayBubbleView will put focus on the default item if extra keyboard |
81 // accessibility is enabled. | 80 // accessibility is enabled. |
82 virtual bool ShouldEnableExtraKeyboardAccessibility() = 0; | 81 virtual bool ShouldEnableExtraKeyboardAccessibility(); |
83 | 82 |
84 // Called when a bubble wants to hide/destroy itself (e.g. last visible | 83 // Called when a bubble wants to hide/destroy itself (e.g. last visible |
85 // child view was closed). | 84 // child view was closed). |
86 virtual void HideBubble(const TrayBubbleView* bubble_view) = 0; | 85 virtual void HideBubble(const TrayBubbleView* bubble_view); |
| 86 |
| 87 // Called to process the gesture events that happened on the TrayBubbleView. |
| 88 // Swiping down on the opened TrayBubbleView to close the bubble. |
| 89 virtual void ProcessGestureEventForBubble(ui::GestureEvent* event); |
87 | 90 |
88 private: | 91 private: |
89 DISALLOW_COPY_AND_ASSIGN(Delegate); | 92 DISALLOW_COPY_AND_ASSIGN(Delegate); |
90 }; | 93 }; |
91 | 94 |
92 struct VIEWS_EXPORT InitParams { | 95 struct VIEWS_EXPORT InitParams { |
93 InitParams(); | 96 InitParams(); |
94 InitParams(const InitParams& other); | 97 InitParams(const InitParams& other); |
95 Delegate* delegate = nullptr; | 98 Delegate* delegate = nullptr; |
96 gfx::NativeWindow parent_window = nullptr; | 99 gfx::NativeWindow parent_window = nullptr; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Widget* bubble_widget) const override; | 154 Widget* bubble_widget) const override; |
152 void OnWidgetClosing(Widget* widget) override; | 155 void OnWidgetClosing(Widget* widget) override; |
153 | 156 |
154 // Overridden from views::View. | 157 // Overridden from views::View. |
155 gfx::Size CalculatePreferredSize() const override; | 158 gfx::Size CalculatePreferredSize() const override; |
156 gfx::Size GetMaximumSize() const override; | 159 gfx::Size GetMaximumSize() const override; |
157 int GetHeightForWidth(int width) const override; | 160 int GetHeightForWidth(int width) const override; |
158 void OnMouseEntered(const ui::MouseEvent& event) override; | 161 void OnMouseEntered(const ui::MouseEvent& event) override; |
159 void OnMouseExited(const ui::MouseEvent& event) override; | 162 void OnMouseExited(const ui::MouseEvent& event) override; |
160 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 163 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 164 void OnGestureEvent(ui::GestureEvent* event) override; |
161 | 165 |
162 // Overridden from MouseWatcherListener | 166 // Overridden from MouseWatcherListener |
163 void MouseMovedOutOfHost() override; | 167 void MouseMovedOutOfHost() override; |
164 | 168 |
165 // Overridden from ui::AcceleratorTarget | 169 // Overridden from ui::AcceleratorTarget |
166 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 170 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
167 | 171 |
168 protected: | 172 protected: |
169 // Overridden from views::BubbleDialogDelegateView. | 173 // Overridden from views::BubbleDialogDelegateView. |
170 int GetDialogButtons() const override; | 174 int GetDialogButtons() const override; |
(...skipping 28 matching lines...) Expand all Loading... |
199 | 203 |
200 // Used to find any mouse movements. | 204 // Used to find any mouse movements. |
201 std::unique_ptr<MouseWatcher> mouse_watcher_; | 205 std::unique_ptr<MouseWatcher> mouse_watcher_; |
202 | 206 |
203 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 207 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
204 }; | 208 }; |
205 | 209 |
206 } // namespace views | 210 } // namespace views |
207 | 211 |
208 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 212 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
OLD | NEW |