| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_dialog_delegate.h" | 5 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; | 291 return view ? static_cast<BubbleFrameView*>(view->frame_view()) : NULL; |
| 292 } | 292 } |
| 293 | 293 |
| 294 void BubbleDialogDelegateView::UpdateColorsFromTheme( | 294 void BubbleDialogDelegateView::UpdateColorsFromTheme( |
| 295 const ui::NativeTheme* theme) { | 295 const ui::NativeTheme* theme) { |
| 296 if (!color_explicitly_set_) | 296 if (!color_explicitly_set_) |
| 297 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); | 297 color_ = theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground); |
| 298 BubbleFrameView* frame_view = GetBubbleFrameView(); | 298 BubbleFrameView* frame_view = GetBubbleFrameView(); |
| 299 if (frame_view) | 299 if (frame_view) |
| 300 frame_view->bubble_border()->set_background_color(color()); | 300 frame_view->bubble_border()->set_background_color(color()); |
| 301 |
| 302 // When there's an opaque layer, the bubble border background won't show |
| 303 // through, so explicitly paint a background color. |
| 304 set_background(layer() && layer()->fills_bounds_opaquely() |
| 305 ? Background::CreateSolidBackground(color()) |
| 306 : nullptr); |
| 301 } | 307 } |
| 302 | 308 |
| 303 void BubbleDialogDelegateView::HandleVisibilityChanged(Widget* widget, | 309 void BubbleDialogDelegateView::HandleVisibilityChanged(Widget* widget, |
| 304 bool visible) { | 310 bool visible) { |
| 305 if (widget == GetWidget() && anchor_widget() && | 311 if (widget == GetWidget() && anchor_widget() && |
| 306 anchor_widget()->GetTopLevelWidget()) { | 312 anchor_widget()->GetTopLevelWidget()) { |
| 307 anchor_widget()->GetTopLevelWidget()->SetAlwaysRenderAsActive(visible); | 313 anchor_widget()->GetTopLevelWidget()->SetAlwaysRenderAsActive(visible); |
| 308 } | 314 } |
| 309 | 315 |
| 310 // Fire AX_EVENT_ALERT for bubbles marked as AX_ROLE_ALERT_DIALOG; this | 316 // Fire AX_EVENT_ALERT for bubbles marked as AX_ROLE_ALERT_DIALOG; this |
| 311 // instructs accessibility tools to read the bubble in its entirety rather | 317 // instructs accessibility tools to read the bubble in its entirety rather |
| 312 // than just its title and initially focused view. See | 318 // than just its title and initially focused view. See |
| 313 // http://crbug.com/474622 for details. | 319 // http://crbug.com/474622 for details. |
| 314 if (widget == GetWidget() && visible) { | 320 if (widget == GetWidget() && visible) { |
| 315 ui::AXViewState state; | 321 ui::AXViewState state; |
| 316 GetAccessibleState(&state); | 322 GetAccessibleState(&state); |
| 317 if (state.role == ui::AX_ROLE_ALERT_DIALOG) | 323 if (state.role == ui::AX_ROLE_ALERT_DIALOG) |
| 318 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 324 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 319 } | 325 } |
| 320 } | 326 } |
| 321 | 327 |
| 322 } // namespace views | 328 } // namespace views |
| OLD | NEW |