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

Unified Diff: webrtc/base/cryptstring.cc

Issue 2766063005: Revert of Removing HTTPS and SOCKS proxy server code. (Closed)
Patch Set: Merge with master Created 3 years, 9 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
« no previous file with comments | « webrtc/base/cryptstring.h ('k') | webrtc/base/httpbase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/cryptstring.cc
diff --git a/webrtc/base/cryptstring.cc b/webrtc/base/cryptstring.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4b2a83fca982448c2c5fe41b1e1d212530a1211a
--- /dev/null
+++ b/webrtc/base/cryptstring.cc
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/base/cryptstring.h"
+
+namespace rtc {
+
+size_t EmptyCryptStringImpl::GetLength() const {
+ return 0;
+}
+
+void EmptyCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
+ if (nullterminate) {
+ *dest = '\0';
+ }
+}
+
+std::string EmptyCryptStringImpl::UrlEncode() const {
+ return "";
+}
+
+CryptStringImpl* EmptyCryptStringImpl::Copy() const {
+ return new EmptyCryptStringImpl();
+}
+
+void EmptyCryptStringImpl::CopyRawTo(std::vector<unsigned char>* dest) const {
+ dest->clear();
+}
+
+CryptString::CryptString() : impl_(new EmptyCryptStringImpl()) {
+}
+
+CryptString::CryptString(const CryptString& other)
+ : impl_(other.impl_->Copy()) {
+}
+
+CryptString::CryptString(const CryptStringImpl& impl) : impl_(impl.Copy()) {
+}
+
+CryptString::~CryptString() = default;
+
+size_t InsecureCryptStringImpl::GetLength() const {
+ return password_.size();
+}
+
+void InsecureCryptStringImpl::CopyTo(char* dest, bool nullterminate) const {
+ memcpy(dest, password_.data(), password_.size());
+ if (nullterminate)
+ dest[password_.size()] = 0;
+}
+
+std::string InsecureCryptStringImpl::UrlEncode() const {
+ return password_;
+}
+
+CryptStringImpl* InsecureCryptStringImpl::Copy() const {
+ InsecureCryptStringImpl* copy = new InsecureCryptStringImpl;
+ copy->password() = password_;
+ return copy;
+}
+
+void InsecureCryptStringImpl::CopyRawTo(
+ std::vector<unsigned char>* dest) const {
+ dest->resize(password_.size());
+ memcpy(&dest->front(), password_.data(), password_.size());
+}
+
+}; // namespace rtc
« no previous file with comments | « webrtc/base/cryptstring.h ('k') | webrtc/base/httpbase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698