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

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

Issue 6286003: Refactoring of upload, form saving, and UMA logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 observers_.RemoveObserver(observer); 133 observers_.RemoveObserver(observer);
134 observers_.AddObserver(observer); 134 observers_.AddObserver(observer);
135 } 135 }
136 136
137 void PersonalDataManager::RemoveObserver( 137 void PersonalDataManager::RemoveObserver(
138 PersonalDataManager::Observer* observer) { 138 PersonalDataManager::Observer* observer) {
139 observers_.RemoveObserver(observer); 139 observers_.RemoveObserver(observer);
140 } 140 }
141 141
142 bool PersonalDataManager::ImportFormData( 142 bool PersonalDataManager::ImportFormData(
143 const std::vector<FormStructure*>& form_structures) { 143 const std::vector<const FormStructure*>& form_structures) {
144 // Parse the form and construct a profile based on the information that is 144 // Parse the form and construct a profile based on the information that is
145 // possible to import. 145 // possible to import.
146 int importable_fields = 0; 146 int importable_fields = 0;
147 int importable_credit_card_fields = 0; 147 int importable_credit_card_fields = 0;
148 imported_profile_.reset(new AutoFillProfile); 148 imported_profile_.reset(new AutoFillProfile);
149 // TODO(jhawkins): Use a hash of the CC# instead of a list of unique IDs? 149 // TODO(jhawkins): Use a hash of the CC# instead of a list of unique IDs?
150 imported_credit_card_.reset(new CreditCard); 150 imported_credit_card_.reset(new CreditCard);
151 151
152 std::vector<FormStructure*>::const_iterator iter; 152 std::vector<const FormStructure*>::const_iterator iter;
153 for (iter = form_structures.begin(); iter != form_structures.end(); ++iter) { 153 for (iter = form_structures.begin(); iter != form_structures.end(); ++iter) {
154 const FormStructure* form = *iter; 154 const FormStructure* form = *iter;
155 for (size_t i = 0; i < form->field_count(); ++i) { 155 for (size_t i = 0; i < form->field_count(); ++i) {
156 const AutoFillField* field = form->field(i); 156 const AutoFillField* field = form->field(i);
157 string16 value = CollapseWhitespace(field->value(), false); 157 string16 value = CollapseWhitespace(field->value(), false);
158 158
159 // If we don't know the type of the field, or the user hasn't entered any 159 // If we don't know the type of the field, or the user hasn't entered any
160 // information into the field, then skip it. 160 // information into the field, then skip it.
161 if (!field->IsFieldFillable() || value.empty()) 161 if (!field->IsFieldFillable() || value.empty())
162 continue; 162 continue;
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 792 }
793 793
794 creditcards.push_back(**iter); 794 creditcards.push_back(**iter);
795 } 795 }
796 796
797 if (!merged) 797 if (!merged)
798 creditcards.push_back(*imported_credit_card_); 798 creditcards.push_back(*imported_credit_card_);
799 799
800 SetCreditCards(&creditcards); 800 SetCreditCards(&creditcards);
801 } 801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698