OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "components/autofill/core/browser/autofill_metrics.h" | 25 #include "components/autofill/core/browser/autofill_metrics.h" |
26 #include "components/autofill/core/browser/form_structure.h" | 26 #include "components/autofill/core/browser/form_structure.h" |
27 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 27 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
28 #include "components/autofill/core/browser/phone_number.h" | 28 #include "components/autofill/core/browser/phone_number.h" |
29 #include "components/autofill/core/browser/phone_number_i18n.h" | 29 #include "components/autofill/core/browser/phone_number_i18n.h" |
30 #include "components/autofill/core/browser/validation.h" | 30 #include "components/autofill/core/browser/validation.h" |
31 #include "components/autofill/core/common/autofill_pref_names.h" | 31 #include "components/autofill/core/common/autofill_pref_names.h" |
32 #include "components/autofill/core/common/autofill_switches.h" | 32 #include "components/autofill/core/common/autofill_switches.h" |
33 #include "components/signin/core/browser/account_tracker_service.h" | 33 #include "components/signin/core/browser/account_tracker_service.h" |
34 #include "components/signin/core/common/signin_pref_names.h" | 34 #include "components/signin/core/common/signin_pref_names.h" |
| 35 #include "components/user_manager/user_id.h" |
35 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" | 36 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_da
ta.h" |
36 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" | 37 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fo
rmatter.h" |
37 | 38 |
38 namespace autofill { | 39 namespace autofill { |
39 namespace { | 40 namespace { |
40 | 41 |
41 using ::i18n::addressinput::AddressField; | 42 using ::i18n::addressinput::AddressField; |
42 using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine; | 43 using ::i18n::addressinput::GetStreetAddressLinesAsSingleLine; |
43 using ::i18n::addressinput::STREET_ADDRESS; | 44 using ::i18n::addressinput::STREET_ADDRESS; |
44 | 45 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 case AUTOFILL_PROFILES_RESULT: | 304 case AUTOFILL_PROFILES_RESULT: |
304 if (h == pending_profiles_query_) { | 305 if (h == pending_profiles_query_) { |
305 ReceiveLoadedDbValues(h, result, &pending_profiles_query_, | 306 ReceiveLoadedDbValues(h, result, &pending_profiles_query_, |
306 &web_profiles_); | 307 &web_profiles_); |
307 LogProfileCount(); // This only logs local profiles. | 308 LogProfileCount(); // This only logs local profiles. |
308 } else { | 309 } else { |
309 ReceiveLoadedDbValues(h, result, &pending_server_profiles_query_, | 310 ReceiveLoadedDbValues(h, result, &pending_server_profiles_query_, |
310 &server_profiles_); | 311 &server_profiles_); |
311 | 312 |
312 if (!server_profiles_.empty()) { | 313 if (!server_profiles_.empty()) { |
313 std::string account_id = | 314 const user_manager::UserID user_id(user_manager::UserID::FromUserEmail
( |
314 pref_service_->GetString(::prefs::kGoogleServicesAccountId); | 315 pref_service_->GetString(::prefs::kGoogleServicesAccountId))); |
315 base::string16 email = | 316 base::string16 email = |
316 base::UTF8ToUTF16( | 317 base::UTF8ToUTF16( |
317 account_tracker_->GetAccountInfo(account_id).email); | 318 account_tracker_->GetAccountInfo(user_id.GetUserEmail()).email
); |
318 DCHECK(!email.empty()); | 319 DCHECK(!email.empty()); |
319 for (AutofillProfile* profile : server_profiles_) | 320 for (AutofillProfile* profile : server_profiles_) |
320 profile->SetRawInfo(EMAIL_ADDRESS, email); | 321 profile->SetRawInfo(EMAIL_ADDRESS, email); |
321 } | 322 } |
322 } | 323 } |
323 break; | 324 break; |
324 case AUTOFILL_CREDITCARDS_RESULT: | 325 case AUTOFILL_CREDITCARDS_RESULT: |
325 if (h == pending_creditcards_query_) { | 326 if (h == pending_creditcards_query_) { |
326 ReceiveLoadedDbValues(h, result, &pending_creditcards_query_, | 327 ReceiveLoadedDbValues(h, result, &pending_creditcards_query_, |
327 &local_credit_cards_); | 328 &local_credit_cards_); |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 } | 1412 } |
1412 if (IsExperimentalWalletIntegrationEnabled() && | 1413 if (IsExperimentalWalletIntegrationEnabled() && |
1413 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { | 1414 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { |
1414 profiles_.insert( | 1415 profiles_.insert( |
1415 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); | 1416 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); |
1416 } | 1417 } |
1417 return profiles_; | 1418 return profiles_; |
1418 } | 1419 } |
1419 | 1420 |
1420 } // namespace autofill | 1421 } // namespace autofill |
OLD | NEW |