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

Side by Side Diff: components/password_manager/content/browser/content_credential_manager_dispatcher.cc

Issue 613993002: Credential Manager: Reject credential request if an outstanding request is pending. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yay
Patch Set: Rebase. Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/content/browser/content_credential_manager _dispatcher.h" 5 #include "components/password_manager/content/browser/content_credential_manager _dispatcher.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/common/password_form.h" 9 #include "components/autofill/core/common/password_form.h"
10 #include "components/password_manager/content/common/credential_manager_messages .h" 10 #include "components/password_manager/content/common/credential_manager_messages .h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); 70 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
71 } 71 }
72 72
73 void ContentCredentialManagerDispatcher::OnRequestCredential( 73 void ContentCredentialManagerDispatcher::OnRequestCredential(
74 int request_id, 74 int request_id,
75 bool /* zero_click_only */, 75 bool /* zero_click_only */,
76 const std::vector<GURL>& federations) { 76 const std::vector<GURL>& federations) {
77 DCHECK(request_id); 77 DCHECK(request_id);
78 PasswordStore* store = GetPasswordStore(); 78 PasswordStore* store = GetPasswordStore();
79 if (pending_request_id_ || !store) { 79 if (pending_request_id_ || !store) {
80 // TODO(mkwst): Reject the promise if we can't get to the password store, or 80 web_contents()->GetRenderViewHost()->Send(
81 // if we're already requesting credentials. 81 new CredentialManagerMsg_RejectCredentialRequest(
82 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
83 return;
82 } 84 }
83 85
84 pending_request_id_ = request_id; 86 pending_request_id_ = request_id;
85 87
86 autofill::PasswordForm form; 88 autofill::PasswordForm form;
87 form.scheme = autofill::PasswordForm::SCHEME_HTML; 89 form.scheme = autofill::PasswordForm::SCHEME_HTML;
88 form.origin = web_contents()->GetLastCommittedURL().GetOrigin(); 90 form.origin = web_contents()->GetLastCommittedURL().GetOrigin();
89 form.signon_realm = form.origin.spec(); 91 form.signon_realm = form.origin.spec();
90 92
91 store->GetLogins(form, PasswordStore::DISALLOW_PROMPT, this); 93 store->GetLogins(form, PasswordStore::DISALLOW_PROMPT, this);
(...skipping 14 matching lines...) Expand all
106 pending_request_id_, 108 pending_request_id_,
107 info)); 109 info));
108 pending_request_id_ = 0; 110 pending_request_id_ = 0;
109 } 111 }
110 112
111 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() { 113 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() {
112 return client_ ? client_->GetPasswordStore() : nullptr; 114 return client_ ? client_->GetPasswordStore() : nullptr;
113 } 115 }
114 116
115 } // namespace password_manager 117 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/content/browser/content_credential_manager_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698