| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 11 #include "chrome/browser/autofill/validation_rules_storage_factory.h" | 11 #include "chrome/browser/autofill/validation_rules_storage_factory.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/payments/ssl_validity_checker.h" | 13 #include "chrome/browser/payments/ssl_validity_checker.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" |
| 15 #include "chrome/browser/ui/browser_dialogs.h" | 16 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "components/autofill/core/browser/personal_data_manager.h" | 17 #include "components/autofill/core/browser/personal_data_manager.h" |
| 17 #include "components/autofill/core/browser/region_combobox_model.h" | 18 #include "components/autofill/core/browser/region_combobox_model.h" |
| 18 #include "components/payments/content/payment_request_dialog.h" | 19 #include "components/payments/content/payment_request_dialog.h" |
| 20 #include "components/payments/core/payment_prefs.h" |
| 21 #include "components/signin/core/browser/signin_manager.h" |
| 19 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 20 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" | 23 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" |
| 21 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" | 24 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" |
| 22 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/preload_su
pplier.h" | 25 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/preload_su
pplier.h" |
| 23 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/region_dat
a.h" | 26 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/region_dat
a.h" |
| 24 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/region_dat
a_builder.h" | 27 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/region_dat
a_builder.h" |
| 25 | 28 |
| 26 namespace payments { | 29 namespace payments { |
| 27 | 30 |
| 28 namespace { | 31 namespace { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 184 } |
| 182 | 185 |
| 183 AddressNormalizer* ChromePaymentRequestDelegate::GetAddressNormalizer() { | 186 AddressNormalizer* ChromePaymentRequestDelegate::GetAddressNormalizer() { |
| 184 return &address_normalizer_; | 187 return &address_normalizer_; |
| 185 } | 188 } |
| 186 | 189 |
| 187 ukm::UkmService* ChromePaymentRequestDelegate::GetUkmService() { | 190 ukm::UkmService* ChromePaymentRequestDelegate::GetUkmService() { |
| 188 return g_browser_process->ukm_service(); | 191 return g_browser_process->ukm_service(); |
| 189 } | 192 } |
| 190 | 193 |
| 194 std::string ChromePaymentRequestDelegate::GetAuthenticatedEmail() const { |
| 195 // Check if the profile is authenticated. Guest profiles or incognito |
| 196 // windows may not have a sign in manager, and are considered not |
| 197 // authenticated. |
| 198 Profile* profile = |
| 199 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 200 SigninManagerBase* signin_manager = |
| 201 SigninManagerFactory::GetForProfile(profile); |
| 202 if (signin_manager && signin_manager->IsAuthenticated()) |
| 203 return signin_manager->GetAuthenticatedAccountInfo().email; |
| 204 |
| 205 return std::string(); |
| 206 } |
| 207 |
| 208 PrefService* ChromePaymentRequestDelegate::GetPrefService() { |
| 209 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()) |
| 210 ->GetPrefs(); |
| 211 } |
| 212 |
| 191 } // namespace payments | 213 } // namespace payments |
| OLD | NEW |