Chromium Code Reviews| 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/accessibility/ax_view_state.h" | 7 #include "ui/accessibility/ax_view_state.h" |
| 8 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/gfx/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 if (GetWidget()) | 89 if (GetWidget()) |
| 90 GetWidget()->RemoveObserver(this); | 90 GetWidget()->RemoveObserver(this); |
| 91 SetLayoutManager(NULL); | 91 SetLayoutManager(NULL); |
| 92 SetAnchorView(NULL); | 92 SetAnchorView(NULL); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { | 96 Widget* BubbleDelegateView::CreateBubble(BubbleDelegateView* bubble_delegate) { |
| 97 bubble_delegate->Init(); | 97 bubble_delegate->Init(); |
| 98 // Get the latest anchor widget from the anchor view at bubble creation time. | 98 // Get the latest anchor widget from the anchor view at bubble creation time. |
| 99 bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView()); | 99 views::View* anchor = bubble_delegate->GetAnchorView(); |
|
hcarmona
2015/02/28 00:24:53
Trybots hated this check. I'm removing it.
Are th
groby-ooo-7-16
2015/02/28 00:26:22
This statement does not make sense to me. What che
hcarmona
2015/02/28 01:14:16
I added the DCHECK on line 105 to avoid having a b
| |
| 100 BubbleBorder::Arrow arrow = bubble_delegate->arrow(); | |
| 101 | |
| 102 // Anchor should always be visible when it has an arrow to avoid accidentally | |
| 103 // showing a bubble with an arrow when the anchor is not visible. | |
| 104 // ex: Bubble is anchored to lock button in omnibar while in fullscreen. | |
| 105 DCHECK(arrow == BubbleBorder::NONE || arrow == BubbleBorder::FLOAT || | |
|
groby-ooo-7-16
2015/02/28 00:25:12
Why verify this here, and not in the bubble where
hcarmona
2015/02/28 01:14:16
We can verify when drawing the bubble, but I imagi
| |
| 106 anchor->IsDrawn()); | |
| 107 | |
| 108 bubble_delegate->SetAnchorView(anchor); | |
| 100 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); | 109 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); |
| 101 | 110 |
| 102 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 103 // If glass is enabled, the bubble is allowed to extend outside the bounds of | 112 // If glass is enabled, the bubble is allowed to extend outside the bounds of |
| 104 // the parent frame and let DWM handle compositing. If not, then we don't | 113 // the parent frame and let DWM handle compositing. If not, then we don't |
| 105 // want to allow the bubble to extend the frame because it will be clipped. | 114 // want to allow the bubble to extend the frame because it will be clipped. |
| 106 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); | 115 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); |
| 107 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) | 116 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 108 // Linux clips bubble windows that extend outside their parent window bounds. | 117 // Linux clips bubble windows that extend outside their parent window bounds. |
| 109 bubble_delegate->set_adjust_if_offscreen(false); | 118 bubble_delegate->set_adjust_if_offscreen(false); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 if (widget == GetWidget() && anchor_widget() && | 310 if (widget == GetWidget() && anchor_widget() && |
| 302 anchor_widget()->GetTopLevelWidget()) { | 311 anchor_widget()->GetTopLevelWidget()) { |
| 303 if (visible) | 312 if (visible) |
| 304 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 313 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
| 305 else | 314 else |
| 306 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); | 315 anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering(); |
| 307 } | 316 } |
| 308 } | 317 } |
| 309 | 318 |
| 310 } // namespace views | 319 } // namespace views |
| OLD | NEW |