| 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 "modules/credentialmanager/FederatedCredential.h" | 5 #include "modules/credentialmanager/FederatedCredential.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "modules/credentialmanager/FederatedCredentialData.h" | 8 #include "modules/credentialmanager/FederatedCredentialInit.h" |
| 9 #include "platform/credentialmanager/PlatformFederatedCredential.h" | 9 #include "platform/credentialmanager/PlatformFederatedCredential.h" |
| 10 #include "platform/weborigin/SecurityOrigin.h" | 10 #include "platform/weborigin/SecurityOrigin.h" |
| 11 #include "public/platform/WebFederatedCredential.h" | 11 #include "public/platform/WebFederatedCredential.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 FederatedCredential* FederatedCredential::Create( | 15 FederatedCredential* FederatedCredential::Create( |
| 16 WebFederatedCredential* web_federated_credential) { | 16 WebFederatedCredential* web_federated_credential) { |
| 17 return new FederatedCredential(web_federated_credential); | 17 return new FederatedCredential(web_federated_credential); |
| 18 } | 18 } |
| 19 | 19 |
| 20 FederatedCredential* FederatedCredential::Create( | 20 FederatedCredential* FederatedCredential::Create( |
| 21 const FederatedCredentialData& data, | 21 const FederatedCredentialInit& data, |
| 22 ExceptionState& exception_state) { | 22 ExceptionState& exception_state) { |
| 23 if (data.id().IsEmpty()) { | 23 if (data.id().IsEmpty()) { |
| 24 exception_state.ThrowTypeError("'id' must not be empty."); | 24 exception_state.ThrowTypeError("'id' must not be empty."); |
| 25 return nullptr; | 25 return nullptr; |
| 26 } | 26 } |
| 27 if (data.provider().IsEmpty()) { | 27 if (data.provider().IsEmpty()) { |
| 28 exception_state.ThrowTypeError("'provider' must not be empty."); | 28 exception_state.ThrowTypeError("'provider' must not be empty."); |
| 29 return nullptr; | 29 return nullptr; |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 51 name, | 51 name, |
| 52 icon)) {} | 52 icon)) {} |
| 53 | 53 |
| 54 const String FederatedCredential::provider() const { | 54 const String FederatedCredential::provider() const { |
| 55 return static_cast<PlatformFederatedCredential*>(platform_credential_.Get()) | 55 return static_cast<PlatformFederatedCredential*>(platform_credential_.Get()) |
| 56 ->Provider() | 56 ->Provider() |
| 57 ->ToString(); | 57 ->ToString(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |