| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 if (imported_credit_card_.get()) { | 228 if (imported_credit_card_.get()) { |
| 229 imported_credit_card_->set_label(ASCIIToUTF16(kUnlabeled)); | 229 imported_credit_card_->set_label(ASCIIToUTF16(kUnlabeled)); |
| 230 | 230 |
| 231 std::vector<CreditCard> credit_cards; | 231 std::vector<CreditCard> credit_cards; |
| 232 credit_cards.push_back(*imported_credit_card_); | 232 credit_cards.push_back(*imported_credit_card_); |
| 233 SetCreditCards(&credit_cards); | 233 SetCreditCards(&credit_cards); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void PersonalDataManager::GetImportedFormData(AutoFillProfile** profile, | |
| 238 CreditCard** credit_card) { | |
| 239 DCHECK(profile); | |
| 240 DCHECK(credit_card); | |
| 241 | |
| 242 if (imported_profile_.get()) { | |
| 243 imported_profile_->set_label(ASCIIToUTF16(kUnlabeled)); | |
| 244 } | |
| 245 *profile = imported_profile_.get(); | |
| 246 | |
| 247 if (imported_credit_card_.get()) { | |
| 248 imported_credit_card_->set_label(ASCIIToUTF16(kUnlabeled)); | |
| 249 } | |
| 250 *credit_card = imported_credit_card_.get(); | |
| 251 } | |
| 252 | |
| 253 void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) { | 237 void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) { |
| 254 if (profile_->IsOffTheRecord()) | 238 if (profile_->IsOffTheRecord()) |
| 255 return; | 239 return; |
| 256 | 240 |
| 257 SetUniqueProfileLabels(profiles); | 241 SetUniqueProfileLabels(profiles); |
| 258 | 242 |
| 259 WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); | 243 WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
| 260 if (!wds) | 244 if (!wds) |
| 261 return; | 245 return; |
| 262 | 246 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // Start at the second element because the first label should not be | 649 // Start at the second element because the first label should not be |
| 666 // renamed. The appended label number starts at 2, because the first label | 650 // renamed. The appended label number starts at 2, because the first label |
| 667 // has an implicit index of 1. | 651 // has an implicit index of 1. |
| 668 for (size_t i = 1; i < iter->second.size(); ++i) { | 652 for (size_t i = 1; i < iter->second.size(); ++i) { |
| 669 string16 newlabel = iter->second[i]->Label() + | 653 string16 newlabel = iter->second[i]->Label() + |
| 670 UintToString16(static_cast<unsigned int>(i + 1)); | 654 UintToString16(static_cast<unsigned int>(i + 1)); |
| 671 iter->second[i]->set_label(newlabel); | 655 iter->second[i]->set_label(newlabel); |
| 672 } | 656 } |
| 673 } | 657 } |
| 674 } | 658 } |
| OLD | NEW |