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

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

Issue 615863002: Credential Manager: Stub out call to 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
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 30344f8cb00e147988a09a6f237cec12babe8048..60fc8141561e062787a72859bf3f8b93abe87fe9 100644
--- a/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
+++ b/components/password_manager/content/browser/content_credential_manager_dispatcher.cc
@@ -10,6 +10,7 @@
#include "components/password_manager/content/common/credential_manager_messages.h"
#include "components/password_manager/content/common/credential_manager_types.h"
#include "components/password_manager/core/browser/password_manager_client.h"
+#include "components/password_manager/core/browser/password_store.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "ipc/ipc_message_macros.h"
@@ -70,17 +71,43 @@ void ContentCredentialManagerDispatcher::OnNotifySignedOut(int request_id) {
void ContentCredentialManagerDispatcher::OnRequestCredential(
int request_id,
vabr (Chromium) 2014/09/30 09:38:31 Should you DCHECK(request_id)?
Mike West 2014/09/30 09:44:49 Hrm. That's actually a good question. I don't know
- bool zero_click_only,
+ bool /* zero_click_only */,
const std::vector<GURL>& federations) {
- // TODO(mkwst): This is a stub.
+ PasswordStore* store = GetPasswordStore();
+ if (pending_request_id_ || !store) {
+ // TODO(mkwst): Reject the promise if we can't get to the password store, or
+ // if we're already requesting credentials.
vabr (Chromium) 2014/09/30 09:38:32 Did you want to add a return here? (Maybe to avoid
Mike West 2014/09/30 09:44:49 I should have done it here, but I'm now doing it i
+ }
+
+ pending_request_id_ = request_id;
+
+ autofill::PasswordForm form;
+ form.scheme = autofill::PasswordForm::SCHEME_HTML;
+ form.origin = web_contents()->GetLastCommittedURL().GetOrigin();
+ form.signon_realm = form.origin.spec();
+
+ store->GetLogins(form, PasswordStore::DISALLOW_PROMPT, this);
+}
+
+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"));
web_contents()->GetRenderViewHost()->Send(
new CredentialManagerMsg_SendCredential(
web_contents()->GetRenderViewHost()->GetRoutingID(),
- request_id,
+ pending_request_id_,
info));
+ pending_request_id_ = 0;
+}
+
+PasswordStore* ContentCredentialManagerDispatcher::GetPasswordStore() {
+ return client_ ? client_->GetPasswordStore() : nullptr;
}
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698