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

Side by Side Diff: chrome/browser/payments/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
« no previous file with comments | « chrome/browser/payments/chrome_payment_request_delegate.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
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/payments/chrome_payment_request_delegate.h" 5 #include "chrome/browser/payments/chrome_payment_request_delegate.h"
6 6
7 #include "base/macros.h"
7 #include "chrome/browser/autofill/personal_data_manager_factory.h" 8 #include "chrome/browser/autofill/personal_data_manager_factory.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_dialogs.h" 10 #include "chrome/browser/ui/browser_dialogs.h"
11 #include "components/payments/payment_request_dialog.h"
10 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
11 13
12 namespace payments { 14 namespace payments {
13 15
14 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( 16 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate(
15 content::WebContents* web_contents) 17 content::WebContents* web_contents)
16 : web_contents_(web_contents) {} 18 : dialog_(nullptr), web_contents_(web_contents) {}
17 19
18 void ChromePaymentRequestDelegate::ShowPaymentRequestDialog( 20 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) {
19 PaymentRequest* request) { 21 DCHECK_EQ(nullptr, dialog_);
20 chrome::ShowPaymentRequestDialog(request); 22 dialog_ = chrome::CreatePaymentRequestDialog(request);
23 dialog_->ShowDialog();
24 }
25
26 void ChromePaymentRequestDelegate::CloseDialog() {
27 if (dialog_) {
28 dialog_->CloseDialog();
29 dialog_ = nullptr;
30 }
21 } 31 }
22 32
23 autofill::PersonalDataManager* 33 autofill::PersonalDataManager*
24 ChromePaymentRequestDelegate::GetPersonalDataManager() { 34 ChromePaymentRequestDelegate::GetPersonalDataManager() {
25 return autofill::PersonalDataManagerFactory::GetForProfile( 35 return autofill::PersonalDataManagerFactory::GetForProfile(
26 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); 36 Profile::FromBrowserContext(web_contents_->GetBrowserContext()));
27 } 37 }
28 38
29 } // namespace payments 39 } // namespace payments
OLDNEW
« no previous file with comments | « chrome/browser/payments/chrome_payment_request_delegate.h ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698