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

Unified Diff: Source/modules/credentialmanager/PasswordCredential.cpp

Issue 1162443006: Credential Management: Rename 'LocalCredential' to 'PasswordCredential' (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-type
Patch Set: Test. Created 5 years, 7 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/modules/credentialmanager/PasswordCredential.cpp
diff --git a/Source/modules/credentialmanager/PasswordCredential.cpp b/Source/modules/credentialmanager/PasswordCredential.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6df7e7c542c3e1420178f626c4aed77c9aef75b8
--- /dev/null
+++ b/Source/modules/credentialmanager/PasswordCredential.cpp
@@ -0,0 +1,53 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/credentialmanager/PasswordCredential.h"
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "core/html/DOMFormData.h"
+#include "platform/credentialmanager/PlatformPasswordCredential.h"
+#include "public/platform/WebCredential.h"
+#include "public/platform/WebPasswordCredential.h"
+
+namespace blink {
+
+PasswordCredential* PasswordCredential::create(WebPasswordCredential* webPasswordCredential)
+{
+ return new PasswordCredential(webPasswordCredential);
+}
+
+PasswordCredential* PasswordCredential::create(const String& id, const String& password, const String& name, const String& avatar, ExceptionState& exceptionState)
+{
+ KURL avatarURL = parseStringAsURL(avatar, exceptionState);
+ if (exceptionState.hadException())
+ return nullptr;
+ return new PasswordCredential(id, password, name, avatarURL);
+}
+
+PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredential)
+ : Credential(webPasswordCredential->platformCredential())
+{
+}
+
+PasswordCredential::PasswordCredential(const String& id, const String& password, const String& name, const KURL& avatar)
+ : Credential(PlatformPasswordCredential::create(id, password, name, avatar))
+ , m_formData(DOMFormData::create())
+{
+ m_formData->append("username", id);
+ m_formData->append("password", password);
+}
+
+const String& PasswordCredential::password() const
+{
+ return static_cast<PlatformPasswordCredential*>(m_platformCredential.get())->password();
+}
+
+DEFINE_TRACE(PasswordCredential)
+{
+ visitor->trace(m_formData);
+ Credential::trace(visitor);
+}
+
+} // namespace blink
« no previous file with comments | « Source/modules/credentialmanager/PasswordCredential.h ('k') | Source/modules/credentialmanager/PasswordCredential.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698