OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autofill/personal_data_manager.h" | 5 #include "chrome/browser/autofill/personal_data_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 unique_profile_ids_.clear(); | 516 unique_profile_ids_.clear(); |
517 web_profiles_.reset(); | 517 web_profiles_.reset(); |
518 | 518 |
519 const WDResult<std::vector<AutoFillProfile*> >* r = | 519 const WDResult<std::vector<AutoFillProfile*> >* r = |
520 static_cast<const WDResult<std::vector<AutoFillProfile*> >*>(result); | 520 static_cast<const WDResult<std::vector<AutoFillProfile*> >*>(result); |
521 | 521 |
522 std::vector<AutoFillProfile*> profiles = r->GetValue(); | 522 std::vector<AutoFillProfile*> profiles = r->GetValue(); |
523 for (std::vector<AutoFillProfile*>::iterator iter = profiles.begin(); | 523 for (std::vector<AutoFillProfile*>::iterator iter = profiles.begin(); |
524 iter != profiles.end(); ++iter) { | 524 iter != profiles.end(); ++iter) { |
525 unique_profile_ids_.insert((*iter)->unique_id()); | 525 unique_profile_ids_.insert((*iter)->unique_id()); |
| 526 unique_ids_.insert((*iter)->unique_id()); |
526 web_profiles_.push_back(*iter); | 527 web_profiles_.push_back(*iter); |
527 } | 528 } |
528 } | 529 } |
529 | 530 |
530 void PersonalDataManager::ReceiveLoadedCreditCards( | 531 void PersonalDataManager::ReceiveLoadedCreditCards( |
531 WebDataService::Handle h, const WDTypedResult* result) { | 532 WebDataService::Handle h, const WDTypedResult* result) { |
532 DCHECK_EQ(pending_creditcards_query_, h); | 533 DCHECK_EQ(pending_creditcards_query_, h); |
533 pending_creditcards_query_ = 0; | 534 pending_creditcards_query_ = 0; |
534 | 535 |
535 AutoLock lock(unique_ids_lock_); | 536 AutoLock lock(unique_ids_lock_); |
536 unique_creditcard_ids_.clear(); | 537 unique_creditcard_ids_.clear(); |
537 credit_cards_.reset(); | 538 credit_cards_.reset(); |
538 | 539 |
539 const WDResult<std::vector<CreditCard*> >* r = | 540 const WDResult<std::vector<CreditCard*> >* r = |
540 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); | 541 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); |
541 | 542 |
542 std::vector<CreditCard*> credit_cards = r->GetValue(); | 543 std::vector<CreditCard*> credit_cards = r->GetValue(); |
543 for (std::vector<CreditCard*>::iterator iter = credit_cards.begin(); | 544 for (std::vector<CreditCard*>::iterator iter = credit_cards.begin(); |
544 iter != credit_cards.end(); ++iter) { | 545 iter != credit_cards.end(); ++iter) { |
545 unique_creditcard_ids_.insert((*iter)->unique_id()); | 546 unique_creditcard_ids_.insert((*iter)->unique_id()); |
| 547 unique_ids_.insert((*iter)->unique_id()); |
546 credit_cards_.push_back(*iter); | 548 credit_cards_.push_back(*iter); |
547 } | 549 } |
548 } | 550 } |
549 | 551 |
550 void PersonalDataManager::CancelPendingQuery(WebDataService::Handle* handle) { | 552 void PersonalDataManager::CancelPendingQuery(WebDataService::Handle* handle) { |
551 if (*handle) { | 553 if (*handle) { |
552 WebDataService* web_data_service = | 554 WebDataService* web_data_service = |
553 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 555 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
554 if (!web_data_service) { | 556 if (!web_data_service) { |
555 NOTREACHED(); | 557 NOTREACHED(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 683 } |
682 | 684 |
683 creditcards.push_back(**iter); | 685 creditcards.push_back(**iter); |
684 } | 686 } |
685 | 687 |
686 if (!merged) | 688 if (!merged) |
687 creditcards.push_back(*imported_credit_card_); | 689 creditcards.push_back(*imported_credit_card_); |
688 | 690 |
689 SetCreditCards(&creditcards); | 691 SetCreditCards(&creditcards); |
690 } | 692 } |
OLD | NEW |