Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_views_util.cc

Issue 2579513002: [WebPayments] Factor out sheet-specific logic in Controllers. (Closed)
Patch Set: Address comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/views/background.h"
9 #include "ui/views/controls/button/md_text_button.h"
10 #include "ui/views/controls/label.h"
11 #include "ui/views/layout/fill_layout.h"
12 #include "ui/views/layout/grid_layout.h"
13
14 namespace payments {
15
16 std::unique_ptr<views::View> CreatePaymentView(
17 const base::string16& title, views::View* content_view) {
18 std::unique_ptr<views::View> view = base::MakeUnique<views::View>();
19 view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE));
20
21 // Paint the sheets to layers, otherwise the MD buttons (which do paint to a
22 // layer) won't do proper clipping.
23 view->SetPaintToLayer(true);
24
25 views::GridLayout* layout = new views::GridLayout(view.get());
26 view->SetLayoutManager(layout);
27 views::ColumnSet* columns = layout->AddColumnSet(0);
28 columns->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
29 1, views::GridLayout::USE_PREF, 0, 0);
30
31 layout->StartRow(0, 0);
32 layout->AddView(new views::Label(title));
33
34 layout->StartRow(0, 0);
35 layout->AddView(content_view);
36
37 return view;
38 }
39
40 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698