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

Unified Diff: remoting/protocol/libjingle_transport_factory.cc

Issue 297863005: Call net::EnsureNSSSSLInit() in the remoting client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: Created 6 years, 7 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 | « remoting/client/plugin/chromoting_instance.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/libjingle_transport_factory.cc
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc
index 3b4f830fccc8857e98b5f7d91b709097b95038f7..394b78ef07d26f6ea145c2cbd73b97567bee565d 100644
--- a/remoting/protocol/libjingle_transport_factory.cc
+++ b/remoting/protocol/libjingle_transport_factory.cc
@@ -4,9 +4,7 @@
#include "remoting/protocol/libjingle_transport_factory.h"
-#include "base/base64.h"
#include "base/callback.h"
-#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/timer/timer.h"
@@ -45,20 +43,6 @@ const int kReconnectDelaySeconds = 15;
// Get fresh STUN/Relay configuration every hour.
const int kJingleInfoUpdatePeriodSeconds = 3600;
-// TODO(sergeyu): Remove this function and use talk_base::CreateRandomString()
-// when it's fixed to work reliably. See crbug.com/364689 .
-std::string CreateRandomString(int length) {
- // Number of random bytes to generate base64 string at least |length|
- // characters long.
- int raw_length = (length + 1) * 3 / 4;
- std::string base64;
- base::Base64Encode(base::RandBytesAsString(raw_length), &base64);
- DCHECK(static_cast<int>(base64.size()) == length ||
- static_cast<int>(base64.size()) == length + 1);
- base64.resize(length);
- return base64;
-}
-
class LibjingleStreamTransport
: public StreamTransport,
public base::SupportsWeakPtr<LibjingleStreamTransport>,
@@ -141,8 +125,9 @@ LibjingleStreamTransport::LibjingleStreamTransport(
: port_allocator_(port_allocator),
network_settings_(network_settings),
event_handler_(NULL),
- ice_username_fragment_(CreateRandomString(cricket::ICE_UFRAG_LENGTH)),
- ice_password_(CreateRandomString(cricket::ICE_PWD_LENGTH)),
+ ice_username_fragment_(
+ talk_base::CreateRandomString(cricket::ICE_UFRAG_LENGTH)),
+ ice_password_(talk_base::CreateRandomString(cricket::ICE_PWD_LENGTH)),
can_start_(false),
channel_was_writable_(false),
connect_attempts_left_(kMaxReconnectAttempts) {
@@ -385,7 +370,7 @@ void LibjingleStreamTransport::TryReconnect() {
--connect_attempts_left_;
// Restart ICE by resetting ICE password.
- ice_password_ = CreateRandomString(cricket::ICE_PWD_LENGTH);
+ ice_password_ = talk_base::CreateRandomString(cricket::ICE_PWD_LENGTH);
channel_->SetIceCredentials(ice_username_fragment_, ice_password_);
}
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698