Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/autofill/personal_data_manager.cc

Issue 1952002: AutoFill profile shouldn't be saved when cancelled during initial setup. (Closed)
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
237 void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) { 253 void PersonalDataManager::SetProfiles(std::vector<AutoFillProfile>* profiles) {
238 if (profile_->IsOffTheRecord()) 254 if (profile_->IsOffTheRecord())
239 return; 255 return;
240 256
241 SetUniqueProfileLabels(profiles); 257 SetUniqueProfileLabels(profiles);
242 258
243 WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); 259 WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS);
244 if (!wds) 260 if (!wds)
245 return; 261 return;
246 262
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 // Start at the second element because the first label should not be 665 // Start at the second element because the first label should not be
650 // renamed. The appended label number starts at 2, because the first label 666 // renamed. The appended label number starts at 2, because the first label
651 // has an implicit index of 1. 667 // has an implicit index of 1.
652 for (size_t i = 1; i < iter->second.size(); ++i) { 668 for (size_t i = 1; i < iter->second.size(); ++i) {
653 string16 newlabel = iter->second[i]->Label() + 669 string16 newlabel = iter->second[i]->Label() +
654 UintToString16(static_cast<unsigned int>(i + 1)); 670 UintToString16(static_cast<unsigned int>(i + 1));
655 iter->second[i]->set_label(newlabel); 671 iter->second[i]->set_label(newlabel);
656 } 672 }
657 } 673 }
658 } 674 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/personal_data_manager.h ('k') | chrome/browser/cocoa/browser_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698