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

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

Issue 1227783004: Fix virtual/override/final usage in Source/modules/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 5 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 | Annotate | Revision Log
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/CredentialsContainer.h" 6 #include "modules/credentialmanager/CredentialsContainer.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 26 matching lines...) Expand all
37 default: 37 default:
38 resolver->reject(DOMException::create(NotReadableError, "An unknown erro r occured while talking to the credential manager.")); 38 resolver->reject(DOMException::create(NotReadableError, "An unknown erro r occured while talking to the credential manager."));
39 break; 39 break;
40 } 40 }
41 } 41 }
42 42
43 class NotificationCallbacks : public WebCredentialManagerClient::NotificationCal lbacks { 43 class NotificationCallbacks : public WebCredentialManagerClient::NotificationCal lbacks {
44 WTF_MAKE_NONCOPYABLE(NotificationCallbacks); 44 WTF_MAKE_NONCOPYABLE(NotificationCallbacks);
45 public: 45 public:
46 explicit NotificationCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver) : m_resolver(resolver) { } 46 explicit NotificationCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> resolver) : m_resolver(resolver) { }
47 virtual ~NotificationCallbacks() { } 47 ~NotificationCallbacks() override { }
48 48
49 virtual void onSuccess() override 49 void onSuccess() override
50 { 50 {
51 m_resolver->resolve(); 51 m_resolver->resolve();
52 } 52 }
53 53
54 virtual void onError(WebCredentialManagerError* reason) override 54 void onError(WebCredentialManagerError* reason) override
55 { 55 {
56 rejectDueToCredentialManagerError(m_resolver, reason); 56 rejectDueToCredentialManagerError(m_resolver, reason);
57 } 57 }
58 58
59 private: 59 private:
60 const RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; 60 const RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver;
61 }; 61 };
62 62
63 class RequestCallbacks : public WebCredentialManagerClient::RequestCallbacks { 63 class RequestCallbacks : public WebCredentialManagerClient::RequestCallbacks {
64 WTF_MAKE_NONCOPYABLE(RequestCallbacks); 64 WTF_MAKE_NONCOPYABLE(RequestCallbacks);
65 public: 65 public:
66 explicit RequestCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> reso lver) : m_resolver(resolver) { } 66 explicit RequestCallbacks(PassRefPtrWillBeRawPtr<ScriptPromiseResolver> reso lver) : m_resolver(resolver) { }
67 virtual ~RequestCallbacks() { } 67 ~RequestCallbacks() override { }
68 68
69 virtual void onSuccess(WebCredential* credential) override 69 void onSuccess(WebCredential* credential) override
70 { 70 {
71 if (!credential) { 71 if (!credential) {
72 m_resolver->resolve(); 72 m_resolver->resolve();
73 return; 73 return;
74 } 74 }
75 75
76 ASSERT(credential->isPasswordCredential() || credential->isFederatedCred ential()); 76 ASSERT(credential->isPasswordCredential() || credential->isFederatedCred ential());
77 if (credential->isPasswordCredential()) 77 if (credential->isPasswordCredential())
78 m_resolver->resolve(PasswordCredential::create(static_cast<WebPasswo rdCredential*>(credential))); 78 m_resolver->resolve(PasswordCredential::create(static_cast<WebPasswo rdCredential*>(credential)));
79 else 79 else
80 m_resolver->resolve(FederatedCredential::create(static_cast<WebFeder atedCredential*>(credential))); 80 m_resolver->resolve(FederatedCredential::create(static_cast<WebFeder atedCredential*>(credential)));
81 } 81 }
82 82
83 virtual void onError(WebCredentialManagerError* reason) override 83 void onError(WebCredentialManagerError* reason) override
84 { 84 {
85 rejectDueToCredentialManagerError(m_resolver, reason); 85 rejectDueToCredentialManagerError(m_resolver, reason);
86 } 86 }
87 87
88 private: 88 private:
89 const RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; 89 const RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver;
90 }; 90 };
91 91
92 92
93 CredentialsContainer* CredentialsContainer::create() 93 CredentialsContainer* CredentialsContainer::create()
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState); 152 RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver:: create(scriptState);
153 ScriptPromise promise = resolver->promise(); 153 ScriptPromise promise = resolver->promise();
154 if (!checkBoilerplate(resolver)) 154 if (!checkBoilerplate(resolver))
155 return promise; 155 return promise;
156 156
157 CredentialManagerClient::from(scriptState->executionContext())->dispatchRequ ireUserMediation(new NotificationCallbacks(resolver)); 157 CredentialManagerClient::from(scriptState->executionContext())->dispatchRequ ireUserMediation(new NotificationCallbacks(resolver));
158 return promise; 158 return promise;
159 } 159 }
160 160
161 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/compositorworker/CompositorWorkerThread.h ('k') | Source/modules/crypto/CryptoResultImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698