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

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

Issue 2529733002: [WebPayments] Move views-specific code to c/b/ui/views/ (Closed)
Patch Set: Implement ShowWebPaymentsDialog in TestBrowserWindow 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
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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/payments/ui/payment_request_dialog.h" 6 #include "chrome/browser/payments/payment_request_impl.h"
7 #include "chrome/browser/ui/views/payments/payment_request_dialog.h"
7 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
8 #include "ui/views/layout/fill_layout.h" 9 #include "ui/views/layout/fill_layout.h"
9 10
10 namespace payments { 11 namespace payments {
11 12
12 PaymentRequestDialog::PaymentRequestDialog( 13 PaymentRequestDialog::PaymentRequestDialog(PaymentRequestImpl* impl)
13 payments::mojom::PaymentRequestClientPtr client) 14 : impl_(impl),
14 : client_(std::move(client)),
15 label_(new views::Label(base::ASCIIToUTF16("Payments dialog"))) { 15 label_(new views::Label(base::ASCIIToUTF16("Payments dialog"))) {
16 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 16 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
17 SetLayoutManager(new views::FillLayout()); 17 SetLayoutManager(new views::FillLayout());
18 AddChildView(label_.get()); 18 AddChildView(label_.get());
19 } 19 }
20 20
21 PaymentRequestDialog::~PaymentRequestDialog() {} 21 PaymentRequestDialog::~PaymentRequestDialog() {}
22 22
23 ui::ModalType PaymentRequestDialog::GetModalType() const { 23 ui::ModalType PaymentRequestDialog::GetModalType() const {
24 return ui::MODAL_TYPE_CHILD; 24 return ui::MODAL_TYPE_CHILD;
25 } 25 }
26 26
27 gfx::Size PaymentRequestDialog::GetPreferredSize() const { 27 gfx::Size PaymentRequestDialog::GetPreferredSize() const {
28 gfx::Size ps = label_->GetPreferredSize(); 28 gfx::Size ps = label_->GetPreferredSize();
29 ps.Enlarge(200, 200); 29 ps.Enlarge(200, 200);
30 return ps; 30 return ps;
31 } 31 }
32 32
33 bool PaymentRequestDialog::Cancel() { 33 bool PaymentRequestDialog::Cancel() {
34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
35 client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL); 35 impl_->Cancel();
36 return true; 36 return true;
37 } 37 }
38 38
39 } // namespace payments 39 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698