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 d459cfa4eaac65724b90dcd874cfc65133b1eb3b..45a5636012403de57249106d45e552401362188a 100644 |
--- a/components/password_manager/content/browser/credential_manager_dispatcher.cc |
+++ b/components/password_manager/content/browser/credential_manager_dispatcher.cc |
@@ -23,6 +23,8 @@ |
namespace password_manager { |
+// CredentialManagerDispatcher::PendingRequestTask ----------------------------- |
+ |
class CredentialManagerDispatcher::PendingRequestTask |
: public PasswordStoreConsumer { |
public: |
@@ -102,6 +104,40 @@ class CredentialManagerDispatcher::PendingRequestTask |
DISALLOW_COPY_AND_ASSIGN(PendingRequestTask); |
}; |
+// CredentialManagerDispatcher::PendingSignedOutTask --------------------------- |
+ |
+class CredentialManagerDispatcher::PendingSignedOutTask |
+ : public PasswordStoreConsumer { |
+ public: |
+ PendingSignedOutTask(CredentialManagerDispatcher* const dispatcher, |
+ int request_id, |
+ const GURL& origin) |
+ : dispatcher_(dispatcher), id_(request_id), origin_(origin) {} |
vabr (Chromium)
2015/02/05 10:27:10
As discussed before on engedy's CL https://coderev
|
+ |
+ // PasswordStoreConsumer implementation. |
+ void OnGetPasswordStoreResults( |
vabr (Chromium)
2015/02/05 10:27:10
A heads-up: This will conflict with a change in si
|
+ const std::vector<autofill::PasswordForm*>& results) override { |
+ PasswordStore* store = dispatcher_->GetPasswordStore(); |
+ for (autofill::PasswordForm* form : results) { |
+ if (form->origin == origin_) { |
+ form->skip_zero_click = true; |
+ store->UpdateLogin(*form); |
+ } |
+ } |
+ } |
+ |
+ private: |
+ // Backlink to the CredentialManagerDispatcher that owns this object. |
+ CredentialManagerDispatcher* const dispatcher_; |
+ |
+ const int id_; |
+ const GURL origin_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PendingSignedOutTask); |
+}; |
+ |
+// CredentialManagerDispatcher ------------------------------------------------- |
+ |
CredentialManagerDispatcher::CredentialManagerDispatcher( |
content::WebContents* web_contents, |
PasswordManagerClient* client) |
@@ -153,6 +189,7 @@ void CredentialManagerDispatcher::OnNotifySignedIn( |
scoped_ptr<autofill::PasswordForm> form(CreatePasswordFormFromCredentialInfo( |
credential, web_contents()->GetLastCommittedURL().GetOrigin())); |
+ form->skip_zero_click = !IsZeroClickAllowed(); |
// TODO(mkwst): This is a stub; we should be checking the PasswordStore to |
// determine whether or not the credential exists, and calling UpdateLogin |
@@ -168,7 +205,17 @@ void CredentialManagerDispatcher::OnProvisionalSaveComplete() { |
void CredentialManagerDispatcher::OnNotifySignedOut(int request_id) { |
DCHECK(request_id); |
- // TODO(mkwst): This is a stub. |
+ |
+ PasswordStore* store = GetPasswordStore(); |
+ if (!pending_sign_out_ && store) { |
+ pending_sign_out_.reset(new PendingSignedOutTask( |
+ this, request_id, web_contents()->GetLastCommittedURL().GetOrigin())); |
+ |
+ // This will result in a callback to |
+ // PendingSignedOutTask::OnGetPasswordStoreResults(). |
+ store->GetAutofillableLogins(pending_sign_out_.get()); |
+ } |
+ |
web_contents()->GetRenderViewHost()->Send( |
new CredentialManagerMsg_AcknowledgeSignedOut( |
web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); |
@@ -234,6 +281,9 @@ void CredentialManagerDispatcher::SendCredential(int request_id, |
const CredentialInfo& info) { |
DCHECK(pending_request_); |
DCHECK_EQ(pending_request_->id(), request_id); |
+ // TODO(mkwst): We need to update the underlying PasswordForm if the user |
+ // has enabled zeroclick globally, and clicks through a non-zeroclick form |
+ // for an origin. |
web_contents()->GetRenderViewHost()->Send( |
new CredentialManagerMsg_SendCredential( |
web_contents()->GetRenderViewHost()->GetRoutingID(), |