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.
6 #include "public/platform/WebCredential.h"
8 #include "platform/credentialmanager/PlatformCredential.h"
9 #include "public/platform/WebFederatedCredential.h"
10 #include "public/platform/WebPasswordCredential.h"
14 WebCredential
WebCredential::create(PlatformCredential
* credential
)
16 if (credential
->isPassword()) {
17 WebPasswordCredential
password(credential
);
21 if (credential
->isFederated()) {
22 WebFederatedCredential
federated(credential
);
27 return WebCredential(credential
);
30 WebCredential::WebCredential(const WebString
& id
, const WebString
& name
, const WebURL
& iconURL
)
31 : m_platformCredential(PlatformCredential::create(id
, name
, iconURL
))
35 WebCredential::WebCredential(const WebCredential
& other
)
40 void WebCredential::assign(const WebCredential
& other
)
42 m_platformCredential
= other
.m_platformCredential
;
45 WebCredential::WebCredential(PlatformCredential
* credential
)
46 : m_platformCredential(credential
)
50 WebCredential
& WebCredential::operator=(PlatformCredential
* credential
)
52 m_platformCredential
= credential
;
56 void WebCredential::reset()
58 m_platformCredential
.reset();
61 WebString
WebCredential::id() const
63 return m_platformCredential
->id();
66 WebString
WebCredential::name() const
68 return m_platformCredential
->name();
71 WebURL
WebCredential::iconURL() const
73 return m_platformCredential
->iconURL();
76 WebString
WebCredential::type() const
78 return m_platformCredential
->type();
81 bool WebCredential::isPasswordCredential() const
83 return m_platformCredential
->isPassword();
86 bool WebCredential::isFederatedCredential() const
88 return m_platformCredential
->isFederated();