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 #include "ui/views/bubble/bubble_delegate.h" | 5 #include "ui/views/bubble/bubble_delegate.h" |
6 | 6 |
7 #include "ui/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "ui/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
9 #include "ui/gfx/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 SetAnchorView(NULL); | 95 SetAnchorView(NULL); |
96 } | 96 } |
97 | 97 |
98 // static | 98 // static |
99 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { | 99 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { |
100 bubble_delegate->Init(); | 100 bubble_delegate->Init(); |
101 // Get the latest anchor widget from the anchor view at bubble creation time. | 101 // Get the latest anchor widget from the anchor view at bubble creation time. |
102 bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView()); | 102 bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView()); |
103 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); | 103 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); |
104 | 104 |
105 #if defined(OS_WIN) && defined(USE_AURA) | 105 #if defined(OS_WIN) |
106 // If glass is enabled, the bubble is allowed to extend outside the bounds of | 106 // If glass is enabled, the bubble is allowed to extend outside the bounds of |
107 // the parent frame and let DWM handle compositing. If not, then we don't | 107 // the parent frame and let DWM handle compositing. If not, then we don't |
108 // want to allow the bubble to extend the frame because it will be clipped. | 108 // want to allow the bubble to extend the frame because it will be clipped. |
109 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); | 109 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); |
110 #endif | 110 #endif |
111 | 111 |
112 bubble_delegate->SizeToContents(); | 112 bubble_delegate->SizeToContents(); |
113 bubble_widget->AddObserver(bubble_delegate); | 113 bubble_widget->AddObserver(bubble_delegate); |
114 return bubble_widget; | 114 return bubble_widget; |
115 } | 115 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 | 343 |
344 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { | 344 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { |
345 if (widget == GetWidget() && visible && anchor_widget() && | 345 if (widget == GetWidget() && visible && anchor_widget() && |
346 anchor_widget()->GetTopLevelWidget()) { | 346 anchor_widget()->GetTopLevelWidget()) { |
347 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 347 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 } // namespace views | 351 } // namespace views |
OLD | NEW |