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

Side by Side Diff: Source/modules/crypto/CryptoResult.cpp

Issue 23617006: WebCrypto: Add the KeyPair interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 7 years, 3 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
« no previous file with comments | « Source/modules/crypto/CryptoResult.h ('k') | Source/modules/crypto/KeyPair.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "modules/crypto/CryptoResult.h" 32 #include "modules/crypto/CryptoResult.h"
33 33
34 #include "V8Key.h" // Must precede ScriptPromiseResolver.h 34 #include "V8Key.h" // Must precede ScriptPromiseResolver.h
35 #include "V8KeyPair.h" // Must precede ScriptPromiseResolver.h
35 #include "bindings/v8/custom/V8ArrayBufferCustom.h" // Must precede ScriptPromis eResolver.h 36 #include "bindings/v8/custom/V8ArrayBufferCustom.h" // Must precede ScriptPromis eResolver.h
36 #include "bindings/v8/ScriptPromiseResolver.h" 37 #include "bindings/v8/ScriptPromiseResolver.h"
37 #include "modules/crypto/Key.h" 38 #include "modules/crypto/Key.h"
38 #include "modules/crypto/NormalizeAlgorithm.h" 39 #include "modules/crypto/NormalizeAlgorithm.h"
39 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
40 #include "public/platform/WebArrayBuffer.h" 41 #include "public/platform/WebArrayBuffer.h"
41 #include "public/platform/WebCrypto.h" 42 #include "public/platform/WebCrypto.h"
42 #include "public/platform/WebCryptoAlgorithm.h" 43 #include "public/platform/WebCryptoAlgorithm.h"
43 #include "wtf/ArrayBufferView.h" 44 #include "wtf/ArrayBufferView.h"
44 45
(...skipping 26 matching lines...) Expand all
71 m_promiseResolver->fulfill(ScriptValue::createBoolean(b)); 72 m_promiseResolver->fulfill(ScriptValue::createBoolean(b));
72 finish(); 73 finish();
73 } 74 }
74 75
75 void CryptoResult::completeWithKey(const WebKit::WebCryptoKey& key) 76 void CryptoResult::completeWithKey(const WebKit::WebCryptoKey& key)
76 { 77 {
77 m_promiseResolver->fulfill(Key::create(key)); 78 m_promiseResolver->fulfill(Key::create(key));
78 finish(); 79 finish();
79 } 80 }
80 81
82 void CryptoResult::completeWithKeyPair(const WebKit::WebCryptoKey& publicKey, co nst WebKit::WebCryptoKey& privateKey)
83 {
84 m_promiseResolver->fulfill(KeyPair::create(publicKey, privateKey));
85 finish();
86 }
87
81 ScriptObject CryptoResult::promise() 88 ScriptObject CryptoResult::promise()
82 { 89 {
83 return m_promiseResolver->promise(); 90 return m_promiseResolver->promise();
84 } 91 }
85 92
86 CryptoResult::CryptoResult() 93 CryptoResult::CryptoResult()
87 : m_promiseResolver(ScriptPromiseResolver::create()) 94 : m_promiseResolver(ScriptPromiseResolver::create())
88 , m_finished(false) { } 95 , m_finished(false) { }
89 96
90 void CryptoResult::finish() 97 void CryptoResult::finish()
91 { 98 {
92 ASSERT(!m_finished); 99 ASSERT(!m_finished);
93 m_finished = true; 100 m_finished = true;
94 } 101 }
95 102
96 } // namespace WebCore 103 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/crypto/CryptoResult.h ('k') | Source/modules/crypto/KeyPair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698