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 "base/macros.h" | |
| 8 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 7 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 9 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "components/autofill/content/browser/content_autofill_driver.h" | |
|
Mathieu
2017/04/04 19:05:48
remove?
anthonyvd
2017/04/04 23:02:14
Done.
| |
| 12 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | |
| 12 #include "components/payments/content/payment_request_dialog.h" | 13 #include "components/payments/content/payment_request_dialog.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 | 15 |
| 15 namespace payments { | 16 namespace payments { |
| 16 | 17 |
| 17 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( | 18 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( |
| 18 content::WebContents* web_contents) | 19 content::WebContents* web_contents) |
| 19 : dialog_(nullptr), web_contents_(web_contents) {} | 20 : dialog_(nullptr), web_contents_(web_contents) {} |
| 20 | 21 |
| 21 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { | 22 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 45 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { | 46 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { |
| 46 return g_browser_process->GetApplicationLocale(); | 47 return g_browser_process->GetApplicationLocale(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 bool ChromePaymentRequestDelegate::IsIncognito() const { | 50 bool ChromePaymentRequestDelegate::IsIncognito() const { |
| 50 Profile* profile = | 51 Profile* profile = |
| 51 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 52 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 52 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; | 53 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; |
| 53 } | 54 } |
| 54 | 55 |
| 56 void ChromePaymentRequestDelegate::DoFullCardRequest( | |
| 57 const autofill::CreditCard& credit_card, | |
| 58 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | |
| 59 result_delegate) { | |
| 60 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate); | |
|
Mathieu
2017/04/04 19:05:48
could we also pass the web_contents_ here, in whic
anthonyvd
2017/04/04 23:02:14
Good point, done.
| |
| 61 } | |
| 62 | |
| 63 content::WebContents* ChromePaymentRequestDelegate::GetWebContents() { | |
| 64 return web_contents_; | |
| 65 } | |
| 66 | |
| 55 } // namespace payments | 67 } // namespace payments |
| OLD | NEW |