OLD | NEW |
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 Loading... |
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::GetDistanceMetric(DistanceMetric metric) const { |
135 return kCloseButtonMargin; | 145 switch (metric) { |
136 } | 146 case DistanceMetric::CLOSE_BUTTON_MARGIN: |
137 | 147 return kCloseButtonMargin; |
138 int ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() const { | 148 case DistanceMetric::RELATED_BUTTON_HORIZONTAL: |
139 return kRelatedButtonHSpacing; | 149 return kRelatedButtonHSpacing; |
140 } | 150 case DistanceMetric::RELATED_CONTROL_HORIZONTAL: |
141 | 151 return kRelatedControlHorizontalSpacing; |
142 int ViewsDelegate::GetDialogRelatedControlVerticalSpacing() const { | 152 case DistanceMetric::RELATED_CONTROL_VERTICAL: |
143 return kRelatedControlVerticalSpacing; | 153 return kRelatedControlVerticalSpacing; |
144 } | 154 case DistanceMetric::DIALOG_BUTTON_MINIMUM_WIDTH: |
145 | 155 return kDialogMinimumButtonWidth; |
146 gfx::Insets ViewsDelegate::GetDialogFrameViewInsets() const { | 156 case DistanceMetric::BUTTON_HORIZONTAL_PADDING: |
147 return gfx::Insets(kPanelVertMargin, kButtonHEdgeMarginNew, 0, | 157 return kButtonHorizontalPadding; |
148 kButtonHEdgeMarginNew); | 158 } |
149 } | 159 NOTREACHED(); |
150 | 160 return 0; |
151 gfx::Insets ViewsDelegate::GetBubbleDialogMargins() const { | |
152 return gfx::Insets(kPanelVertMargin, kPanelHorizMargin); | |
153 } | |
154 | |
155 int ViewsDelegate::GetButtonMinimumWidth() const { | |
156 return kMinimumButtonWidth; | |
157 } | |
158 | |
159 int ViewsDelegate::GetDialogButtonMinimumWidth() const { | |
160 return kDialogMinimumButtonWidth; | |
161 } | |
162 | |
163 int ViewsDelegate::GetButtonHorizontalPadding() const { | |
164 return kButtonHorizontalPadding; | |
165 } | 161 } |
166 | 162 |
167 ViewsDelegate::ViewsDelegate() | 163 ViewsDelegate::ViewsDelegate() |
168 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) { | 164 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) { |
169 DCHECK(!views_delegate); | 165 DCHECK(!views_delegate); |
170 views_delegate = this; | 166 views_delegate = this; |
171 | 167 |
172 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get()); | 168 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get()); |
173 | 169 |
174 #if defined(USE_AURA) | 170 #if defined(USE_AURA) |
175 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews()); | 171 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews()); |
176 #endif | 172 #endif |
177 } | 173 } |
178 | 174 |
179 } // namespace views | 175 } // namespace views |
OLD | NEW |