| 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_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
| 9 #include "ui/base/default_style.h" | 9 #include "ui/base/default_style.h" |
| 10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/color_utils.h" | 12 #include "ui/gfx/color_utils.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/native_theme/native_theme.h" | 14 #include "ui/native_theme/native_theme.h" |
| 15 #include "ui/views/bubble/bubble_frame_view.h" | 15 #include "ui/views/bubble/bubble_frame_view.h" |
| 16 #include "ui/views/focus/view_storage.h" | 16 #include "ui/views/focus/view_storage.h" |
| 17 #include "ui/views/layout/layout_constants.h" | 17 #include "ui/views/layout/layout_constants.h" |
| 18 #include "ui/views/layout/layout_provider.h" |
| 18 #include "ui/views/style/platform_style.h" | 19 #include "ui/views/style/platform_style.h" |
| 19 #include "ui/views/views_delegate.h" | |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/widget/widget_observer.h" | 21 #include "ui/views/widget/widget_observer.h" |
| 22 #include "ui/views/window/dialog_client_view.h" | 22 #include "ui/views/window/dialog_client_view.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include "ui/base/win/shell.h" | 25 #include "ui/base/win/shell.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace views { | 28 namespace views { |
| 29 | 29 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 : close_on_deactivate_(true), | 208 : close_on_deactivate_(true), |
| 209 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), | 209 anchor_view_storage_id_(ViewStorage::GetInstance()->CreateStorageID()), |
| 210 anchor_widget_(NULL), | 210 anchor_widget_(NULL), |
| 211 arrow_(arrow), | 211 arrow_(arrow), |
| 212 mirror_arrow_in_rtl_(PlatformStyle::kMirrorBubbleArrowInRTLByDefault), | 212 mirror_arrow_in_rtl_(PlatformStyle::kMirrorBubbleArrowInRTLByDefault), |
| 213 shadow_(BubbleBorder::SMALL_SHADOW), | 213 shadow_(BubbleBorder::SMALL_SHADOW), |
| 214 color_explicitly_set_(false), | 214 color_explicitly_set_(false), |
| 215 accept_events_(true), | 215 accept_events_(true), |
| 216 adjust_if_offscreen_(true), | 216 adjust_if_offscreen_(true), |
| 217 parent_window_(NULL) { | 217 parent_window_(NULL) { |
| 218 ViewsDelegate* views_delegate = ViewsDelegate::GetInstance(); | 218 LayoutProvider* provider = LayoutProvider::Get(); |
| 219 margins_ = views_delegate->GetInsetsMetric(InsetsMetric::BUBBLE_CONTENTS); | 219 margins_ = provider->GetInsetsMetric(INSETS_BUBBLE_CONTENTS); |
| 220 title_margins_ = views_delegate->GetInsetsMetric(InsetsMetric::DIALOG_TITLE); | 220 title_margins_ = provider->GetInsetsMetric(INSETS_DIALOG_TITLE); |
| 221 if (anchor_view) | 221 if (anchor_view) |
| 222 SetAnchorView(anchor_view); | 222 SetAnchorView(anchor_view); |
| 223 UpdateColorsFromTheme(GetNativeTheme()); | 223 UpdateColorsFromTheme(GetNativeTheme()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 226 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
| 227 // The argument rect has its origin at the bubble's arrow anchor point; | 227 // The argument rect has its origin at the bubble's arrow anchor point; |
| 228 // its size is the preferred size of the bubble's client view (this view). | 228 // its size is the preferred size of the bubble's client view (this view). |
| 229 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); | 229 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
| 230 return GetBubbleFrameView()->GetUpdatedWindowBounds( | 230 return GetBubbleFrameView()->GetUpdatedWindowBounds( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // http://crbug.com/474622 for details. | 320 // http://crbug.com/474622 for details. |
| 321 if (widget == GetWidget() && visible) { | 321 if (widget == GetWidget() && visible) { |
| 322 ui::AXNodeData node_data; | 322 ui::AXNodeData node_data; |
| 323 GetAccessibleNodeData(&node_data); | 323 GetAccessibleNodeData(&node_data); |
| 324 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 324 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
| 325 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 325 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace views | 329 } // namespace views |
| OLD | NEW |