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

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

Issue 619033002: Revert of Credential Manager: Return the first valid item from the PasswordStore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yay
Patch Set: 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 28 matching lines...) Expand all
39 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedOut, 39 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_NotifySignedOut,
40 OnNotifySignedOut); 40 OnNotifySignedOut);
41 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential, 41 IPC_MESSAGE_HANDLER(CredentialManagerHostMsg_RequestCredential,
42 OnRequestCredential); 42 OnRequestCredential);
43 IPC_MESSAGE_UNHANDLED(handled = false) 43 IPC_MESSAGE_UNHANDLED(handled = false)
44 IPC_END_MESSAGE_MAP() 44 IPC_END_MESSAGE_MAP()
45 return handled; 45 return handled;
46 } 46 }
47 47
48 void ContentCredentialManagerDispatcher::OnNotifyFailedSignIn( 48 void ContentCredentialManagerDispatcher::OnNotifyFailedSignIn(
49 int request_id, const CredentialInfo&) { 49 int request_id,
50 const password_manager::CredentialInfo&) {
50 // TODO(mkwst): This is a stub. 51 // TODO(mkwst): This is a stub.
51 web_contents()->GetRenderViewHost()->Send( 52 web_contents()->GetRenderViewHost()->Send(
52 new CredentialManagerMsg_AcknowledgeFailedSignIn( 53 new CredentialManagerMsg_AcknowledgeFailedSignIn(
53 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); 54 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
54 } 55 }
55 56
56 void ContentCredentialManagerDispatcher::OnNotifySignedIn( 57 void ContentCredentialManagerDispatcher::OnNotifySignedIn(
57 int request_id, const CredentialInfo&) { 58 int request_id,
59 const password_manager::CredentialInfo&) {
58 // TODO(mkwst): This is a stub. 60 // TODO(mkwst): This is a stub.
59 web_contents()->GetRenderViewHost()->Send( 61 web_contents()->GetRenderViewHost()->Send(
60 new CredentialManagerMsg_AcknowledgeSignedIn( 62 new CredentialManagerMsg_AcknowledgeSignedIn(
61 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); 63 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
62 } 64 }
63 65
64 void ContentCredentialManagerDispatcher::OnNotifySignedOut(int request_id) { 66 void ContentCredentialManagerDispatcher::OnNotifySignedOut(int request_id) {
65 // TODO(mkwst): This is a stub. 67 // TODO(mkwst): This is a stub.
66 web_contents()->GetRenderViewHost()->Send( 68 web_contents()->GetRenderViewHost()->Send(
67 new CredentialManagerMsg_AcknowledgeSignedOut( 69 new CredentialManagerMsg_AcknowledgeSignedOut(
(...skipping 20 matching lines...) Expand all
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);
92 } 94 }
93 95
94 void ContentCredentialManagerDispatcher::OnGetPasswordStoreResults( 96 void ContentCredentialManagerDispatcher::OnGetPasswordStoreResults(
95 const std::vector<autofill::PasswordForm*>& results) { 97 const std::vector<autofill::PasswordForm*>& results) {
96 DCHECK(pending_request_id_); 98 DCHECK(pending_request_id_);
97 99
98 if (results.empty()) { 100 // TODO(mkwst): This is a stub. We should be looking at |results| here. Baby
99 // TODO(mkwst): This should be a separate message from above in 101 // steps.
100 // OnRequestCredential. Waiting on a Blink-side change to make that 102 password_manager::CredentialInfo info(base::ASCIIToUTF16("id"),
101 // possible. 103 base::ASCIIToUTF16("name"),
102 web_contents()->GetRenderViewHost()->Send( 104 GURL("https://example.com/image.png"));
103 new CredentialManagerMsg_RejectCredentialRequest(
104 web_contents()->GetRenderViewHost()->GetRoutingID(),
105 pending_request_id_));
106 return;
107 }
108
109 // TODO(mkwst): This is a stub. We're just grabbing the first result and
110 // piping it down into Blink. Really, we should be kicking off some sort
111 // of UI full of magic moments and delight. Also, we should deal with
112 // federated login types.
113 CredentialInfo info(*results[0]);
114 web_contents()->GetRenderViewHost()->Send( 105 web_contents()->GetRenderViewHost()->Send(
115 new CredentialManagerMsg_SendCredential( 106 new CredentialManagerMsg_SendCredential(
116 web_contents()->GetRenderViewHost()->GetRoutingID(), 107 web_contents()->GetRenderViewHost()->GetRoutingID(),
117 pending_request_id_, 108 pending_request_id_,
118 info)); 109 info));
119 pending_request_id_ = 0; 110 pending_request_id_ = 0;
120 } 111 }
121 112
122 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() { 113 PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() {
123 return client_ ? client_->GetPasswordStore() : nullptr; 114 return client_ ? client_->GetPasswordStore() : nullptr;
124 } 115 }
125 116
126 } // 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