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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // accessible name for the bubble. | 74 // accessible name for the bubble. |
75 virtual base::string16 GetAccessibleNameForBubble() = 0; | 75 virtual base::string16 GetAccessibleNameForBubble() = 0; |
76 | 76 |
77 // Passes responsibility for BubbleDialogDelegateView::GetAnchorRect to the | 77 // Passes responsibility for BubbleDialogDelegateView::GetAnchorRect to the |
78 // delegate. | 78 // delegate. |
79 virtual gfx::Rect GetAnchorRect( | 79 virtual gfx::Rect GetAnchorRect( |
80 views::Widget* anchor_widget, | 80 views::Widget* anchor_widget, |
81 AnchorType anchor_type, | 81 AnchorType anchor_type, |
82 AnchorAlignment anchor_alignment) const = 0; | 82 AnchorAlignment anchor_alignment) const = 0; |
83 | 83 |
| 84 // Called before Widget::Init() on |bubble_widget|. Allows |params| to be |
| 85 // modified. |
| 86 virtual void OnBeforeBubbleWidgetInit(Widget* anchor_widget, |
| 87 Widget* bubble_widget, |
| 88 Widget::InitParams* params) const = 0; |
| 89 |
84 // Called when a bubble wants to hide/destroy itself (e.g. last visible | 90 // Called when a bubble wants to hide/destroy itself (e.g. last visible |
85 // child view was closed). | 91 // child view was closed). |
86 virtual void HideBubble(const TrayBubbleView* bubble_view) = 0; | 92 virtual void HideBubble(const TrayBubbleView* bubble_view) = 0; |
87 | 93 |
88 private: | 94 private: |
89 DISALLOW_COPY_AND_ASSIGN(Delegate); | 95 DISALLOW_COPY_AND_ASSIGN(Delegate); |
90 }; | 96 }; |
91 | 97 |
92 struct VIEWS_EXPORT InitParams { | 98 struct VIEWS_EXPORT InitParams { |
93 static const int kArrowDefaultOffset; | 99 static const int kArrowDefaultOffset; |
(...skipping 12 matching lines...) Expand all Loading... |
106 bool close_on_deactivate; | 112 bool close_on_deactivate; |
107 SkColor arrow_color; | 113 SkColor arrow_color; |
108 bool first_item_has_no_margin; | 114 bool first_item_has_no_margin; |
109 views::BubbleBorder::Arrow arrow; | 115 views::BubbleBorder::Arrow arrow; |
110 int arrow_offset; | 116 int arrow_offset; |
111 views::BubbleBorder::ArrowPaintType arrow_paint_type; | 117 views::BubbleBorder::ArrowPaintType arrow_paint_type; |
112 views::BubbleBorder::Shadow shadow; | 118 views::BubbleBorder::Shadow shadow; |
113 views::BubbleBorder::BubbleAlignment arrow_alignment; | 119 views::BubbleBorder::BubbleAlignment arrow_alignment; |
114 }; | 120 }; |
115 | 121 |
116 // Constructs and returns a TrayBubbleView. init_params may be modified. | 122 // Constructs and returns a TrayBubbleView. |init_params| may be modified. |
117 static TrayBubbleView* Create(gfx::NativeView parent_window, | 123 static TrayBubbleView* Create(views::View* anchor, |
118 views::View* anchor, | |
119 Delegate* delegate, | 124 Delegate* delegate, |
120 InitParams* init_params); | 125 InitParams* init_params); |
121 | 126 |
122 ~TrayBubbleView() override; | 127 ~TrayBubbleView() override; |
123 | 128 |
124 // Sets up animations, and show the bubble. Must occur after CreateBubble() | 129 // Sets up animations, and show the bubble. Must occur after CreateBubble() |
125 // is called. | 130 // is called. |
126 void InitializeAndShowBubble(); | 131 void InitializeAndShowBubble(); |
127 | 132 |
128 // Called whenever the bubble size or location may have changed. | 133 // Called whenever the bubble size or location may have changed. |
(...skipping 21 matching lines...) Expand all Loading... |
150 | 155 |
151 // Overridden from views::WidgetDelegate. | 156 // Overridden from views::WidgetDelegate. |
152 bool CanActivate() const override; | 157 bool CanActivate() const override; |
153 views::NonClientFrameView* CreateNonClientFrameView( | 158 views::NonClientFrameView* CreateNonClientFrameView( |
154 views::Widget* widget) override; | 159 views::Widget* widget) override; |
155 bool WidgetHasHitTestMask() const override; | 160 bool WidgetHasHitTestMask() const override; |
156 void GetWidgetHitTestMask(gfx::Path* mask) const override; | 161 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
157 | 162 |
158 // Overridden from views::BubbleDialogDelegateView. | 163 // Overridden from views::BubbleDialogDelegateView. |
159 gfx::Rect GetAnchorRect() const override; | 164 gfx::Rect GetAnchorRect() const override; |
| 165 void OnBeforeBubbleWidgetInit(Widget::InitParams* params, |
| 166 Widget* bubble_widget) const override; |
160 | 167 |
161 // Overridden from views::View. | 168 // Overridden from views::View. |
162 gfx::Size GetPreferredSize() const override; | 169 gfx::Size GetPreferredSize() const override; |
163 gfx::Size GetMaximumSize() const override; | 170 gfx::Size GetMaximumSize() const override; |
164 int GetHeightForWidth(int width) const override; | 171 int GetHeightForWidth(int width) const override; |
165 void OnMouseEntered(const ui::MouseEvent& event) override; | 172 void OnMouseEntered(const ui::MouseEvent& event) override; |
166 void OnMouseExited(const ui::MouseEvent& event) override; | 173 void OnMouseExited(const ui::MouseEvent& event) override; |
167 void GetAccessibleState(ui::AXViewState* state) override; | 174 void GetAccessibleState(ui::AXViewState* state) override; |
168 | 175 |
169 // Overridden from MouseWatcherListener | 176 // Overridden from MouseWatcherListener |
170 void MouseMovedOutOfHost() override; | 177 void MouseMovedOutOfHost() override; |
171 | 178 |
172 protected: | 179 protected: |
173 TrayBubbleView(gfx::NativeView parent_window, | 180 TrayBubbleView(views::View* anchor, |
174 views::View* anchor, | |
175 Delegate* delegate, | 181 Delegate* delegate, |
176 const InitParams& init_params); | 182 const InitParams& init_params); |
177 | 183 |
178 // Overridden from views::BubbleDialogDelegateView. | 184 // Overridden from views::BubbleDialogDelegateView. |
179 int GetDialogButtons() const override; | 185 int GetDialogButtons() const override; |
180 void Init() override; | 186 void Init() override; |
181 | 187 |
182 // Overridden from views::View. | 188 // Overridden from views::View. |
183 void ChildPreferredSizeChanged(View* child) override; | 189 void ChildPreferredSizeChanged(View* child) override; |
184 void ViewHierarchyChanged( | 190 void ViewHierarchyChanged( |
(...skipping 16 matching lines...) Expand all Loading... |
201 | 207 |
202 // Used to find any mouse movements. | 208 // Used to find any mouse movements. |
203 std::unique_ptr<MouseWatcher> mouse_watcher_; | 209 std::unique_ptr<MouseWatcher> mouse_watcher_; |
204 | 210 |
205 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 211 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
206 }; | 212 }; |
207 | 213 |
208 } // namespace views | 214 } // namespace views |
209 | 215 |
210 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 216 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
OLD | NEW |