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

Side by Side Diff: Source/core/platform/chromium/support/WebCrypto.cpp

Issue 19885002: WebCrypto: Add interfaces for importKey(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use a wrapper for the result rather than raw pointer Created 7 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
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #include "config.h"
32 #include "public/platform/WebCrypto.h"
33
34 #include "modules/crypto/CryptoOperation.h"
35 #include "modules/crypto/KeyOperation.h"
36
37 namespace WebKit {
38
39 // FIXME: Assert that these methods (especially assignment) are called from the
40 // correct thread.
41
42 WebCryptoOperationResult::WebCryptoOperationResult(WebCore::CryptoOperation* imp l)
43 : m_impl(impl)
44 {
45 ASSERT(impl);
46 }
47
48 void WebCryptoOperationResult::initializationFailed()
49 {
50 m_impl->initializationFailed();
51 m_impl = 0;
52 }
53
54 void WebCryptoOperationResult::initializationSucceeded(WebCryptoOperation* op)
55 {
56 m_impl->initializationSucceeded(op);
57 m_impl = 0;
58 }
59
60 void WebCryptoOperationResult::completeWithError()
61 {
62 m_impl->completeWithError();
63 m_impl = 0;
64 }
65
66 void WebCryptoOperationResult::completeWithArrayBuffer(const WebArrayBuffer& buf fer)
67 {
68 m_impl->completeWithArrayBuffer(buffer);
69 m_impl = 0;
70 }
71
72 WebCryptoKeyOperationResult::WebCryptoKeyOperationResult(WebCore::KeyOperation* impl)
73 : m_impl(impl)
74 {
75 ASSERT(impl);
76 }
77
78 void WebCryptoKeyOperationResult::initializationFailed()
79 {
80 m_impl->initializationFailed();
81 m_impl.reset();
82 }
83
84 void WebCryptoKeyOperationResult::initializationSucceeded(WebCryptoKeyOperation* op)
85 {
86 m_impl->initializationSucceeded(op);
87 m_impl.reset();
88 }
89
90 void WebCryptoKeyOperationResult::completeWithError()
91 {
92 m_impl->completeWithError();
93 m_impl.reset();
94 }
95
96 void WebCryptoKeyOperationResult::completeWithKey(const WebCryptoKey& key)
97 {
98 m_impl->completeWithKey(key);
99 m_impl.reset();
100 }
101
102 void WebCryptoKeyOperationResult::reset()
103 {
104 // When destroying, the operation should have already been completed.
105 ASSERT(!m_impl.get());
106 m_impl.reset();
107 }
108
109 void WebCryptoKeyOperationResult::assign(const WebCryptoKeyOperationResult& o)
110 {
111 m_impl = o.m_impl;
112 }
113
114 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698