| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bubble_delegate->Init(); | 99 bubble_delegate->Init(); |
| 100 // Get the latest anchor widget from the anchor view at bubble creation time. | 100 // Get the latest anchor widget from the anchor view at bubble creation time. |
| 101 bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView()); | 101 bubble_delegate->SetAnchorView(bubble_delegate->GetAnchorView()); |
| 102 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); | 102 Widget* bubble_widget = CreateBubbleWidget(bubble_delegate); |
| 103 | 103 |
| 104 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
| 105 // If glass is enabled, the bubble is allowed to extend outside the bounds of | 105 // If glass is enabled, the bubble is allowed to extend outside the bounds of |
| 106 // the parent frame and let DWM handle compositing. If not, then we don't | 106 // the parent frame and let DWM handle compositing. If not, then we don't |
| 107 // want to allow the bubble to extend the frame because it will be clipped. | 107 // want to allow the bubble to extend the frame because it will be clipped. |
| 108 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); | 108 bubble_delegate->set_adjust_if_offscreen(ui::win::IsAeroGlassEnabled()); |
| 109 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) | 109 #elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) |
| 110 // Linux clips bubble windows that extend outside their parent window bounds. | 110 // Linux clips bubble windows that extend outside their parent window bounds. |
| 111 // Mac never adjusts. |
| 111 bubble_delegate->set_adjust_if_offscreen(false); | 112 bubble_delegate->set_adjust_if_offscreen(false); |
| 112 #endif | 113 #endif |
| 113 | 114 |
| 114 bubble_delegate->SizeToContents(); | 115 bubble_delegate->SizeToContents(); |
| 115 bubble_widget->AddObserver(bubble_delegate); | 116 bubble_widget->AddObserver(bubble_delegate); |
| 116 return bubble_widget; | 117 return bubble_widget; |
| 117 } | 118 } |
| 118 | 119 |
| 119 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { | 120 BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { |
| 120 return this; | 121 return this; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // http://crbug.com/474622 for details. | 315 // http://crbug.com/474622 for details. |
| 315 if (widget == GetWidget() && visible) { | 316 if (widget == GetWidget() && visible) { |
| 316 ui::AXViewState state; | 317 ui::AXViewState state; |
| 317 GetAccessibleState(&state); | 318 GetAccessibleState(&state); |
| 318 if (state.role == ui::AX_ROLE_ALERT_DIALOG) | 319 if (state.role == ui::AX_ROLE_ALERT_DIALOG) |
| 319 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 320 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 320 } | 321 } |
| 321 } | 322 } |
| 322 | 323 |
| 323 } // namespace views | 324 } // namespace views |
| OLD | NEW |