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/crypto_data.h" | 5 #include "components/webcrypto/crypto_data.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 | 7 |
8 namespace content { | |
9 | |
10 namespace webcrypto { | 8 namespace webcrypto { |
11 | 9 |
12 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) { | 10 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) { |
13 } | 11 } |
14 | 12 |
15 CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length) | 13 CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length) |
16 : bytes_(bytes), byte_length_(byte_length) { | 14 : bytes_(bytes), byte_length_(byte_length) { |
17 } | 15 } |
18 | 16 |
19 CryptoData::CryptoData(const std::vector<unsigned char>& bytes) | 17 CryptoData::CryptoData(const std::vector<unsigned char>& bytes) |
20 : bytes_(vector_as_array(&bytes)), byte_length_(bytes.size()) { | 18 : bytes_(vector_as_array(&bytes)), byte_length_(bytes.size()) { |
21 } | 19 } |
22 | 20 |
23 CryptoData::CryptoData(const std::string& bytes) | 21 CryptoData::CryptoData(const std::string& bytes) |
24 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) | 22 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) |
25 : NULL), | 23 : NULL), |
26 byte_length_(bytes.size()) { | 24 byte_length_(bytes.size()) { |
27 } | 25 } |
28 | 26 |
29 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) | 27 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) |
30 : bytes_(bytes.data()), byte_length_(bytes.size()) { | 28 : bytes_(bytes.data()), byte_length_(bytes.size()) { |
31 } | 29 } |
32 | 30 |
33 } // namespace webcrypto | 31 } // namespace webcrypto |
34 | |
35 } // namespace content | |
OLD | NEW |