Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: Source/modules/credentialmanager/FederatedCredential.cpp

Issue 1162883002: Credential Manager: Align 'FederatedCredential' with the spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "modules/credentialmanager/FederatedCredential.h" 6 #include "modules/credentialmanager/FederatedCredential.h"
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "modules/credentialmanager/FederatedCredentialData.h"
9 #include "platform/credentialmanager/PlatformFederatedCredential.h" 10 #include "platform/credentialmanager/PlatformFederatedCredential.h"
10 #include "public/platform/WebFederatedCredential.h" 11 #include "public/platform/WebFederatedCredential.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 FederatedCredential* FederatedCredential::create(WebFederatedCredential* webFede ratedCredential) 15 FederatedCredential* FederatedCredential::create(WebFederatedCredential* webFede ratedCredential)
15 { 16 {
16 return new FederatedCredential(webFederatedCredential); 17 return new FederatedCredential(webFederatedCredential);
17 } 18 }
18 19
19 FederatedCredential* FederatedCredential::create(const String& id, const String& federation, const String& name, const String& avatar, ExceptionState& exception State) 20 FederatedCredential* FederatedCredential::create(const FederatedCredentialData& data, ExceptionState& exceptionState)
20 { 21 {
21 KURL avatarURL = parseStringAsURL(avatar, exceptionState); 22 KURL iconURL = parseStringAsURL(data.iconURL(), exceptionState);
22 KURL federationURL = parseStringAsURL(federation, exceptionState); 23 KURL providerURL = parseStringAsURL(data.provider(), exceptionState);
23 if (exceptionState.hadException()) 24 if (exceptionState.hadException())
24 return nullptr; 25 return nullptr;
25 return new FederatedCredential(id, federationURL, name, avatarURL); 26 return new FederatedCredential(data.id(), providerURL, data.name(), iconURL) ;
26 } 27 }
27 28
28 FederatedCredential::FederatedCredential(WebFederatedCredential* webFederatedCre dential) 29 FederatedCredential::FederatedCredential(WebFederatedCredential* webFederatedCre dential)
29 : Credential(webFederatedCredential->platformCredential()) 30 : Credential(webFederatedCredential->platformCredential())
30 { 31 {
31 } 32 }
32 33
33 FederatedCredential::FederatedCredential(const String& id, const KURL& federatio n, const String& name, const KURL& avatar) 34 FederatedCredential::FederatedCredential(const String& id, const KURL& provider, const String& name, const KURL& icon)
34 : Credential(PlatformFederatedCredential::create(id, federation, name, avata r)) 35 : Credential(PlatformFederatedCredential::create(id, provider, name, icon))
35 { 36 {
36 } 37 }
37 38
38 const KURL& FederatedCredential::federation() const 39 const KURL& FederatedCredential::provider() const
39 { 40 {
40 return static_cast<PlatformFederatedCredential*>(m_platformCredential.get()) ->federation(); 41 return static_cast<PlatformFederatedCredential*>(m_platformCredential.get()) ->provider();
41 } 42 }
42 43
43 } // namespace blink 44 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/credentialmanager/FederatedCredential.h ('k') | Source/modules/credentialmanager/FederatedCredential.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698