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

Unified Diff: chrome/utility/importer/external_process_importer_bridge.cc

Issue 480953002: Implement "Autofill form data" import for Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (simplify Read method) Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
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());
}
« no previous file with comments | « chrome/utility/importer/external_process_importer_bridge.h ('k') | chrome/utility/importer/firefox_importer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698