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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 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
« no previous file with comments | « ui/views/test/views_test_base.h ('k') | ui/views/views_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef UI_VIEWS_VIEWS_DELEGATE_H_ 5 #ifndef UI_VIEWS_VIEWS_DELEGATE_H_
6 #define UI_VIEWS_VIEWS_DELEGATE_H_ 6 #define UI_VIEWS_VIEWS_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 namespace ui { 42 namespace ui {
43 class ContextFactory; 43 class ContextFactory;
44 } 44 }
45 45
46 namespace views { 46 namespace views {
47 47
48 class NativeWidget; 48 class NativeWidget;
49 class NonClientFrameView; 49 class NonClientFrameView;
50 class ViewsTouchEditingControllerFactory; 50 class ViewsTouchEditingControllerFactory;
51 class TypographyProvider;
52 class View; 51 class View;
53 class Widget; 52 class Widget;
54 53
55 #if defined(USE_AURA) 54 #if defined(USE_AURA)
56 class DesktopNativeWidgetAura; 55 class DesktopNativeWidgetAura;
57 class DesktopWindowTreeHost; 56 class DesktopWindowTreeHost;
58 class TouchSelectionMenuRunnerViews; 57 class TouchSelectionMenuRunnerViews;
59 #endif 58 #endif
60 59
61 namespace internal { 60 namespace internal {
62 class NativeWidgetDelegate; 61 class NativeWidgetDelegate;
63 } 62 }
64 63
65 enum class InsetsMetric {
66 // The margins around the contents area of a bubble (popover)-style dialog.
67 BUBBLE_CONTENTS,
68 // The margins around the button row of a dialog.
69 DIALOG_BUTTON,
70 // The margins around the icon/title of a dialog.
71 DIALOG_TITLE,
72 // The margins that should be applied around a panel GridLayout.
73 PANEL,
74 // Padding to add to vector image buttons to increase their click and touch
75 // target size.
76 VECTOR_IMAGE_BUTTON_PADDING,
77 };
78
79 enum class DistanceMetric {
80 // The default padding to add on each side of a button's label.
81 BUTTON_HORIZONTAL_PADDING,
82 // The distance between a dialog's edge and the close button in the upper
83 // trailing corner.
84 CLOSE_BUTTON_MARGIN,
85 // The default minimum width of a dialog button.
86 DIALOG_BUTTON_MINIMUM_WIDTH,
87 // The spacing between a pair of related horizontal buttons, used for
88 // dialog layout.
89 RELATED_BUTTON_HORIZONTAL,
90 // Horizontal spacing between controls that are logically related.
91 RELATED_CONTROL_HORIZONTAL,
92 // The spacing between a pair of related vertical controls, used for
93 // dialog layout.
94 RELATED_CONTROL_VERTICAL,
95 };
96
97 // ViewsDelegate is an interface implemented by an object using the views 64 // ViewsDelegate is an interface implemented by an object using the views
98 // framework. It is used to obtain various high level application utilities 65 // framework. It is used to obtain various high level application utilities
99 // and perform some actions such as window placement saving. 66 // and perform some actions such as window placement saving.
100 // 67 //
101 // The embedding app must set the ViewsDelegate instance by instantiating an 68 // The embedding app must set the ViewsDelegate instance by instantiating an
102 // implementation of ViewsDelegate (the constructor will set the instance). 69 // implementation of ViewsDelegate (the constructor will set the instance).
103 class VIEWS_EXPORT ViewsDelegate { 70 class VIEWS_EXPORT ViewsDelegate {
104 public: 71 public:
105 using NativeWidgetFactory = 72 using NativeWidgetFactory =
106 base::Callback<NativeWidget*(const Widget::InitParams&, 73 base::Callback<NativeWidget*(const Widget::InitParams&,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // not changed, |callback| is never run. 209 // not changed, |callback| is never run.
243 // 210 //
244 // The return value is a bitmask of AppbarAutohideEdge. 211 // The return value is a bitmask of AppbarAutohideEdge.
245 virtual int GetAppbarAutohideEdges(HMONITOR monitor, 212 virtual int GetAppbarAutohideEdges(HMONITOR monitor,
246 const base::Closure& callback); 213 const base::Closure& callback);
247 #endif 214 #endif
248 215
249 // Returns a blocking pool task runner given a TaskRunnerType. 216 // Returns a blocking pool task runner given a TaskRunnerType.
250 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner(); 217 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner();
251 218
252 // Returns the insets metric according to the given enumeration element.
253 virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const;
254
255 // Returns the distance metric between elements according to the given
256 // enumeration element.
257 virtual int GetDistanceMetric(DistanceMetric metric) const;
258
259 // Returns the TypographyProvider, used to configure text properties such as
260 // font, weight, color, size, and line height. Never null.
261 virtual const TypographyProvider& GetTypographyProvider() const = 0;
262
263 protected: 219 protected:
264 ViewsDelegate(); 220 ViewsDelegate();
265 221
266 private: 222 private:
267 std::unique_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_; 223 std::unique_ptr<ViewsTouchEditingControllerFactory>
224 editing_controller_factory_;
268 225
269 #if defined(USE_AURA) 226 #if defined(USE_AURA)
270 std::unique_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; 227 std::unique_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_;
271 228
272 DesktopWindowTreeHostFactory desktop_window_tree_host_factory_; 229 DesktopWindowTreeHostFactory desktop_window_tree_host_factory_;
273 #endif 230 #endif
274 231
275 NativeWidgetFactory native_widget_factory_; 232 NativeWidgetFactory native_widget_factory_;
276 233
277 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); 234 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate);
278 }; 235 };
279 236
280 } // namespace views 237 } // namespace views
281 238
282 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ 239 #endif // UI_VIEWS_VIEWS_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/views/test/views_test_base.h ('k') | ui/views/views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698