Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / credentialmanager / LocalCredential.cpp
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/credentialmanager/LocalCredential.h"
7
8 #include "bindings/core/v8/ExceptionState.h"
9 #include "platform/credentialmanager/PlatformLocalCredential.h"
10
11 namespace blink {
12
13 LocalCredential* LocalCredential::create(const String& id, const String& name, const String& avatar, const String& password, ExceptionState& exceptionState)
14 {
15     KURL avatarURL = parseStringAsURL(avatar, exceptionState);
16     if (exceptionState.hadException())
17         return nullptr;
18     return new LocalCredential(id, name, avatarURL, password);
19 }
20
21 LocalCredential::LocalCredential(const String& id, const String& name, const KURL& avatar, const String& password)
22     : Credential(PlatformLocalCredential::create(id, name, avatar, password))
23 {
24     ScriptWrappable::init(this);
25 }
26
27 const String& LocalCredential::password() const
28 {
29     return static_cast<PlatformLocalCredential*>(m_platformCredential.get())->password();
30 }
31
32 } // namespace blink