Index: chrome/utility/importer/external_process_importer_bridge.cc |
diff --git a/chrome/utility/importer/external_process_importer_bridge.cc b/chrome/utility/importer/external_process_importer_bridge.cc |
index c399d52093943c151a7fb69423d327dfb793bcfb..56c82be6be74ae495eaf62bf382dbb9fd5944d2d 100644 |
--- a/chrome/utility/importer/external_process_importer_bridge.cc |
+++ b/chrome/utility/importer/external_process_importer_bridge.cc |
@@ -25,7 +25,7 @@ namespace { |
const int kNumBookmarksToSend = 100; |
const int kNumHistoryRowsToSend = 100; |
const int kNumFaviconsToSend = 100; |
- |
+const int kNumAutofillFormDataToSend = 100; |
} |
ExternalProcessImporterBridge::ExternalProcessImporterBridge( |
@@ -141,6 +141,33 @@ void ExternalProcessImporterBridge::SetPasswordForm( |
Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); |
} |
+void ExternalProcessImporterBridge::SetAutofillFormData( |
+ const std::vector<ImporterAutofillFormDataEntry>& entries) { |
+ Send(new ProfileImportProcessHostMsg_AutofillFormDataImportStart( |
+ entries.size())); |
+ |
+ // |autofill_form_data_entries_left| is required for the checks below as |
+ // Windows has a Debug bounds-check which prevents pushing an iterator beyond |
+ // its end() (i.e., |it + 2 < s.end()| crashes in debug mode if |i + 1 == |
+ // s.end()|). |
+ int autofill_form_data_entries_left = entries.end() - entries.begin(); |
+ for (std::vector<ImporterAutofillFormDataEntry>::const_iterator it = |
+ entries.begin(); |
+ it < entries.end();) { |
+ std::vector<ImporterAutofillFormDataEntry> autofill_form_data_entry_group; |
+ std::vector<ImporterAutofillFormDataEntry>::const_iterator end_group = |
+ it + |
+ std::min(autofill_form_data_entries_left, kNumAutofillFormDataToSend); |
+ autofill_form_data_entry_group.assign(it, end_group); |
+ |
+ Send(new ProfileImportProcessHostMsg_AutofillFormDataImportGroup( |
+ autofill_form_data_entry_group)); |
+ autofill_form_data_entries_left -= end_group - it; |
+ it = end_group; |
+ } |
+ DCHECK_EQ(0, autofill_form_data_entries_left); |
+} |
+ |
void ExternalProcessImporterBridge::NotifyStarted() { |
Send(new ProfileImportProcessHostMsg_Import_Started()); |
} |