| 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 582 } |
| 583 | 583 |
| 584 if (possible_types->empty()) | 584 if (possible_types->empty()) |
| 585 possible_types->insert(UNKNOWN_TYPE); | 585 possible_types->insert(UNKNOWN_TYPE); |
| 586 } | 586 } |
| 587 | 587 |
| 588 bool PersonalDataManager::HasPassword() { | 588 bool PersonalDataManager::HasPassword() { |
| 589 return !password_hash_.empty(); | 589 return !password_hash_.empty(); |
| 590 } | 590 } |
| 591 | 591 |
| 592 bool PersonalDataManager::IsDataLoaded() const { |
| 593 return is_data_loaded_; |
| 594 } |
| 595 |
| 592 const std::vector<AutoFillProfile*>& PersonalDataManager::profiles() { | 596 const std::vector<AutoFillProfile*>& PersonalDataManager::profiles() { |
| 593 // |profile_| is NULL in AutoFillManagerTest. | 597 // |profile_| is NULL in AutoFillManagerTest. |
| 594 bool auxiliary_profiles_enabled = profile_ ? profile_->GetPrefs()->GetBoolean( | 598 bool auxiliary_profiles_enabled = profile_ ? profile_->GetPrefs()->GetBoolean( |
| 595 prefs::kAutoFillAuxiliaryProfilesEnabled) : false; | 599 prefs::kAutoFillAuxiliaryProfilesEnabled) : false; |
| 596 if (!auxiliary_profiles_enabled) | 600 if (!auxiliary_profiles_enabled) |
| 597 return web_profiles(); | 601 return web_profiles(); |
| 598 | 602 |
| 599 #if !defined(OS_MACOSX) | 603 #if !defined(OS_MACOSX) |
| 600 NOTREACHED() << "Auxiliary profiles supported on Mac only"; | 604 NOTREACHED() << "Auxiliary profiles supported on Mac only"; |
| 601 #endif | 605 #endif |
| 602 | 606 |
| 603 profiles_.clear(); | 607 profiles_.clear(); |
| 604 | 608 |
| 605 // Populates |auxiliary_profiles_|. | 609 // Populates |auxiliary_profiles_|. |
| 606 LoadAuxiliaryProfiles(); | 610 LoadAuxiliaryProfiles(); |
| 607 | 611 |
| 608 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); | 612 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); |
| 609 profiles_.insert(profiles_.end(), | 613 profiles_.insert(profiles_.end(), |
| 610 auxiliary_profiles_.begin(), auxiliary_profiles_.end()); | 614 auxiliary_profiles_.begin(), auxiliary_profiles_.end()); |
| 611 return profiles_; | 615 return profiles_; |
| 612 } | 616 } |
| 613 | 617 |
| 618 const std::vector<AutoFillProfile*>& PersonalDataManager::web_profiles() { |
| 619 return web_profiles_.get(); |
| 620 } |
| 621 |
| 622 const std::vector<CreditCard*>& PersonalDataManager::credit_cards() { |
| 623 return credit_cards_.get(); |
| 624 } |
| 625 |
| 614 AutoFillProfile* PersonalDataManager::CreateNewEmptyAutoFillProfileForDBThread( | 626 AutoFillProfile* PersonalDataManager::CreateNewEmptyAutoFillProfileForDBThread( |
| 615 const string16& label) { | 627 const string16& label) { |
| 616 // See comment in header for thread details. | 628 // See comment in header for thread details. |
| 617 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 629 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 618 AutoFillProfile* p = new AutoFillProfile; | 630 AutoFillProfile* p = new AutoFillProfile; |
| 619 p->set_label(label); | 631 p->set_label(label); |
| 620 return p; | 632 return p; |
| 621 } | 633 } |
| 622 | 634 |
| 623 void PersonalDataManager::Refresh() { | 635 void PersonalDataManager::Refresh() { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 } | 794 } |
| 783 | 795 |
| 784 creditcards.push_back(**iter); | 796 creditcards.push_back(**iter); |
| 785 } | 797 } |
| 786 | 798 |
| 787 if (!merged) | 799 if (!merged) |
| 788 creditcards.push_back(*imported_credit_card_); | 800 creditcards.push_back(*imported_credit_card_); |
| 789 | 801 |
| 790 SetCreditCards(&creditcards); | 802 SetCreditCards(&creditcards); |
| 791 } | 803 } |
| OLD | NEW |