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