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

Side by Side Diff: Source/platform/exported/WebCredential.cpp

Issue 640263002: Credential Manager: Pass the correct credential type to the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 "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 ASSERT(credential->isLocal() || credential->isFederated());
17
18 if (credential->isLocal()) {
19 WebLocalCredential local(credential);
20 return local;
21 }
22
23 WebFederatedCredential federated(credential);
24 return federated;
kenneth.r.christiansen 2014/10/09 13:34:02 Wouldn´t it be better to add this in an if as well
25 }
26
12 WebCredential::WebCredential(const WebString& id, const WebString& name, const W ebURL& avatarURL) 27 WebCredential::WebCredential(const WebString& id, const WebString& name, const W ebURL& avatarURL)
13 : m_platformCredential(PlatformCredential::create(id, name, avatarURL)) 28 : m_platformCredential(PlatformCredential::create(id, name, avatarURL))
14 { 29 {
15 } 30 }
16 31
32 WebCredential::WebCredential(const WebCredential& other)
33 {
34 assign(other);
35 }
36
17 void WebCredential::assign(const WebCredential& other) 37 void WebCredential::assign(const WebCredential& other)
18 { 38 {
19 m_platformCredential = other.m_platformCredential; 39 m_platformCredential = other.m_platformCredential;
20 } 40 }
21 41
22 WebCredential::WebCredential(PlatformCredential* credential) 42 WebCredential::WebCredential(PlatformCredential* credential)
23 : m_platformCredential(credential) 43 : m_platformCredential(credential)
24 { 44 {
25 } 45 }
26 46
(...skipping 16 matching lines...) Expand all
43 WebString WebCredential::name() const 63 WebString WebCredential::name() const
44 { 64 {
45 return m_platformCredential->name(); 65 return m_platformCredential->name();
46 } 66 }
47 67
48 WebURL WebCredential::avatarURL() const 68 WebURL WebCredential::avatarURL() const
49 { 69 {
50 return m_platformCredential->avatarURL(); 70 return m_platformCredential->avatarURL();
51 } 71 }
52 72
73 bool WebCredential::isLocalCredential() const
74 {
75 return m_platformCredential->isLocal();
76 }
77
78 bool WebCredential::isFederatedCredential() const
79 {
80 return m_platformCredential->isFederated();
81 }
82
53 } // namespace blink 83 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/credentialmanager/PlatformLocalCredential.h ('k') | Source/platform/exported/WebFederatedCredential.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698