OLD | NEW |
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 "content/child/webcrypto/webcrypto_impl.h" | 5 #include "content/child/webcrypto/webcrypto_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 state->usages, | 545 state->usages, |
546 &state->unwrapped_key); | 546 &state->unwrapped_key); |
547 | 547 |
548 state->origin_thread->PostTask( | 548 state->origin_thread->PostTask( |
549 FROM_HERE, base::Bind(DoUnwrapKeyReply, Passed(&passed_state))); | 549 FROM_HERE, base::Bind(DoUnwrapKeyReply, Passed(&passed_state))); |
550 } | 550 } |
551 | 551 |
552 } // namespace | 552 } // namespace |
553 | 553 |
554 WebCryptoImpl::WebCryptoImpl() { | 554 WebCryptoImpl::WebCryptoImpl() { |
555 webcrypto::Init(); | |
556 } | 555 } |
557 | 556 |
558 WebCryptoImpl::~WebCryptoImpl() { | 557 WebCryptoImpl::~WebCryptoImpl() { |
559 } | 558 } |
560 | 559 |
| 560 void WebCryptoImpl::EnsureInit() { |
| 561 webcrypto::Init(); |
| 562 } |
| 563 |
561 void WebCryptoImpl::encrypt(const blink::WebCryptoAlgorithm& algorithm, | 564 void WebCryptoImpl::encrypt(const blink::WebCryptoAlgorithm& algorithm, |
562 const blink::WebCryptoKey& key, | 565 const blink::WebCryptoKey& key, |
563 const unsigned char* data, | 566 const unsigned char* data, |
564 unsigned int data_size, | 567 unsigned int data_size, |
565 blink::WebCryptoResult result) { | 568 blink::WebCryptoResult result) { |
566 DCHECK(!algorithm.isNull()); | 569 DCHECK(!algorithm.isNull()); |
567 | 570 |
568 scoped_ptr<EncryptState> state( | 571 scoped_ptr<EncryptState> state( |
569 new EncryptState(algorithm, key, data, data_size, result)); | 572 new EncryptState(algorithm, key, data, data_size, result)); |
570 if (!CryptoThreadPool::PostTask(FROM_HERE, | 573 if (!CryptoThreadPool::PostTask(FROM_HERE, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 &key); | 739 &key); |
737 } | 740 } |
738 | 741 |
739 bool WebCryptoImpl::serializeKeyForClone( | 742 bool WebCryptoImpl::serializeKeyForClone( |
740 const blink::WebCryptoKey& key, | 743 const blink::WebCryptoKey& key, |
741 blink::WebVector<unsigned char>& key_data) { | 744 blink::WebVector<unsigned char>& key_data) { |
742 return webcrypto::SerializeKeyForClone(key, &key_data); | 745 return webcrypto::SerializeKeyForClone(key, &key_data); |
743 } | 746 } |
744 | 747 |
745 } // namespace content | 748 } // namespace content |
OLD | NEW |