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 "public/platform/WebCredential.h" | 5 #include "public/platform/WebCredential.h" |
6 | 6 |
7 #include "platform/credentialmanager/PlatformCredential.h" | 7 #include "platform/credentialmanager/PlatformCredential.h" |
8 #include "platform/wtf/PtrUtil.h" | 8 #include "platform/wtf/PtrUtil.h" |
9 #include "public/platform/WebFederatedCredential.h" | 9 #include "public/platform/WebFederatedCredential.h" |
10 #include "public/platform/WebPasswordCredential.h" | 10 #include "public/platform/WebPasswordCredential.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 std::unique_ptr<WebCredential> WebCredential::Create( | 14 std::unique_ptr<WebCredential> WebCredential::Create( |
15 PlatformCredential* credential) { | 15 PlatformCredential* credential) { |
16 if (credential->IsPassword()) { | 16 if (credential->IsPassword()) { |
17 return WTF::MakeUnique<WebPasswordCredential>(credential); | 17 return WTF::MakeUnique<WebPasswordCredential>(credential); |
18 } | 18 } |
19 | 19 |
20 if (credential->IsFederated()) { | 20 if (credential->IsFederated()) { |
21 return WTF::MakeUnique<WebFederatedCredential>(credential); | 21 return WTF::MakeUnique<WebFederatedCredential>(credential); |
22 } | 22 } |
23 | 23 |
24 ASSERT_NOT_REACHED(); | 24 NOTREACHED(); |
25 return nullptr; | 25 return nullptr; |
26 } | 26 } |
27 | 27 |
28 WebCredential::WebCredential(const WebString& id, | 28 WebCredential::WebCredential(const WebString& id, |
29 const WebString& name, | 29 const WebString& name, |
30 const WebURL& icon_url) | 30 const WebURL& icon_url) |
31 : platform_credential_(PlatformCredential::Create(id, name, icon_url)) {} | 31 : platform_credential_(PlatformCredential::Create(id, name, icon_url)) {} |
32 | 32 |
33 WebCredential::WebCredential(const WebCredential& other) { | 33 WebCredential::WebCredential(const WebCredential& other) { |
34 Assign(other); | 34 Assign(other); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 bool WebCredential::IsPasswordCredential() const { | 69 bool WebCredential::IsPasswordCredential() const { |
70 return platform_credential_->IsPassword(); | 70 return platform_credential_->IsPassword(); |
71 } | 71 } |
72 | 72 |
73 bool WebCredential::IsFederatedCredential() const { | 73 bool WebCredential::IsFederatedCredential() const { |
74 return platform_credential_->IsFederated(); | 74 return platform_credential_->IsFederated(); |
75 } | 75 } |
76 | 76 |
77 } // namespace blink | 77 } // namespace blink |
OLD | NEW |