| 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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/app/vector_icons/vector_icons.h" | 8 #include "chrome/app/vector_icons/vector_icons.h" |
| 9 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 views::GridLayout* layout = new views::GridLayout(container.get()); | 26 views::GridLayout* layout = new views::GridLayout(container.get()); |
| 27 container->SetLayoutManager(layout); | 27 container->SetLayoutManager(layout); |
| 28 | 28 |
| 29 views::ColumnSet* columns = layout->AddColumnSet(0); | 29 views::ColumnSet* columns = layout->AddColumnSet(0); |
| 30 // A column for the optional back arrow. | 30 // A column for the optional back arrow. |
| 31 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, | 31 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, |
| 32 0, views::GridLayout::USE_PREF, 0, 0); | 32 0, views::GridLayout::USE_PREF, 0, 0); |
| 33 // A column for the title. | 33 // A column for the title. |
| 34 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, | 34 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, |
| 35 1, views::GridLayout::USE_PREF, 0, 0); | 35 1, views::GridLayout::USE_PREF, 0, 0); |
| 36 // A column for the close button. | |
| 37 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, | |
| 38 0, views::GridLayout::USE_PREF, 0, 0); | |
| 39 | 36 |
| 40 layout->StartRow(0, 0); | 37 layout->StartRow(0, 0); |
| 41 if (!show_back_arrow) { | 38 if (!show_back_arrow) { |
| 42 layout->SkipColumns(1); | 39 layout->SkipColumns(1); |
| 43 } else { | 40 } else { |
| 44 views::VectorIconButton* back_arrow = new views::VectorIconButton(delegate); | 41 views::VectorIconButton* back_arrow = new views::VectorIconButton(delegate); |
| 45 back_arrow->SetIcon(kNavigateBackIcon); | 42 back_arrow->SetIcon(kNavigateBackIcon); |
| 46 back_arrow->SetSize(back_arrow->GetPreferredSize()); | 43 back_arrow->SetSize(back_arrow->GetPreferredSize()); |
| 47 back_arrow->set_tag(static_cast<int>( | 44 back_arrow->set_tag(static_cast<int>( |
| 48 PaymentRequestCommonTags::BACK_BUTTON_TAG)); | 45 PaymentRequestCommonTags::BACK_BUTTON_TAG)); |
| 49 layout->AddView(back_arrow); | 46 layout->AddView(back_arrow); |
| 50 } | 47 } |
| 51 | 48 |
| 52 views::Label* title_label = new views::Label(title); | 49 views::Label* title_label = new views::Label(title); |
| 53 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 50 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 54 layout->AddView(title_label); | 51 layout->AddView(title_label); |
| 55 views::Button* close_button = | |
| 56 views::BubbleFrameView::CreateCloseButton(delegate); | |
| 57 close_button->set_tag(static_cast<int>( | |
| 58 PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); | |
| 59 layout->AddView(close_button); | |
| 60 | 52 |
| 61 return container; | 53 return container; |
| 62 } | 54 } |
| 63 | 55 |
| 64 | 56 |
| 65 std::unique_ptr<views::View> CreatePaymentView( | 57 std::unique_ptr<views::View> CreatePaymentView( |
| 66 std::unique_ptr<views::View> header_view, | 58 std::unique_ptr<views::View> header_view, |
| 67 std::unique_ptr<views::View> content_view) { | 59 std::unique_ptr<views::View> content_view) { |
| 68 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); | 60 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); |
| 69 view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); | 61 view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 89 layout->AddView(header_view.release()); | 81 layout->AddView(header_view.release()); |
| 90 | 82 |
| 91 layout->StartRow(0, 0); | 83 layout->StartRow(0, 0); |
| 92 // |content_view| will be deleted when |view| is. | 84 // |content_view| will be deleted when |view| is. |
| 93 layout->AddView(content_view.release()); | 85 layout->AddView(content_view.release()); |
| 94 | 86 |
| 95 return view; | 87 return view; |
| 96 } | 88 } |
| 97 | 89 |
| 98 } // namespace payments | 90 } // namespace payments |
| OLD | NEW |