| OLD | NEW |
| 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 Loading... |
| 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 that should be applied around a bubble dialog. | |
| 67 BUBBLE_DIALOG, | |
| 68 // The insets that should be applied around a DialogClientView. Note that | |
| 69 // the top inset is used for the distance between the buttons and the | |
| 70 // DialogClientView's content view. | |
| 71 DIALOG_BUTTON, | |
| 72 // The insets that should be applied around a dialog's frame view. | |
| 73 DIALOG_FRAME_VIEW, | |
| 74 }; | |
| 75 | |
| 76 enum class DistanceMetric { | |
| 77 // The default padding to add on each side of a button's label. | |
| 78 BUTTON_HORIZONTAL_PADDING, | |
| 79 // The distance between a dialog's edge and the close button in the upper | |
| 80 // trailing corner. | |
| 81 CLOSE_BUTTON_MARGIN, | |
| 82 // The default minimum width of a dialog button. | |
| 83 DIALOG_BUTTON_MINIMUM_WIDTH, | |
| 84 // The spacing between a pair of related horizontal buttons, used for | |
| 85 // dialog layout. | |
| 86 RELATED_BUTTON_HORIZONTAL, | |
| 87 // Horizontal spacing between controls that are logically related. | |
| 88 RELATED_CONTROL_HORIZONTAL, | |
| 89 // The spacing between a pair of related vertical controls, used for | |
| 90 // dialog layout. | |
| 91 RELATED_CONTROL_VERTICAL, | |
| 92 }; | |
| 93 | |
| 94 // ViewsDelegate is an interface implemented by an object using the views | 64 // ViewsDelegate is an interface implemented by an object using the views |
| 95 // framework. It is used to obtain various high level application utilities | 65 // framework. It is used to obtain various high level application utilities |
| 96 // and perform some actions such as window placement saving. | 66 // and perform some actions such as window placement saving. |
| 97 // | 67 // |
| 98 // The embedding app must set the ViewsDelegate instance by instantiating an | 68 // The embedding app must set the ViewsDelegate instance by instantiating an |
| 99 // implementation of ViewsDelegate (the constructor will set the instance). | 69 // implementation of ViewsDelegate (the constructor will set the instance). |
| 100 class VIEWS_EXPORT ViewsDelegate { | 70 class VIEWS_EXPORT ViewsDelegate { |
| 101 public: | 71 public: |
| 102 using NativeWidgetFactory = | 72 using NativeWidgetFactory = |
| 103 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 Loading... |
| 239 // not changed, |callback| is never run. | 209 // not changed, |callback| is never run. |
| 240 // | 210 // |
| 241 // The return value is a bitmask of AppbarAutohideEdge. | 211 // The return value is a bitmask of AppbarAutohideEdge. |
| 242 virtual int GetAppbarAutohideEdges(HMONITOR monitor, | 212 virtual int GetAppbarAutohideEdges(HMONITOR monitor, |
| 243 const base::Closure& callback); | 213 const base::Closure& callback); |
| 244 #endif | 214 #endif |
| 245 | 215 |
| 246 // Returns a blocking pool task runner given a TaskRunnerType. | 216 // Returns a blocking pool task runner given a TaskRunnerType. |
| 247 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner(); | 217 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner(); |
| 248 | 218 |
| 249 // Returns the insets metric according to the given enumeration element. | |
| 250 virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const; | |
| 251 | |
| 252 // Returns the distance metric between elements according to the given | |
| 253 // enumeration element. | |
| 254 virtual int GetDistanceMetric(DistanceMetric metric) const; | |
| 255 | |
| 256 // Returns the TypographyProvider, used to configure text properties such as | |
| 257 // font, weight, color, size, and line height. Never null. | |
| 258 virtual const TypographyProvider& GetTypographyProvider() const = 0; | |
| 259 | |
| 260 protected: | 219 protected: |
| 261 ViewsDelegate(); | 220 ViewsDelegate(); |
| 262 | 221 |
| 263 private: | 222 private: |
| 264 std::unique_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_; | 223 std::unique_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_; |
| 265 | 224 |
| 266 #if defined(USE_AURA) | 225 #if defined(USE_AURA) |
| 267 std::unique_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; | 226 std::unique_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; |
| 268 | 227 |
| 269 DesktopWindowTreeHostFactory desktop_window_tree_host_factory_; | 228 DesktopWindowTreeHostFactory desktop_window_tree_host_factory_; |
| 270 #endif | 229 #endif |
| 271 | 230 |
| 272 NativeWidgetFactory native_widget_factory_; | 231 NativeWidgetFactory native_widget_factory_; |
| 273 | 232 |
| 274 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); | 233 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); |
| 275 }; | 234 }; |
| 276 | 235 |
| 277 } // namespace views | 236 } // namespace views |
| 278 | 237 |
| 279 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ | 238 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ |
| OLD | NEW |