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

Unified Diff: components/password_manager/core/browser/password_manager.cc

Issue 1028163002: Processing USERNAME reply from Autofill server in Password Manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small nit Created 5 years, 9 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: components/password_manager/core/browser/password_manager.cc
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc
index 38f2df9b836421b535ad10682ad32cded7f998d6..c9e7d5b4934c769a5999eac2d416c61f0a7a564a 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -11,6 +11,9 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
+#include "components/autofill/core/browser/autofill_field.h"
+#include "components/autofill/core/browser/form_structure.h"
+#include "components/autofill/core/common/form_data_predictions.h"
#include "components/password_manager/core/browser/browser_save_password_progress_logger.h"
#include "components/password_manager/core/browser/password_autofill_manager.h"
#include "components/password_manager/core/browser/password_form_manager.h"
@@ -717,4 +720,24 @@ void PasswordManager::Autofill(password_manager::PasswordManagerDriver* driver,
client_->PasswordWasAutofilled(best_matches);
}
+void PasswordManager::ProcessAutofillPredictions(
+ password_manager::PasswordManagerDriver* driver,
+ const std::vector<autofill::FormStructure*>& forms) {
+ // Leave only forms that contain fields that are useful for password manager.
+ std::map<autofill::FormData, autofill::FormFieldData> predictions;
+ for (autofill::FormStructure* form : forms) {
+ for (std::vector<autofill::AutofillField*>::const_iterator field =
+ form->begin();
+ field != form->end(); ++field) {
+ if ((*field)->server_type() == autofill::USERNAME ||
+ (*field)->server_type() == autofill::USERNAME_AND_EMAIL_ADDRESS) {
+ predictions[form->ToFormData()] = *(*field);
+ }
+ }
+ }
+ if (predictions.empty())
+ return;
+ driver->AutofillDataReceived(predictions);
+}
+
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698