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

Side by Side Diff: chrome/browser/payments/ui/payment_request_dialog.cc

Issue 2529733002: [WebPayments] Move views-specific code to c/b/ui/views/ (Closed)
Patch Set: Rebase 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
« no previous file with comments | « chrome/browser/payments/ui/payment_request_dialog.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/payments/ui/payment_request_dialog.h"
7 #include "content/public/browser/browser_thread.h"
8 #include "ui/views/layout/fill_layout.h"
9
10 namespace payments {
11
12 PaymentRequestDialog::PaymentRequestDialog(
13 payments::mojom::PaymentRequestClientPtr client)
14 : client_(std::move(client)),
15 label_(new views::Label(base::ASCIIToUTF16("Payments dialog"))) {
16 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
17 SetLayoutManager(new views::FillLayout());
18 AddChildView(label_.get());
19 }
20
21 PaymentRequestDialog::~PaymentRequestDialog() {}
22
23 ui::ModalType PaymentRequestDialog::GetModalType() const {
24 return ui::MODAL_TYPE_CHILD;
25 }
26
27 gfx::Size PaymentRequestDialog::GetPreferredSize() const {
28 gfx::Size ps = label_->GetPreferredSize();
29 ps.Enlarge(200, 200);
30 return ps;
31 }
32
33 bool PaymentRequestDialog::Cancel() {
34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
35 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL);
36 return true;
37 }
38
39 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/payments/ui/payment_request_dialog.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698