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

Unified Diff: components/password_manager/content/browser/credential_manager_dispatcher.cc

Issue 1832933002: Update the |skip_zero_click| flag of a credential when selected in the account chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 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/content/browser/credential_manager_dispatcher.cc
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher.cc b/components/password_manager/content/browser/credential_manager_dispatcher.cc
index ecf9ddff8d221e0b29b7951f62671e7d5f0568c4..81194cb8b27a5f1b62b01bed8be95c436f995eb1 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher.cc
@@ -225,18 +225,6 @@ void CredentialManagerDispatcher::SendCredential(int request_id,
DCHECK(pending_request_);
DCHECK_EQ(pending_request_->id(), request_id);
- if (PasswordStore* store = GetPasswordStore()) {
- if (info.type != CredentialType::CREDENTIAL_TYPE_EMPTY &&
- IsZeroClickAllowed()) {
- DCHECK(IsUpdatingCredentialAllowed());
- scoped_ptr<autofill::PasswordForm> form(
- CreatePasswordFormFromCredentialInfo(info,
- pending_request_->origin()));
- form->skip_zero_click = false;
- store->UpdateLogin(*form);
- }
- }
-
web_contents()->GetRenderViewHost()->Send(
new CredentialManagerMsg_SendCredential(
web_contents()->GetRenderViewHost()->GetRoutingID(),
@@ -244,6 +232,28 @@ void CredentialManagerDispatcher::SendCredential(int request_id,
pending_request_.reset();
}
+void CredentialManagerDispatcher::SendPasswordForm(
+ int request_id,
+ const autofill::PasswordForm* form) {
+ CredentialInfo info;
+ if (form) {
+ password_manager::CredentialType type_to_return =
+ form->federation_origin.unique()
+ ? CredentialType::CREDENTIAL_TYPE_PASSWORD
+ : CredentialType::CREDENTIAL_TYPE_FEDERATED;
+ info = CredentialInfo(*form, type_to_return);
+ if (PasswordStore* store = GetPasswordStore()) {
+ if (form->skip_zero_click && IsZeroClickAllowed()) {
+ DCHECK(IsUpdatingCredentialAllowed());
+ autofill::PasswordForm update_form = *form;
+ update_form.skip_zero_click = false;
+ store->UpdateLogin(update_form);
+ }
+ }
+ }
+ SendCredential(request_id, info);
+}
+
PasswordManagerClient* CredentialManagerDispatcher::client() const {
return client_;
}

Powered by Google App Engine
This is Rietveld 408576698