Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/layout/layout_provider.h" | 5 #include "ui/views/layout/layout_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
| 10 #include "ui/views/layout/layout_constants.h" | |
| 11 #include "ui/views/views_delegate.h" | 10 #include "ui/views/views_delegate.h" |
| 12 | 11 |
| 13 namespace views { | 12 namespace views { |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 15 | |
| 16 LayoutProvider* g_layout_delegate = nullptr; | 16 LayoutProvider* g_layout_delegate = nullptr; |
| 17 } | 17 |
| 18 constexpr int kPanelHorizMargin = 13; | |
|
Peter Kasting
2017/06/13 23:33:35
Same comment.
ananta
2017/06/14 18:48:11
Done.
| |
| 19 | |
| 20 // Top or bottom margin. | |
| 21 constexpr int kPanelVertMargin = 13; | |
| 22 | |
| 23 // Horizontal spacing between controls that are logically related. | |
| 24 constexpr int kRelatedControlHorizontalSpacing = 8; | |
| 25 | |
| 26 // Vertical spacing between controls that are logically related. | |
| 27 constexpr int kRelatedControlVerticalSpacing = 8; | |
| 28 | |
| 29 // Vertical spacing between controls that are logically unrelated. | |
| 30 constexpr int kUnrelatedControlVerticalSpacing = 20; | |
| 31 | |
| 32 // Vertical spacing between the edge of the window and the | |
| 33 // top or bottom of a button (when using new style dialogs). | |
| 34 constexpr int kButtonVEdgeMarginNew = 20; | |
| 35 | |
| 36 // Horizontal spacing between the edge of the window and the | |
| 37 // left or right of a button (when using new style dialogs). | |
| 38 constexpr int kButtonHEdgeMarginNew = 20; | |
| 39 | |
| 40 // Spacing between the edge of the window and the edge of the close button. | |
| 41 constexpr int kCloseButtonMargin = 7; | |
| 42 | |
| 43 // Horizontal spacing between buttons that are logically related. | |
| 44 constexpr int kRelatedButtonHSpacing = 6; | |
| 45 | |
| 46 // Padding on the left and right of a button's contents. | |
| 47 const int kButtonHorizontalPadding = 16; | |
| 48 | |
| 49 // Minimum width of dialog buttons. | |
| 50 constexpr int kDialogMinimumButtonWidth = 75; | |
| 51 | |
| 52 // Extra space around vector buttons to increase their event target size. | |
| 53 constexpr int kVectorButtonExtraTouchSize = 4; | |
| 54 | |
| 55 } // namespace | |
| 18 | 56 |
| 19 LayoutProvider::LayoutProvider() { | 57 LayoutProvider::LayoutProvider() { |
| 20 g_layout_delegate = this; | 58 g_layout_delegate = this; |
| 21 } | 59 } |
| 22 | 60 |
| 23 LayoutProvider::~LayoutProvider() { | 61 LayoutProvider::~LayoutProvider() { |
| 24 if (this == g_layout_delegate) | 62 if (this == g_layout_delegate) |
| 25 g_layout_delegate = nullptr; | 63 g_layout_delegate = nullptr; |
| 26 } | 64 } |
| 27 | 65 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 // This is an arbitrary value, but it's a good arbitrary value. Some dialogs | 147 // This is an arbitrary value, but it's a good arbitrary value. Some dialogs |
| 110 // have very small widths for their contents views, which causes ugly | 148 // have very small widths for their contents views, which causes ugly |
| 111 // title-wrapping where a two-word title is split across multiple lines or | 149 // title-wrapping where a two-word title is split across multiple lines or |
| 112 // similar. To prevent that, forbid any snappable dialog from being narrower | 150 // similar. To prevent that, forbid any snappable dialog from being narrower |
| 113 // than this value. In principle it's possible to factor in the title width | 151 // than this value. In principle it's possible to factor in the title width |
| 114 // here, but it is not really worth the complexity. | 152 // here, but it is not really worth the complexity. |
| 115 return std::max(min_width, 320); | 153 return std::max(min_width, 320); |
| 116 } | 154 } |
| 117 | 155 |
| 118 } // namespace views | 156 } // namespace views |
| OLD | NEW |