| 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 "content/child/webcrypto/crypto_data.h" |
| 6 | 6 |
| 7 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | |
| 8 | |
| 9 namespace content { | 7 namespace content { |
| 10 | 8 |
| 11 namespace webcrypto { | 9 namespace webcrypto { |
| 12 | 10 |
| 13 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {} | 11 CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {} |
| 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 CryptoData::CryptoData(const std::vector<unsigned char>& bytes) | 16 CryptoData::CryptoData(const std::vector<unsigned char>& bytes) |
| 19 : bytes_(bytes.size() ? &bytes[0] : NULL), byte_length_(bytes.size()) {} | 17 : bytes_(bytes.size() ? &bytes[0] : NULL), byte_length_(bytes.size()) {} |
| 20 | 18 |
| 21 CryptoData::CryptoData(const std::string& bytes) | 19 CryptoData::CryptoData(const std::string& bytes) |
| 22 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) | 20 : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) |
| 23 : NULL), | 21 : NULL), |
| 24 byte_length_(bytes.size()) {} | 22 byte_length_(bytes.size()) {} |
| 25 | 23 |
| 26 CryptoData::CryptoData(const blink::WebArrayBuffer& buffer) | |
| 27 : bytes_(reinterpret_cast<const unsigned char*>(buffer.data())), | |
| 28 byte_length_(buffer.byteLength()) {} | |
| 29 | |
| 30 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) | 24 CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) |
| 31 : bytes_(bytes.data()), byte_length_(bytes.size()) {} | 25 : bytes_(bytes.data()), byte_length_(bytes.size()) {} |
| 32 | 26 |
| 33 } // namespace webcrypto | 27 } // namespace webcrypto |
| 34 | 28 |
| 35 } // namespace content | 29 } // namespace content |
| OLD | NEW |