| 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/views_layout_delegate.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 ViewsLayoutDelegate* layout_delegate = ViewsLayoutDelegate::Get(); |
| 219 margins_ = views_delegate->GetInsetsMetric(InsetsMetric::BUBBLE_DIALOG); | 219 margins_ = layout_delegate->GetInsetsMetric(InsetsMetric::BUBBLE_DIALOG); |
| 220 title_margins_ = | 220 title_margins_ = |
| 221 views_delegate->GetInsetsMetric(InsetsMetric::DIALOG_FRAME_VIEW); | 221 layout_delegate->GetInsetsMetric(InsetsMetric::DIALOG_FRAME_VIEW); |
| 222 if (anchor_view) | 222 if (anchor_view) |
| 223 SetAnchorView(anchor_view); | 223 SetAnchorView(anchor_view); |
| 224 UpdateColorsFromTheme(GetNativeTheme()); | 224 UpdateColorsFromTheme(GetNativeTheme()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 227 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
| 228 // The argument rect has its origin at the bubble's arrow anchor point; | 228 // The argument rect has its origin at the bubble's arrow anchor point; |
| 229 // its size is the preferred size of the bubble's client view (this view). | 229 // its size is the preferred size of the bubble's client view (this view). |
| 230 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); | 230 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
| 231 return GetBubbleFrameView()->GetUpdatedWindowBounds( | 231 return GetBubbleFrameView()->GetUpdatedWindowBounds( |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // http://crbug.com/474622 for details. | 321 // http://crbug.com/474622 for details. |
| 322 if (widget == GetWidget() && visible) { | 322 if (widget == GetWidget() && visible) { |
| 323 ui::AXNodeData node_data; | 323 ui::AXNodeData node_data; |
| 324 GetAccessibleNodeData(&node_data); | 324 GetAccessibleNodeData(&node_data); |
| 325 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 325 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
| 326 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 326 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 } // namespace views | 330 } // namespace views |
| OLD | NEW |