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/gfx/animation/slide_animation.h" | 8 #include "ui/gfx/animation/slide_animation.h" |
8 #include "ui/gfx/color_utils.h" | 9 #include "ui/gfx/color_utils.h" |
9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
10 #include "ui/native_theme/native_theme.h" | 11 #include "ui/native_theme/native_theme.h" |
11 #include "ui/views/bubble/bubble_frame_view.h" | 12 #include "ui/views/bubble/bubble_frame_view.h" |
12 #include "ui/views/focus/view_storage.h" | 13 #include "ui/views/focus/view_storage.h" |
13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
14 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
15 | 16 |
16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( | 132 NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( |
132 Widget* widget) { | 133 Widget* widget) { |
133 BubbleFrameView* frame = new BubbleFrameView(margins()); | 134 BubbleFrameView* frame = new BubbleFrameView(margins()); |
134 BubbleBorder::Arrow adjusted_arrow = arrow(); | 135 BubbleBorder::Arrow adjusted_arrow = arrow(); |
135 if (ShouldFlipArrowForRtl() && base::i18n::IsRTL()) | 136 if (ShouldFlipArrowForRtl() && base::i18n::IsRTL()) |
136 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); | 137 adjusted_arrow = BubbleBorder::horizontal_mirror(adjusted_arrow); |
137 frame->SetBubbleBorder(new BubbleBorder(adjusted_arrow, shadow(), color())); | 138 frame->SetBubbleBorder(new BubbleBorder(adjusted_arrow, shadow(), color())); |
138 return frame; | 139 return frame; |
139 } | 140 } |
140 | 141 |
| 142 void BubbleDelegateView::GetAccessibleState(ui::AccessibleViewState* state) { |
| 143 state->role = ui::AccessibilityTypes::ROLE_DIALOG; |
| 144 } |
| 145 |
141 void BubbleDelegateView::OnWidgetDestroying(Widget* widget) { | 146 void BubbleDelegateView::OnWidgetDestroying(Widget* widget) { |
142 if (anchor_widget() == widget) | 147 if (anchor_widget() == widget) |
143 SetAnchorView(NULL); | 148 SetAnchorView(NULL); |
144 } | 149 } |
145 | 150 |
146 void BubbleDelegateView::OnWidgetVisibilityChanging(Widget* widget, | 151 void BubbleDelegateView::OnWidgetVisibilityChanging(Widget* widget, |
147 bool visible) { | 152 bool visible) { |
148 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
149 // On Windows we need to handle this before the bubble is visible or hidden. | 154 // On Windows we need to handle this before the bubble is visible or hidden. |
150 // Please see the comment on the OnWidgetVisibilityChanging function. On | 155 // Please see the comment on the OnWidgetVisibilityChanging function. On |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 332 } |
328 | 333 |
329 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { | 334 void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) { |
330 if (widget == GetWidget() && visible && anchor_widget() && | 335 if (widget == GetWidget() && visible && anchor_widget() && |
331 anchor_widget()->GetTopLevelWidget()) { | 336 anchor_widget()->GetTopLevelWidget()) { |
332 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); | 337 anchor_widget()->GetTopLevelWidget()->DisableInactiveRendering(); |
333 } | 338 } |
334 } | 339 } |
335 | 340 |
336 } // namespace views | 341 } // namespace views |
OLD | NEW |