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

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

Issue 2649683002: [Payments] Improve the closing of the PR dialog. (Closed)
Patch Set: addressed comments from sky Created 3 years, 11 months 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/test_chrome_payment_request_delegate. h" 5 #include "chrome/browser/ui/views/payments/test_chrome_payment_request_delegate. h"
6 6
7 #include <utility>
8
7 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "ui/views/widget/widget.h"
11 #include "ui/views/widget/widget_observer.h"
8 12
9 namespace payments { 13 namespace payments {
10 14
11 TestChromePaymentRequestDelegate::TestChromePaymentRequestDelegate( 15 TestChromePaymentRequestDelegate::TestChromePaymentRequestDelegate(
12 content::WebContents* web_contents, 16 content::WebContents* web_contents,
13 PaymentRequestDialog::ObserverForTest* observer) 17 PaymentRequestDialogView::ObserverForTest* observer,
14 : ChromePaymentRequestDelegate(web_contents), observer_(observer) {} 18 views::WidgetObserver* widget_observer)
19 : ChromePaymentRequestDelegate(web_contents),
20 observer_(observer),
21 widget_observer_(widget_observer) {}
15 22
16 void TestChromePaymentRequestDelegate::ShowPaymentRequestDialog( 23 void TestChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) {
17 PaymentRequest* request) { 24 PaymentRequestDialogView* dialog_view =
18 PaymentRequestDialog::ShowWebModalPaymentDialog( 25 new PaymentRequestDialogView(request, observer_);
19 new PaymentRequestDialog(request, observer_), request); 26 dialog_view->ShowDialog();
27
28 // The widget is now valid, so register its observer.
29 views::Widget* widget = dialog_view->GetWidget();
30 widget->AddObserver(widget_observer_);
31
32 dialog_ = std::move(dialog_view);
20 } 33 }
21 34
22 } // namespace payments 35 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/test_chrome_payment_request_delegate.h ('k') | components/payments/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698