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

Unified Diff: components/password_manager/content/renderer/credential_manager_client.cc

Issue 621503005: Credential Manager: Create a local or federated credential to hand to Blink. (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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/password_manager/content/renderer/credential_manager_client.cc
diff --git a/components/password_manager/content/renderer/credential_manager_client.cc b/components/password_manager/content/renderer/credential_manager_client.cc
index 98ded2b2b18165f3b96dbe98f99bf207d93e7f08..47e3568cef315e5a88e8a51b99fe2037208b02c5 100644
--- a/components/password_manager/content/renderer/credential_manager_client.cc
+++ b/components/password_manager/content/renderer/credential_manager_client.cc
@@ -9,6 +9,8 @@
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/platform/WebCredential.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
+#include "third_party/WebKit/public/platform/WebFederatedCredential.h"
+#include "third_party/WebKit/public/platform/WebLocalCredential.h"
#include "third_party/WebKit/public/web/WebView.h"
namespace password_manager {
@@ -78,9 +80,22 @@ void CredentialManagerClient::OnSendCredential(int request_id,
const CredentialInfo& info) {
RequestCallbacks* callbacks = request_callbacks_.Lookup(request_id);
DCHECK(callbacks);
- // TODO(mkwst): Split into local/federated credentials.
- blink::WebCredential credential(info.id, info.name, info.avatar);
- callbacks->onSuccess(&credential);
+ scoped_ptr<blink::WebCredential> credential;
+ switch (info.type) {
+ case CREDENTIAL_TYPE_FEDERATED:
+ credential.reset(new blink::WebFederatedCredential(info.id, info.name,
vabr (Chromium) 2014/10/01 16:05:23 nit: Is this how clang-format would format the lin
Mike West 2014/10/01 18:22:19 Re-clang-formatted. Not sure what happened in the
+ info.avatar, info.federation));
+ break;
+ case CREDENTIAL_TYPE_LOCAL:
+ credential.reset(new blink::WebLocalCredential(info.id, info.name,
+ info.avatar, info.password));
+ break;
+ default:
vabr (Chromium) 2014/10/01 16:05:22 Please change the "default:" to case CREDENTIAL_TY
Mike West 2014/10/01 18:22:19 Done.
+ NOTREACHED();
+ break;
+ }
+ DCHECK(credential);
vabr (Chromium) 2014/10/01 16:05:22 nit: This DCHECK seems a bit pointless, because th
Mike West 2014/10/01 18:22:19 Done.
+ callbacks->onSuccess(credential.get());
request_callbacks_.Remove(request_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698