| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "public/platform/WebCredential.h" | 6 #include "public/platform/WebCredential.h" |
| 7 | 7 |
| 8 #include "platform/credentialmanager/PlatformCredential.h" | 8 #include "platform/credentialmanager/PlatformCredential.h" |
| 9 #include "public/platform/WebFederatedCredential.h" |
| 10 #include "public/platform/WebLocalCredential.h" |
| 9 | 11 |
| 10 namespace blink { | 12 namespace blink { |
| 11 | 13 |
| 14 WebCredential WebCredential::create(PlatformCredential* credential) |
| 15 { |
| 16 if (credential->isLocal()) { |
| 17 WebLocalCredential local(credential); |
| 18 return local; |
| 19 } |
| 20 |
| 21 if (credential->isFederated()) { |
| 22 WebFederatedCredential federated(credential); |
| 23 return federated; |
| 24 } |
| 25 |
| 26 ASSERT_NOT_REACHED(); |
| 27 return WebCredential(credential); |
| 28 } |
| 29 |
| 12 WebCredential::WebCredential(const WebString& id, const WebString& name, const W
ebURL& avatarURL) | 30 WebCredential::WebCredential(const WebString& id, const WebString& name, const W
ebURL& avatarURL) |
| 13 : m_platformCredential(PlatformCredential::create(id, name, avatarURL)) | 31 : m_platformCredential(PlatformCredential::create(id, name, avatarURL)) |
| 14 { | 32 { |
| 15 } | 33 } |
| 16 | 34 |
| 35 WebCredential::WebCredential(const WebCredential& other) |
| 36 { |
| 37 assign(other); |
| 38 } |
| 39 |
| 17 void WebCredential::assign(const WebCredential& other) | 40 void WebCredential::assign(const WebCredential& other) |
| 18 { | 41 { |
| 19 m_platformCredential = other.m_platformCredential; | 42 m_platformCredential = other.m_platformCredential; |
| 20 } | 43 } |
| 21 | 44 |
| 22 WebCredential::WebCredential(PlatformCredential* credential) | 45 WebCredential::WebCredential(PlatformCredential* credential) |
| 23 : m_platformCredential(credential) | 46 : m_platformCredential(credential) |
| 24 { | 47 { |
| 25 } | 48 } |
| 26 | 49 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 WebString WebCredential::name() const | 66 WebString WebCredential::name() const |
| 44 { | 67 { |
| 45 return m_platformCredential->name(); | 68 return m_platformCredential->name(); |
| 46 } | 69 } |
| 47 | 70 |
| 48 WebURL WebCredential::avatarURL() const | 71 WebURL WebCredential::avatarURL() const |
| 49 { | 72 { |
| 50 return m_platformCredential->avatarURL(); | 73 return m_platformCredential->avatarURL(); |
| 51 } | 74 } |
| 52 | 75 |
| 76 bool WebCredential::isLocalCredential() const |
| 77 { |
| 78 return m_platformCredential->isLocal(); |
| 79 } |
| 80 |
| 81 bool WebCredential::isFederatedCredential() const |
| 82 { |
| 83 return m_platformCredential->isFederated(); |
| 84 } |
| 85 |
| 53 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |