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 10 matching lines...) Expand all Loading... |
21 namespace views { | 21 namespace views { |
22 | 22 |
23 namespace internal { | 23 namespace internal { |
24 class TrayBubbleContentMask; | 24 class TrayBubbleContentMask; |
25 } | 25 } |
26 | 26 |
27 // Specialized bubble view for bubbles associated with a tray icon (e.g. the | 27 // Specialized bubble view for bubbles associated with a tray icon (e.g. the |
28 // Ash status area). Mostly this handles custom anchor location and arrow and | 28 // Ash status area). Mostly this handles custom anchor location and arrow and |
29 // border rendering. This also has its own delegate for handling mouse events | 29 // border rendering. This also has its own delegate for handling mouse events |
30 // and other implementation specific details. | 30 // and other implementation specific details. |
31 class VIEWS_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView, | 31 class VIEWS_EXPORT TrayBubbleView : public BubbleDialogDelegateView, |
32 public views::MouseWatcherListener { | 32 public MouseWatcherListener { |
33 public: | 33 public: |
34 // AnchorAlignment determines to which side of the anchor the bubble will | 34 // AnchorAlignment determines to which side of the anchor the bubble will |
35 // align itself. | 35 // align itself. |
36 enum AnchorAlignment { | 36 enum AnchorAlignment { |
37 ANCHOR_ALIGNMENT_BOTTOM, | 37 ANCHOR_ALIGNMENT_BOTTOM, |
38 ANCHOR_ALIGNMENT_LEFT, | 38 ANCHOR_ALIGNMENT_LEFT, |
39 ANCHOR_ALIGNMENT_RIGHT, | 39 ANCHOR_ALIGNMENT_RIGHT, |
40 }; | 40 }; |
41 | 41 |
42 class VIEWS_EXPORT Delegate { | 42 class VIEWS_EXPORT Delegate { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 SkColor bg_color; | 86 SkColor bg_color; |
87 }; | 87 }; |
88 | 88 |
89 // Constructs and returns a TrayBubbleView. |init_params| may be modified. | 89 // Constructs and returns a TrayBubbleView. |init_params| may be modified. |
90 static TrayBubbleView* Create(views::View* anchor, | 90 static TrayBubbleView* Create(views::View* anchor, |
91 Delegate* delegate, | 91 Delegate* delegate, |
92 InitParams* init_params); | 92 InitParams* init_params); |
93 | 93 |
94 ~TrayBubbleView() override; | 94 ~TrayBubbleView() override; |
95 | 95 |
| 96 // Returns whether a tray bubble is active. |
| 97 static bool IsATrayBubbleOpen(); |
| 98 |
96 // Sets up animations, and show the bubble. Must occur after CreateBubble() | 99 // Sets up animations, and show the bubble. Must occur after CreateBubble() |
97 // is called. | 100 // is called. |
98 void InitializeAndShowBubble(); | 101 void InitializeAndShowBubble(); |
99 | 102 |
100 // Called whenever the bubble size or location may have changed. | 103 // Called whenever the bubble size or location may have changed. |
101 void UpdateBubble(); | 104 void UpdateBubble(); |
102 | 105 |
103 // Sets the maximum bubble height and resizes the bubble. | 106 // Sets the maximum bubble height and resizes the bubble. |
104 void SetMaxHeight(int height); | 107 void SetMaxHeight(int height); |
105 | 108 |
(...skipping 17 matching lines...) Expand all Loading... |
123 // Overridden from views::WidgetDelegate. | 126 // Overridden from views::WidgetDelegate. |
124 views::NonClientFrameView* CreateNonClientFrameView( | 127 views::NonClientFrameView* CreateNonClientFrameView( |
125 views::Widget* widget) override; | 128 views::Widget* widget) override; |
126 bool WidgetHasHitTestMask() const override; | 129 bool WidgetHasHitTestMask() const override; |
127 void GetWidgetHitTestMask(gfx::Path* mask) const override; | 130 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
128 base::string16 GetAccessibleWindowTitle() const override; | 131 base::string16 GetAccessibleWindowTitle() const override; |
129 | 132 |
130 // Overridden from views::BubbleDialogDelegateView. | 133 // Overridden from views::BubbleDialogDelegateView. |
131 void OnBeforeBubbleWidgetInit(Widget::InitParams* params, | 134 void OnBeforeBubbleWidgetInit(Widget::InitParams* params, |
132 Widget* bubble_widget) const override; | 135 Widget* bubble_widget) const override; |
| 136 void OnWidgetClosing(Widget* widget) override; |
133 | 137 |
134 // Overridden from views::View. | 138 // Overridden from views::View. |
135 gfx::Size GetPreferredSize() const override; | 139 gfx::Size GetPreferredSize() const override; |
136 gfx::Size GetMaximumSize() const override; | 140 gfx::Size GetMaximumSize() const override; |
137 int GetHeightForWidth(int width) const override; | 141 int GetHeightForWidth(int width) const override; |
138 void OnMouseEntered(const ui::MouseEvent& event) override; | 142 void OnMouseEntered(const ui::MouseEvent& event) override; |
139 void OnMouseExited(const ui::MouseEvent& event) override; | 143 void OnMouseExited(const ui::MouseEvent& event) override; |
140 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 144 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
141 | 145 |
142 // Overridden from MouseWatcherListener | 146 // Overridden from MouseWatcherListener |
(...skipping 30 matching lines...) Expand all Loading... |
173 | 177 |
174 // Used to find any mouse movements. | 178 // Used to find any mouse movements. |
175 std::unique_ptr<MouseWatcher> mouse_watcher_; | 179 std::unique_ptr<MouseWatcher> mouse_watcher_; |
176 | 180 |
177 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 181 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
178 }; | 182 }; |
179 | 183 |
180 } // namespace views | 184 } // namespace views |
181 | 185 |
182 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 186 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
OLD | NEW |