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

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

Issue 615383002: Credential Manager: Return the first valid item from the PasswordStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/content/browser/content_credential_manager_dispatcher.cc
diff --git a/components/password_manager/content/browser/content_credential_manager_dispatcher.cc b/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
index be8a06cd46ffac8510fe509845c05145dbf7ef5c..eaf2349ca19f37b1ef16922a58f90569fbfee028 100644
--- a/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
+++ b/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
@@ -46,8 +46,7 @@ bool ContentCredentialManagerDispatcher::OnMessageReceived(
}
void ContentCredentialManagerDispatcher::OnNotifyFailedSignIn(
- int request_id,
- const password_manager::CredentialInfo&) {
+ int request_id, const CredentialInfo&) {
// TODO(mkwst): This is a stub.
web_contents()->GetRenderViewHost()->Send(
new CredentialManagerMsg_AcknowledgeFailedSignIn(
@@ -55,8 +54,7 @@ void ContentCredentialManagerDispatcher::OnNotifyFailedSignIn(
}
void ContentCredentialManagerDispatcher::OnNotifySignedIn(
- int request_id,
- const password_manager::CredentialInfo&) {
+ int request_id, const CredentialInfo&) {
// TODO(mkwst): This is a stub.
web_contents()->GetRenderViewHost()->Send(
new CredentialManagerMsg_AcknowledgeSignedIn(
@@ -97,11 +95,26 @@ void ContentCredentialManagerDispatcher::OnGetPasswordStoreResults(
const std::vector<autofill::PasswordForm*>& results) {
DCHECK(pending_request_id_);
- // TODO(mkwst): This is a stub. We should be looking at |results| here. Baby
- // steps.
- password_manager::CredentialInfo info(base::ASCIIToUTF16("id"),
- base::ASCIIToUTF16("name"),
- GURL("https://example.com/image.png"));
+ // Take ownership of all the password form objects in the |results| vector.
+ ScopedVector<autofill::PasswordForm> entries;
+ entries.assign(results.begin(), results.end());
+
+ if (results.empty()) {
+ // TODO(mkwst): This should be a separate message from above in
+ // OnRequestCredential. Waiting on a Blink-side change to make that
+ // possible.
+ web_contents()->GetRenderViewHost()->Send(
+ new CredentialManagerMsg_RejectCredentialRequest(
+ web_contents()->GetRenderViewHost()->GetRoutingID(),
+ pending_request_id_));
+ return;
+ }
+
+ // TODO(mkwst): This is a stub. We're just grabbing the first result and
+ // piping it down into Blink. Really, we should be kicking off some sort
+ // of UI full of magic moments and delight. Also, we should deal with
+ // federated login types.
+ CredentialInfo info(*entries[0]);
web_contents()->GetRenderViewHost()->Send(
new CredentialManagerMsg_SendCredential(
web_contents()->GetRenderViewHost()->GetRoutingID(),
« 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