Chromium Code Reviews| 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 "base/memory/ptr_util.h" | |
| 8 | |
| 7 #include "platform/credentialmanager/PlatformCredential.h" | 9 #include "platform/credentialmanager/PlatformCredential.h" |
| 8 #include "public/platform/WebFederatedCredential.h" | 10 #include "public/platform/WebFederatedCredential.h" |
| 9 #include "public/platform/WebPasswordCredential.h" | 11 #include "public/platform/WebPasswordCredential.h" |
| 10 | 12 |
| 11 namespace blink { | 13 namespace blink { |
| 12 | 14 |
| 13 WebCredential WebCredential::create(PlatformCredential* credential) | 15 std::unique_ptr<WebCredential> WebCredential::create(PlatformCredential* credent ial) |
| 14 { | 16 { |
| 15 if (credential->isPassword()) { | 17 if (credential->isPassword()) { |
| 16 WebPasswordCredential password(credential); | 18 return base::WrapUnique(new WebPasswordCredential(credential)); |
|
haraken
2016/05/11 14:16:11
yutak@: We don't want to use base::WrapUnique, rig
vabr (Chromium)
2016/05/11 14:42:58
What about using wrapUnique from Source/wtf/PtrUti
| |
| 17 return password; | |
| 18 } | 19 } |
| 19 | 20 |
| 20 if (credential->isFederated()) { | 21 if (credential->isFederated()) { |
| 21 WebFederatedCredential federated(credential); | 22 return base::WrapUnique(new WebFederatedCredential(credential)); |
|
haraken
2016/05/11 14:16:11
Ditto.
| |
| 22 return federated; | |
| 23 } | 23 } |
| 24 | 24 |
| 25 ASSERT_NOT_REACHED(); | 25 ASSERT_NOT_REACHED(); |
| 26 return WebCredential(credential); | 26 return nullptr; |
| 27 } | 27 } |
| 28 | 28 |
| 29 WebCredential::WebCredential(const WebString& id, const WebString& name, const W ebURL& iconURL) | 29 WebCredential::WebCredential(const WebString& id, const WebString& name, const W ebURL& iconURL) |
| 30 : m_platformCredential(PlatformCredential::create(id, name, iconURL)) | 30 : m_platformCredential(PlatformCredential::create(id, name, iconURL)) |
| 31 { | 31 { |
| 32 } | 32 } |
| 33 | 33 |
| 34 WebCredential::WebCredential(const WebCredential& other) | 34 WebCredential::WebCredential(const WebCredential& other) |
| 35 { | 35 { |
| 36 assign(other); | 36 assign(other); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 { | 81 { |
| 82 return m_platformCredential->isPassword(); | 82 return m_platformCredential->isPassword(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool WebCredential::isFederatedCredential() const | 85 bool WebCredential::isFederatedCredential() const |
| 86 { | 86 { |
| 87 return m_platformCredential->isFederated(); | 87 return m_platformCredential->isFederated(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |