OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "views/bubble/bubble_delegate.h" | 5 #include "views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/base/animation/slide_animation.h" | 7 #include "ui/base/animation/slide_animation.h" |
8 #include "views/bubble/bubble_frame_view.h" | 8 #include "views/bubble/bubble_frame_view.h" |
9 #include "views/widget/widget.h" | 9 #include "views/widget/widget.h" |
10 | 10 |
11 // The duration of the fade animation in milliseconds. | 11 // The duration of the fade animation in milliseconds. |
12 static const int kHideFadeDurationMS = 200; | 12 static const int kHideFadeDurationMS = 200; |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Create a widget to host the bubble. | 18 // Create a widget to host the bubble. |
19 Widget* CreateBubbleWidget(BubbleDelegateView* bubble, Widget* parent) { | 19 Widget* CreateBubbleWidget(BubbleDelegateView* bubble, Widget* parent) { |
20 Widget* bubble_widget = new Widget(); | 20 Widget* bubble_widget = new Widget(); |
21 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); | 21 Widget::InitParams bubble_params(Widget::InitParams::TYPE_BUBBLE); |
22 bubble_params.delegate = bubble; | 22 bubble_params.delegate = bubble; |
23 bubble_params.transparent = true; | 23 bubble_params.transparent = true; |
24 bubble_params.parent_widget = parent; | 24 bubble_params.parent_widget = parent; |
25 if (!bubble_params.parent_widget) | |
26 bubble_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | |
27 #if defined(OS_WIN) && !defined(USE_AURA) | 25 #if defined(OS_WIN) && !defined(USE_AURA) |
28 bubble_params.type = Widget::InitParams::TYPE_WINDOW_FRAMELESS; | 26 bubble_params.type = Widget::InitParams::TYPE_WINDOW_FRAMELESS; |
29 bubble_params.transparent = false; | 27 bubble_params.transparent = false; |
30 #endif | 28 #endif |
31 bubble_widget->Init(bubble_params); | 29 bubble_widget->Init(bubble_params); |
32 return bubble_widget; | 30 return bubble_widget; |
33 } | 31 } |
34 | 32 |
35 #if defined(OS_WIN) && !defined(USE_AURA) | 33 #if defined(OS_WIN) && !defined(USE_AURA) |
36 // The border widget's delegate, needed for transparent Windows native controls. | 34 // The border widget's delegate, needed for transparent Windows native controls. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 273 } |
276 | 274 |
277 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { | 275 gfx::Rect BubbleDelegateView::GetBubbleClientBounds() const { |
278 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); | 276 gfx::Rect client_bounds(GetBubbleFrameView()->GetBoundsForClientView()); |
279 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); | 277 client_bounds.Offset(border_widget_->GetWindowScreenBounds().origin()); |
280 return client_bounds; | 278 return client_bounds; |
281 } | 279 } |
282 #endif | 280 #endif |
283 | 281 |
284 } // namespace views | 282 } // namespace views |
OLD | NEW |