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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 1457793002: [Autofill] No longer pass FormStructure pointers in ParseQueryResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added AutofillManager tests Created 5 years, 1 month 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: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 031691e3692fa0a22188f59bf5b926254b7dd435..962dffd1b951aebba3c0f90a9fca1b8c96cdfba5 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -742,7 +742,24 @@ void AutofillManager::OnSetDataList(const std::vector<base::string16>& values,
void AutofillManager::OnLoadedServerPredictions(
const std::string& response_xml,
- const std::vector<FormStructure*>& queried_forms) {
+ const std::vector<std::string>& form_signatures) {
+ // We obtain the current valid FormStructures represented by
+ // |form_signatures|. We invert both lists because most recent forms are at
+ // the end of the list.
+ std::vector<FormStructure*> queried_forms;
+ for (const std::string& signature : base::Reversed(form_signatures)) {
+ for (FormStructure* cur_form : base::Reversed(form_structures_)) {
+ if (cur_form->FormSignature() == signature) {
+ queried_forms.push_back(cur_form);
+ continue;
+ }
+ }
+ }
+ // If there are no current forms corresponding to the queried signatures, drop
+ // the query response.
+ if (queried_forms.empty())
+ return;
+
// Parse and store the server predictions.
FormStructure::ParseQueryResponse(response_xml, queried_forms,
client_->GetRapporService());
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698