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/views_delegate.h" | 10 #include "ui/views/views_delegate.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 dialog_contents.right()); | 53 dialog_contents.right()); |
54 } | 54 } |
55 case InsetsMetric::INSETS_DIALOG_CONTENTS: | 55 case InsetsMetric::INSETS_DIALOG_CONTENTS: |
56 return gfx::Insets(13, 20); | 56 return gfx::Insets(13, 20); |
57 case InsetsMetric::INSETS_DIALOG_TITLE: { | 57 case InsetsMetric::INSETS_DIALOG_TITLE: { |
58 const gfx::Insets dialog_contents = | 58 const gfx::Insets dialog_contents = |
59 GetInsetsMetric(INSETS_DIALOG_CONTENTS); | 59 GetInsetsMetric(INSETS_DIALOG_CONTENTS); |
60 return gfx::Insets(dialog_contents.top(), dialog_contents.left(), 0, | 60 return gfx::Insets(dialog_contents.top(), dialog_contents.left(), 0, |
61 dialog_contents.right()); | 61 dialog_contents.right()); |
62 } | 62 } |
| 63 case InsetsMetric::INSETS_TOAST: |
| 64 return gfx::Insets(0, 8); |
63 case InsetsMetric::INSETS_VECTOR_IMAGE_BUTTON: | 65 case InsetsMetric::INSETS_VECTOR_IMAGE_BUTTON: |
64 return gfx::Insets(4); | 66 return gfx::Insets(4); |
65 } | 67 } |
66 NOTREACHED(); | 68 NOTREACHED(); |
67 return gfx::Insets(); | 69 return gfx::Insets(); |
68 } | 70 } |
69 | 71 |
70 int LayoutProvider::GetDistanceMetric(int metric) const { | 72 int LayoutProvider::GetDistanceMetric(int metric) const { |
71 DCHECK_GE(metric, VIEWS_INSETS_MAX); | 73 DCHECK_GE(metric, VIEWS_INSETS_MAX); |
72 switch (metric) { | 74 switch (metric) { |
(...skipping 29 matching lines...) Expand all Loading... |
102 // This is an arbitrary value, but it's a good arbitrary value. Some dialogs | 104 // This is an arbitrary value, but it's a good arbitrary value. Some dialogs |
103 // have very small widths for their contents views, which causes ugly | 105 // have very small widths for their contents views, which causes ugly |
104 // title-wrapping where a two-word title is split across multiple lines or | 106 // title-wrapping where a two-word title is split across multiple lines or |
105 // similar. To prevent that, forbid any snappable dialog from being narrower | 107 // similar. To prevent that, forbid any snappable dialog from being narrower |
106 // than this value. In principle it's possible to factor in the title width | 108 // than this value. In principle it's possible to factor in the title width |
107 // here, but it is not really worth the complexity. | 109 // here, but it is not really worth the complexity. |
108 return std::max(min_width, 320); | 110 return std::max(min_width, 320); |
109 } | 111 } |
110 | 112 |
111 } // namespace views | 113 } // namespace views |
OLD | NEW |