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

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

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor PasswordAutofillManager in password_manager component. Created 6 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 107ce1e8bed13772209c7acd4296619f58ebea77..ba256cabed63a025fdc07dd4d6efb0976c510434 100644
--- a/components/password_manager/core/browser/password_manager.cc
+++ b/components/password_manager/core/browser/password_manager.cc
@@ -11,7 +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/common/autofill_data_validation.h"
#include "components/autofill/core/common/password_autofill_util.h"
+#include "components/password_manager/core/browser/password_autofill_manager.h"
#include "components/password_manager/core/browser/password_form_manager.h"
#include "components/password_manager/core/browser/password_manager_client.h"
#include "components/password_manager/core/browser/password_manager_driver.h"
@@ -228,6 +230,8 @@ void PasswordManager::DidNavigateMainFrame(bool is_in_page) {
// different page.
if (!is_in_page)
pending_login_managers_.clear();
+
+ driver_->GetPasswordAutofillManager()->Reset();
Garrett Casto 2014/03/12 01:09:22 This should only happen if the navigation is not i
Patrick Dubroy 2014/03/12 16:47:09 Done.
}
void PasswordManager::OnPasswordFormSubmitted(
@@ -310,6 +314,31 @@ void PasswordManager::OnPasswordFormsRendered(
}
}
+void PasswordManager::OnAddPasswordFormMapping(
Garrett Casto 2014/03/12 01:09:22 Any reason why you are doing Driver -> PasswordMan
Patrick Dubroy 2014/03/12 16:47:09 Do you mean why is this function defined in Passwo
Garrett Casto 2014/03/14 08:25:22 I guess it depends on how you think the code shoul
Patrick Dubroy 2014/03/14 12:07:19 Makes sense. Fixed to be as you described.
+ const autofill::FormFieldData& username_field,
+ const autofill::PasswordFormFillData& fill_data) {
+ if (!autofill::IsValidFormFieldData(username_field) ||
+ !autofill::IsValidPasswordFormFillData(fill_data))
+ return;
+
+ driver_->GetPasswordAutofillManager()->AddPasswordFormMapping(
+ username_field, fill_data);
+}
+
+void PasswordManager::OnShowPasswordSuggestions(
+ const autofill::FormFieldData& field,
+ const gfx::RectF& bounds,
+ const std::vector<base::string16>& suggestions,
+ const std::vector<base::string16>& realms) {
+ if (!autofill::IsValidString16Vector(suggestions) ||
+ !autofill::IsValidString16Vector(realms) ||
+ suggestions.size() != realms.size())
+ return;
+
+ driver_->GetPasswordAutofillManager()->ShowPasswordSuggestions(
+ field, bounds, suggestions, realms);
+}
+
void PasswordManager::PossiblyInitializeUsernamesExperiment(
const PasswordFormMap& best_matches) const {
if (base::FieldTrialList::Find(kOtherPossibleUsernamesExperiment))

Powered by Google App Engine
This is Rietveld 408576698