| 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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 dialog_->ShowDialog(); | 24 dialog_->ShowDialog(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void ChromePaymentRequestDelegate::CloseDialog() { | 27 void ChromePaymentRequestDelegate::CloseDialog() { |
| 28 if (dialog_) { | 28 if (dialog_) { |
| 29 dialog_->CloseDialog(); | 29 dialog_->CloseDialog(); |
| 30 dialog_ = nullptr; | 30 dialog_ = nullptr; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ChromePaymentRequestDelegate::ShowErrorMessage() { |
| 35 if (dialog_) |
| 36 dialog_->ShowErrorMessage(); |
| 37 } |
| 38 |
| 34 autofill::PersonalDataManager* | 39 autofill::PersonalDataManager* |
| 35 ChromePaymentRequestDelegate::GetPersonalDataManager() { | 40 ChromePaymentRequestDelegate::GetPersonalDataManager() { |
| 36 return autofill::PersonalDataManagerFactory::GetForProfile( | 41 return autofill::PersonalDataManagerFactory::GetForProfile( |
| 37 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); | 42 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
| 38 } | 43 } |
| 39 | 44 |
| 40 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { | 45 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { |
| 41 return g_browser_process->GetApplicationLocale(); | 46 return g_browser_process->GetApplicationLocale(); |
| 42 } | 47 } |
| 43 | 48 |
| 44 bool ChromePaymentRequestDelegate::IsIncognito() const { | 49 bool ChromePaymentRequestDelegate::IsIncognito() const { |
| 45 Profile* profile = | 50 Profile* profile = |
| 46 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 51 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 47 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; | 52 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; |
| 48 } | 53 } |
| 49 | 54 |
| 50 } // namespace payments | 55 } // namespace payments |
| OLD | NEW |