Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_request_views_util.cc |
| diff --git a/chrome/browser/ui/views/payments/payment_request_views_util.cc b/chrome/browser/ui/views/payments/payment_request_views_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..105e97ff0b4f46bc20104f175221e18d372b7b6a |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/payments/payment_request_views_util.cc |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| + |
| +#include "base/strings/utf_string_conversions.h" |
|
please use gerrit instead
2016/12/15 19:11:15
Not used.
anthonyvd
2016/12/15 19:55:06
Done.
|
| +#include "ui/views/background.h" |
| +#include "ui/views/controls/button/md_text_button.h" |
|
please use gerrit instead
2016/12/15 19:11:15
Not used.
anthonyvd
2016/12/15 19:55:06
Done.
|
| +#include "ui/views/controls/label.h" |
| +#include "ui/views/layout/fill_layout.h" |
|
please use gerrit instead
2016/12/15 19:11:15
Not used.
anthonyvd
2016/12/15 19:55:06
Done.
|
| +#include "ui/views/layout/grid_layout.h" |
| + |
| +namespace payments { |
| + |
| +std::unique_ptr<views::View> CreatePaymentView( |
| + const base::string16& title, views::View* content_view) { |
| + std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); |
|
please use gerrit instead
2016/12/15 19:11:15
#include "base/memory/ptr_util.h"
#inclued "ui/vie
anthonyvd
2016/12/15 19:55:06
Done.
|
| + view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); |
|
please use gerrit instead
2016/12/15 19:11:15
#inclued "third_party/skia/include/core/SkColor.h"
anthonyvd
2016/12/15 19:55:06
Done.
|
| + |
| + // Paint the sheets to layers, otherwise the MD buttons (which do paint to a |
| + // layer) won't do proper clipping. |
| + view->SetPaintToLayer(true); |
| + |
| + views::GridLayout* layout = new views::GridLayout(view.get()); |
| + view->SetLayoutManager(layout); |
| + views::ColumnSet* columns = layout->AddColumnSet(0); |
| + columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, |
| + 1, views::GridLayout::USE_PREF, 0, 0); |
| + |
| + layout->StartRow(0, 0); |
| + layout->AddView(new views::Label(title)); |
| + |
| + layout->StartRow(0, 0); |
| + layout->AddView(content_view); |
| + |
| + return view; |
| +} |
| + |
| +} // namespace payments |