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

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: Used ifdef instead of duplicated code for delegate initialization 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->GetInsetsMetric(InsetsMetric::BUBBLE_DIALOG);
220 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin); 220 title_margins_ =
221 title_margins_ = views_delegate 221 views_delegate->GetInsetsMetric(InsetsMetric::DIALOG_FRAME_VIEW);
222 ? views_delegate->GetDialogFrameViewInsets()
223 : gfx::Insets(kPanelVertMargin, kPanelHorizMargin, 0,
224 kPanelHorizMargin);
225 if (anchor_view) 222 if (anchor_view)
226 SetAnchorView(anchor_view); 223 SetAnchorView(anchor_view);
227 UpdateColorsFromTheme(GetNativeTheme()); 224 UpdateColorsFromTheme(GetNativeTheme());
228 } 225 }
229 226
230 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() { 227 gfx::Rect BubbleDialogDelegateView::GetBubbleBounds() {
231 // 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;
232 // 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).
233 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized(); 230 bool anchor_minimized = anchor_widget() && anchor_widget()->IsMinimized();
234 return GetBubbleFrameView()->GetUpdatedWindowBounds( 231 return GetBubbleFrameView()->GetUpdatedWindowBounds(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // http://crbug.com/474622 for details. 321 // http://crbug.com/474622 for details.
325 if (widget == GetWidget() && visible) { 322 if (widget == GetWidget() && visible) {
326 ui::AXNodeData node_data; 323 ui::AXNodeData node_data;
327 GetAccessibleNodeData(&node_data); 324 GetAccessibleNodeData(&node_data);
328 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG) 325 if (node_data.role == ui::AX_ROLE_ALERT_DIALOG)
329 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); 326 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
330 } 327 }
331 } 328 }
332 329
333 } // namespace views 330 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/reload_button_unittest.cc ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698