Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: ui/views/bubble/bubble_dialog_delegate.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Use 'related control spacing' constant for icon-to-text spacing Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
Peter Kasting 2017/03/09 05:52:11 Nit: Just assume |views_delegate| is non-null (2 p
kylix_rd 2017/03/09 15:02:32 Done.
220 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin); 220 ? views_delegate->GetInsetsMetric(InsetsMetric::BUBBLE_DIALOG)
221 title_margins_ = views_delegate 221 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin);
222 ? views_delegate->GetDialogFrameViewInsets() 222 title_margins_ =
223 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0, 223 views_delegate
224 kPanelHorizMargin); 224 ? views_delegate->GetInsetsMetric(InsetsMetric::DIALOG_FRAME_VIEW)
225 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0,
226 kPanelHorizMargin);
225 if (anchor_view) 227 if (anchor_view)
226 SetAnchorView(anchor_view); 228 SetAnchorView(anchor_view);
227 UpdateColorsFromTheme(GetNativeTheme()); 229 UpdateColorsFromTheme(GetNativeTheme());
228 } 230 }
229 231
230 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { 232 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() {
231 // The argument rect has its origin at the bubble's arrow anchor point; 233 // 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). 234 // its size is the preferred size of the bubble's client view (this view).
233 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); 235 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized();
234 return GetBubbleFrameView()->GetUpdatedWindowBounds( 236 return GetBubbleFrameView()->GetUpdatedWindowBounds(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // http://crbug.com/474622 for details. 326 // http://crbug.com/474622 for details.
325 if (widget == GetWidget() && visible) { 327 if (widget == GetWidget() && visible) {
326 ui::AXNodeData node_data; 328 ui::AXNodeData node_data;
327 GetAccessibleNodeData(&node_data); 329 GetAccessibleNodeData(&node_data);
328 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) 330 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG)
329 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 331 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
330 } 332 }
331 } 333 }
332 334
333 } // namespace views 335 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698