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

Unified Diff: content/renderer/webcrypto/crypto_data.cc

Issue 155623005: Refactor to share more code between OpenSSL and NSS implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for openssl Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/webcrypto/crypto_data.cc
diff --git a/content/renderer/webcrypto/crypto_data.cc b/content/renderer/webcrypto/crypto_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..46ae2b2a52b7cc850d98bdfa6b40d27e7035bae9
--- /dev/null
+++ b/content/renderer/webcrypto/crypto_data.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/webcrypto/crypto_data.h"
+
+#include "third_party/WebKit/public/platform/WebArrayBuffer.h"
+
+namespace content {
+
+namespace webcrypto {
+
+CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {}
+CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length)
+ : bytes_(bytes), byte_length_(byte_length) {}
+CryptoData::CryptoData(const std::vector<unsigned char>& bytes)
+ : bytes_(bytes.size() ? &bytes[0] : NULL), byte_length_(bytes.size()) {}
+CryptoData::CryptoData(const std::string& bytes)
+ : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data())
+ : NULL),
+ byte_length_(bytes.size()) {}
+CryptoData::CryptoData(const blink::WebArrayBuffer& buffer)
Ryan Sleevi 2014/02/07 01:19:21 new lines between each ctor
eroman 2014/02/07 21:15:57 Done (i think git cl format put it that way).
+ : bytes_(reinterpret_cast<const unsigned char*>(buffer.data())),
+ byte_length_(buffer.byteLength()) {}
+
+} // namespace webcrypto
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698