| Index: chrome/browser/payments/chrome_payment_request_delegate.cc
|
| diff --git a/chrome/browser/payments/chrome_payment_request_delegate.cc b/chrome/browser/payments/chrome_payment_request_delegate.cc
|
| index 6f1ee4f4bff0e42b6eeae70bf133bd70d9e548bc..f402fd9ceb4403c37d85b92ffafe4c267b7ee82c 100644
|
| --- a/chrome/browser/payments/chrome_payment_request_delegate.cc
|
| +++ b/chrome/browser/payments/chrome_payment_request_delegate.cc
|
| @@ -12,10 +12,13 @@
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/payments/ssl_validity_checker.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/signin/signin_manager_factory.h"
|
| #include "chrome/browser/ui/browser_dialogs.h"
|
| #include "components/autofill/core/browser/personal_data_manager.h"
|
| #include "components/autofill/core/browser/region_combobox_model.h"
|
| #include "components/payments/content/payment_request_dialog.h"
|
| +#include "components/payments/core/payment_prefs.h"
|
| +#include "components/signin/core/browser/signin_manager.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
|
| #include "third_party/libaddressinput/chromium/chrome_storage_impl.h"
|
| @@ -188,4 +191,23 @@ ukm::UkmService* ChromePaymentRequestDelegate::GetUkmService() {
|
| return g_browser_process->ukm_service();
|
| }
|
|
|
| +std::string ChromePaymentRequestDelegate::GetAuthenticatedEmail() const {
|
| + // Check if the profile is authenticated. Guest profiles or incognito
|
| + // windows may not have a sign in manager, and are considered not
|
| + // authenticated.
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(web_contents_->GetBrowserContext());
|
| + SigninManagerBase* signin_manager =
|
| + SigninManagerFactory::GetForProfile(profile);
|
| + if (signin_manager && signin_manager->IsAuthenticated())
|
| + return signin_manager->GetAuthenticatedAccountInfo().email;
|
| +
|
| + return std::string();
|
| +}
|
| +
|
| +PrefService* ChromePaymentRequestDelegate::GetPrefService() {
|
| + return Profile::FromBrowserContext(web_contents_->GetBrowserContext())
|
| + ->GetPrefs();
|
| +}
|
| +
|
| } // namespace payments
|
|
|