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" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ViewsDelegate* views_delegate = ViewsDelegate::GetInstance(); |
219 margins_ = views_delegate ? views_delegate->GetBubbleDialogMargins() | 219 margins_ = views_delegate |
220 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin); | 220 ? views_delegate->GetInsetsMetric( |
| 221 ViewsDelegate::InsetsMetric::BUBBLE_DIALOG) |
| 222 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin); |
221 title_margins_ = views_delegate | 223 title_margins_ = views_delegate |
222 ? views_delegate->GetDialogFrameViewInsets() | 224 ? views_delegate->GetInsetsMetric( |
| 225 ViewsDelegate::InsetsMetric::DIALOG_FRAME_VIEW) |
223 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, | 226 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, |
224 kPanelHorizMargin); | 227 kPanelHorizMargin); |
225 if (anchor_view) | 228 if (anchor_view) |
226 SetAnchorView(anchor_view); | 229 SetAnchorView(anchor_view); |
227 UpdateColorsFromTheme(GetNativeTheme()); | 230 UpdateColorsFromTheme(GetNativeTheme()); |
228 } | 231 } |
229 | 232 |
230 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 233 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
231 // The argument rect has its origin at the bubble's arrow anchor point; | 234 // The argument rect has its origin at the bubble's arrow anchor point; |
232 // its size is the preferred size of the bubble's client view (this view). | 235 // its size is the preferred size of the bubble's client view (this view). |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // http://crbug.com/474622 for details. | 327 // http://crbug.com/474622 for details. |
325 if (widget == GetWidget() && visible) { | 328 if (widget == GetWidget() && visible) { |
326 ui::AXNodeData node_data; | 329 ui::AXNodeData node_data; |
327 GetAccessibleNodeData(&node_data); | 330 GetAccessibleNodeData(&node_data); |
328 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 331 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
329 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 332 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
330 } | 333 } |
331 } | 334 } |
332 | 335 |
333 } // namespace views | 336 } // namespace views |
OLD | NEW |