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_BUBBLE_DELEGATE_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "ui/gfx/animation/animation_delegate.h" | 9 #include "ui/gfx/animation/animation_delegate.h" |
10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 #include "ui/views/widget/widget_delegate.h" | 12 #include "ui/views/widget/widget_delegate.h" |
13 #include "ui/views/widget/widget_observer.h" | 13 #include "ui/views/widget/widget_observer.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Rect; | 16 class Rect; |
17 class SlideAnimation; | 17 class SlideAnimation; |
18 } | 18 } |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 class BubbleBorderDelegate; | |
23 class BubbleFrameView; | 22 class BubbleFrameView; |
24 | 23 |
25 // BubbleDelegateView creates frame and client views for bubble Widgets. | 24 // BubbleDelegateView creates frame and client views for bubble Widgets. |
26 // BubbleDelegateView itself is the client's contents view. | 25 // BubbleDelegateView itself is the client's contents view. |
27 // | |
28 /////////////////////////////////////////////////////////////////////////////// | |
29 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, | 26 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, |
30 public gfx::AnimationDelegate, | 27 public gfx::AnimationDelegate, |
31 public WidgetObserver { | 28 public WidgetObserver { |
32 public: | 29 public: |
33 BubbleDelegateView(); | 30 BubbleDelegateView(); |
34 BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); | 31 BubbleDelegateView(View* anchor_view, BubbleBorder::Arrow arrow); |
35 virtual ~BubbleDelegateView(); | 32 virtual ~BubbleDelegateView(); |
36 | 33 |
37 // Create and initialize the bubble Widget(s) with proper bounds. | 34 // Create and initialize the bubble Widget(s) with proper bounds. |
38 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); | 35 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 160 |
164 private: | 161 private: |
165 friend class BubbleBorderDelegate; | 162 friend class BubbleBorderDelegate; |
166 | 163 |
167 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); | 164 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); |
168 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest); | 165 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest); |
169 | 166 |
170 // Update the bubble color from |theme|, unless it was explicitly set. | 167 // Update the bubble color from |theme|, unless it was explicitly set. |
171 void UpdateColorsFromTheme(const ui::NativeTheme* theme); | 168 void UpdateColorsFromTheme(const ui::NativeTheme* theme); |
172 | 169 |
173 #if defined(OS_WIN) && !defined(USE_AURA) | |
174 // Get bounds for the Windows-only widget that hosts the bubble's contents. | |
175 gfx::Rect GetBubbleClientBounds() const; | |
176 #endif | |
177 | |
178 // Handles widget visibility changes. | 170 // Handles widget visibility changes. |
179 void HandleVisibilityChanged(Widget* widget, bool visible); | 171 void HandleVisibilityChanged(Widget* widget, bool visible); |
180 | 172 |
181 // Fade animation for bubble. | 173 // Fade animation for bubble. |
182 scoped_ptr<gfx::SlideAnimation> fade_animation_; | 174 scoped_ptr<gfx::SlideAnimation> fade_animation_; |
183 | 175 |
184 // Flags controlling bubble closure on the escape key and deactivation. | 176 // Flags controlling bubble closure on the escape key and deactivation. |
185 bool close_on_esc_; | 177 bool close_on_esc_; |
186 bool close_on_deactivate_; | 178 bool close_on_deactivate_; |
187 | 179 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 224 |
233 // Parent native window of the bubble. | 225 // Parent native window of the bubble. |
234 gfx::NativeView parent_window_; | 226 gfx::NativeView parent_window_; |
235 | 227 |
236 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 228 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
237 }; | 229 }; |
238 | 230 |
239 } // namespace views | 231 } // namespace views |
240 | 232 |
241 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 233 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |