Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6159)

Unified Diff: chrome/browser/payments/chrome_payment_request_delegate.cc

Issue 2876663002: [Web Payments] Add data attribution string to dialog (Closed)
Patch Set: Fix deps Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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"
Mathieu 2017/05/11 13:47:55 should include pref_service.h somewhere here I thi
anthonyvd 2017/05/11 17:46:28 No need since we're not using it. All that matters
#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

Powered by Google App Engine
This is Rietveld 408576698