Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "chrome/browser/autofill/personal_data_manager_factory.h" | 7 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "components/payments/payment_request_dialog.h" | |
| 10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 11 | 12 |
| 12 namespace payments { | 13 namespace payments { |
| 13 | 14 |
| 14 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( | 15 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( |
| 15 content::WebContents* web_contents) | 16 content::WebContents* web_contents) |
| 16 : web_contents_(web_contents) {} | 17 : dialog_(nullptr), web_contents_(web_contents) {} |
| 17 | 18 |
| 18 void ChromePaymentRequestDelegate::ShowPaymentRequestDialog( | 19 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { |
|
please use gerrit instead
2017/01/23 21:18:50
nit: Would it be a good idea to add "DCHECK_EQ(dia
Mathieu
2017/01/23 21:53:57
Done.
| |
| 19 PaymentRequest* request) { | 20 dialog_ = chrome::CreatePaymentRequestDialog(request); |
| 20 chrome::ShowPaymentRequestDialog(request); | 21 dialog_->ShowDialog(); |
| 22 } | |
| 23 | |
| 24 void ChromePaymentRequestDelegate::CloseDialog() { | |
| 25 if (dialog_) { | |
|
please use gerrit instead
2017/01/23 21:18:50
nit: no {}
Mathieu
2017/01/23 21:53:57
Done.
| |
| 26 dialog_->CloseDialog(); | |
| 27 } | |
|
please use gerrit instead
2017/01/23 21:18:50
nit: would it be a good idea to add "dialog_ = nul
Mathieu
2017/01/23 21:53:57
Yes that's not a bad idea. Gets you back into a be
| |
| 21 } | 28 } |
| 22 | 29 |
| 23 autofill::PersonalDataManager* | 30 autofill::PersonalDataManager* |
| 24 ChromePaymentRequestDelegate::GetPersonalDataManager() { | 31 ChromePaymentRequestDelegate::GetPersonalDataManager() { |
| 25 return autofill::PersonalDataManagerFactory::GetForProfile( | 32 return autofill::PersonalDataManagerFactory::GetForProfile( |
| 26 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); | 33 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
| 27 } | 34 } |
| 28 | 35 |
| 29 } // namespace payments | 36 } // namespace payments |
| OLD | NEW |