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

Side by Side Diff: ui/views/views_delegate.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Reduced ViewsDelegate layout/metric functions to only two functions Created 3 years, 10 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/views_delegate.h" 5 #include "ui/views/views_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/views/layout/layout_constants.h" 9 #include "ui/views/layout/layout_constants.h"
10 #include "ui/views/views_touch_selection_controller_factory.h" 10 #include "ui/views/views_touch_selection_controller_factory.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor, 119 int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor,
120 const base::Closure& callback) { 120 const base::Closure& callback) {
121 return EDGE_BOTTOM; 121 return EDGE_BOTTOM;
122 } 122 }
123 #endif 123 #endif
124 124
125 scoped_refptr<base::TaskRunner> ViewsDelegate::GetBlockingPoolTaskRunner() { 125 scoped_refptr<base::TaskRunner> ViewsDelegate::GetBlockingPoolTaskRunner() {
126 return nullptr; 126 return nullptr;
127 } 127 }
128 128
129 gfx::Insets ViewsDelegate::GetDialogButtonInsets() const { 129 gfx::Insets ViewsDelegate::GetInsetsMetric(InsetsMetric metric) const {
130 return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew, 130 switch (metric) {
131 kButtonHEdgeMarginNew); 131 case InsetsMetric::DIALOG_BUTTON:
132 return gfx::Insets(0, kButtonHEdgeMarginNew, kButtonVEdgeMarginNew,
133 kButtonHEdgeMarginNew);
134 case InsetsMetric::DIALOG_FRAME_VIEW:
135 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0,
136 kButtonHEdgeMarginNew);
137 case InsetsMetric::BUBBLE_DIALOG:
138 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin);
139 }
140 NOTREACHED();
141 return gfx::Insets();
132 } 142 }
133 143
134 int ViewsDelegate::GetDialogCloseButtonMargin() const { 144 int ViewsDelegate::GetSpacingMetric(SpacingMetric metric) const {
135 return kCloseButtonMargin; 145 switch (metric) {
136 } 146 case SpacingMetric::CLOSE_BUTTON_MARGIN:
137 147 return kCloseButtonMargin;
138 int ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const { 148 case SpacingMetric::RELATED_HORIZONTAL_BUTTON:
139 return kRelatedButtonHSpacing; 149 return kRelatedButtonHSpacing;
140 } 150 case SpacingMetric::RELATED_VERTICAL_CONTROL:
141 151 return kRelatedControlVerticalSpacing;
142 int ViewsDelegate::GetDialogRelatedControlVerticalSpacing() const { 152 case SpacingMetric::ICON_TO_TEXT:
143 return kRelatedControlVerticalSpacing; 153 return kIconTextSpacing;
144 } 154 }
145 155 NOTREACHED();
146 gfx::Insets ViewsDelegate::GetDialogFrameViewInsets() const { 156 return 0;
147 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0,
148 kButtonHEdgeMarginNew);
149 }
150
151 gfx::Insets ViewsDelegate::GetBubbleDialogMargins() const {
152 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin);
153 } 157 }
154 158
155 ViewsDelegate::ViewsDelegate() 159 ViewsDelegate::ViewsDelegate()
156 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) { 160 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
157 DCHECK(!views_delegate); 161 DCHECK(!views_delegate);
158 views_delegate = this; 162 views_delegate = this;
159 163
160 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get()); 164 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
161 165
162 #if defined(USE_AURA) 166 #if defined(USE_AURA)
163 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews()); 167 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews());
164 #endif 168 #endif
165 } 169 }
166 170
167 } // namespace views 171 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698