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 "base/metrics/histogram_macros.h" |
7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
8 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/base/default_style.h" | 10 #include "ui/base/default_style.h" |
10 #include "ui/base/material_design/material_design_controller.h" | 11 #include "ui/base/material_design/material_design_controller.h" |
11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/color_utils.h" | 13 #include "ui/gfx/color_utils.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/native_theme/native_theme.h" | 15 #include "ui/native_theme/native_theme.h" |
15 #include "ui/views/bubble/bubble_frame_view.h" | 16 #include "ui/views/bubble/bubble_frame_view.h" |
16 #include "ui/views/focus/view_storage.h" | 17 #include "ui/views/focus/view_storage.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 color_explicitly_set_(false), | 215 color_explicitly_set_(false), |
215 accept_events_(true), | 216 accept_events_(true), |
216 adjust_if_offscreen_(true), | 217 adjust_if_offscreen_(true), |
217 parent_window_(NULL) { | 218 parent_window_(NULL) { |
218 LayoutProvider* provider = LayoutProvider::Get(); | 219 LayoutProvider* provider = LayoutProvider::Get(); |
219 margins_ = provider->GetInsetsMetric(INSETS_BUBBLE_CONTENTS); | 220 margins_ = provider->GetInsetsMetric(INSETS_BUBBLE_CONTENTS); |
220 title_margins_ = provider->GetInsetsMetric(INSETS_BUBBLE_TITLE); | 221 title_margins_ = provider->GetInsetsMetric(INSETS_BUBBLE_TITLE); |
221 if (anchor_view) | 222 if (anchor_view) |
222 SetAnchorView(anchor_view); | 223 SetAnchorView(anchor_view); |
223 UpdateColorsFromTheme(GetNativeTheme()); | 224 UpdateColorsFromTheme(GetNativeTheme()); |
| 225 UMA_HISTOGRAM_BOOLEAN("Dialog.BubbleDialogDelegateView.Creation", true); |
224 } | 226 } |
225 | 227 |
226 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { | 228 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { |
227 // The argument rect has its origin at the bubble's arrow anchor point; | 229 // 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). | 230 // its size is the preferred size of the bubble's client view (this view). |
229 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); | 231 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); |
230 return GetBubbleFrameView()->GetUpdatedWindowBounds( | 232 return GetBubbleFrameView()->GetUpdatedWindowBounds( |
231 GetAnchorRect(), GetWidget()->client_view()->GetPreferredSize(), | 233 GetAnchorRect(), GetWidget()->client_view()->GetPreferredSize(), |
232 adjust_if_offscreen_ && !anchor_minimized); | 234 adjust_if_offscreen_ && !anchor_minimized); |
233 } | 235 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // http://crbug.com/474622 for details. | 322 // http://crbug.com/474622 for details. |
321 if (widget == GetWidget() && visible) { | 323 if (widget == GetWidget() && visible) { |
322 ui::AXNodeData node_data; | 324 ui::AXNodeData node_data; |
323 GetAccessibleNodeData(&node_data); | 325 GetAccessibleNodeData(&node_data); |
324 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) | 326 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) |
325 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 327 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
326 } | 328 } |
327 } | 329 } |
328 | 330 |
329 } // namespace views | 331 } // namespace views |
OLD | NEW |