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

Unified Diff: Source/platform/exported/WebCredential.cpp

Issue 640263002: Credential Manager: Pass the correct credential type to the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Feedback. 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/exported/WebCredential.cpp
diff --git a/Source/platform/exported/WebCredential.cpp b/Source/platform/exported/WebCredential.cpp
index 7f01394a32b0675c463d6ac81869a7ed35bb50f5..e08d1aecd373d83b18421799fa47f32ae19f0ec7 100644
--- a/Source/platform/exported/WebCredential.cpp
+++ b/Source/platform/exported/WebCredential.cpp
@@ -6,14 +6,37 @@
#include "public/platform/WebCredential.h"
#include "platform/credentialmanager/PlatformCredential.h"
+#include "public/platform/WebFederatedCredential.h"
+#include "public/platform/WebLocalCredential.h"
namespace blink {
+WebCredential WebCredential::create(PlatformCredential* credential)
+{
+ if (credential->isLocal()) {
+ WebLocalCredential local(credential);
+ return local;
+ }
+
+ if (credential->isFederated()) {
+ WebFederatedCredential federated(credential);
+ return federated;
+ }
+
+ ASSERT_NOT_REACHED();
+ return WebCredential(credential);
+}
+
WebCredential::WebCredential(const WebString& id, const WebString& name, const WebURL& avatarURL)
: m_platformCredential(PlatformCredential::create(id, name, avatarURL))
{
}
+WebCredential::WebCredential(const WebCredential& other)
+{
+ assign(other);
+}
+
void WebCredential::assign(const WebCredential& other)
{
m_platformCredential = other.m_platformCredential;
@@ -50,4 +73,14 @@ WebURL WebCredential::avatarURL() const
return m_platformCredential->avatarURL();
}
+bool WebCredential::isLocalCredential() const
+{
+ return m_platformCredential->isLocal();
+}
+
+bool WebCredential::isFederatedCredential() const
+{
+ return m_platformCredential->isFederated();
+}
+
} // namespace blink
« no previous file with comments | « Source/platform/credentialmanager/PlatformLocalCredential.h ('k') | Source/platform/exported/WebFederatedCredential.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698