OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/views/payments/payment_request_views_util.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ui/views/border.h" | 31 #include "ui/views/border.h" |
32 #include "ui/views/bubble/bubble_frame_view.h" | 32 #include "ui/views/bubble/bubble_frame_view.h" |
33 #include "ui/views/controls/button/button.h" | 33 #include "ui/views/controls/button/button.h" |
34 #include "ui/views/controls/button/image_button.h" | 34 #include "ui/views/controls/button/image_button.h" |
35 #include "ui/views/controls/button/image_button_factory.h" | 35 #include "ui/views/controls/button/image_button_factory.h" |
36 #include "ui/views/controls/image_view.h" | 36 #include "ui/views/controls/image_view.h" |
37 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
38 #include "ui/views/controls/styled_label.h" | 38 #include "ui/views/controls/styled_label.h" |
39 #include "ui/views/layout/box_layout.h" | 39 #include "ui/views/layout/box_layout.h" |
40 #include "ui/views/layout/grid_layout.h" | 40 #include "ui/views/layout/grid_layout.h" |
| 41 #include "ui/views/layout/layout_provider.h" |
41 #include "ui/views/painter.h" | 42 #include "ui/views/painter.h" |
42 #include "ui/views/view.h" | 43 #include "ui/views/view.h" |
43 | 44 |
44 namespace payments { | 45 namespace payments { |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 // TODO(tmartino): Consider combining this with the Android equivalent in | 49 // TODO(tmartino): Consider combining this with the Android equivalent in |
49 // PersonalDataManager.java | 50 // PersonalDataManager.java |
50 base::string16 GetAddressFromProfile(const autofill::AutofillProfile& profile, | 51 base::string16 GetAddressFromProfile(const autofill::AutofillProfile& profile, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 line_height), | 121 line_height), |
121 SK_ColorLTGRAY); | 122 SK_ColorLTGRAY); |
122 } | 123 } |
123 | 124 |
124 private: | 125 private: |
125 DISALLOW_COPY_AND_ASSIGN(PaymentRequestRowBorderPainter); | 126 DISALLOW_COPY_AND_ASSIGN(PaymentRequestRowBorderPainter); |
126 }; | 127 }; |
127 | 128 |
128 } // namespace | 129 } // namespace |
129 | 130 |
| 131 int GetActualDialogWidth() { |
| 132 constexpr int kDialogMinWidth = 512; |
| 133 static int actual_width = |
| 134 views::LayoutProvider::Get()->GetSnappedDialogWidth(kDialogMinWidth); |
| 135 return actual_width; |
| 136 } |
| 137 |
130 std::unique_ptr<views::View> CreateSheetHeaderView( | 138 std::unique_ptr<views::View> CreateSheetHeaderView( |
131 bool show_back_arrow, | 139 bool show_back_arrow, |
132 const base::string16& title, | 140 const base::string16& title, |
133 views::ButtonListener* listener) { | 141 views::ButtonListener* listener) { |
134 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); | 142 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); |
135 views::GridLayout* layout = new views::GridLayout(container.get()); | 143 views::GridLayout* layout = new views::GridLayout(container.get()); |
136 container->SetLayoutManager(layout); | 144 container->SetLayoutManager(layout); |
137 | 145 |
138 constexpr int kHeaderTopVerticalInset = 14; | 146 constexpr int kHeaderTopVerticalInset = 14; |
139 constexpr int kHeaderBottomVerticalInset = 8; | 147 constexpr int kHeaderBottomVerticalInset = 8; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 base::MakeUnique<views::Label>(formatted_amount); | 305 base::MakeUnique<views::Label>(formatted_amount); |
298 amount_label->set_id( | 306 amount_label->set_id( |
299 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); | 307 static_cast<int>(DialogViewID::SHIPPING_OPTION_AMOUNT)); |
300 container->AddChildView(amount_label.release()); | 308 container->AddChildView(amount_label.release()); |
301 } | 309 } |
302 | 310 |
303 return container; | 311 return container; |
304 } | 312 } |
305 | 313 |
306 } // namespace payments | 314 } // namespace payments |
OLD | NEW |