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

Side by Side Diff: remoting/protocol/connection_to_host.cc

Issue 9240033: Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/connection_to_host.h" 5 #include "remoting/protocol/connection_to_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } else if (state == SignalStrategy::DISCONNECTED) { 117 } else if (state == SignalStrategy::DISCONNECTED) {
118 VLOG(1) << "Connection closed."; 118 VLOG(1) << "Connection closed.";
119 CloseOnError(NETWORK_FAILURE); 119 CloseOnError(NETWORK_FAILURE);
120 } 120 }
121 } 121 }
122 122
123 void ConnectionToHost::OnSessionManagerReady() { 123 void ConnectionToHost::OnSessionManagerReady() {
124 DCHECK(message_loop_->BelongsToCurrentThread()); 124 DCHECK(message_loop_->BelongsToCurrentThread());
125 125
126 // After SessionManager is initialized we can try to connect to the host. 126 // After SessionManager is initialized we can try to connect to the host.
127 CandidateSessionConfig* candidate_config = 127 scoped_ptr<CandidateSessionConfig> candidate_config =
128 CandidateSessionConfig::CreateDefault(); 128 CandidateSessionConfig::CreateDefault();
129 V1ClientAuthenticator* authenticator = 129 scoped_ptr<Authenticator> authenticator(
130 new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_); 130 new V1ClientAuthenticator(signal_strategy_->GetLocalJid(), access_code_));
131 session_.reset(session_manager_->Connect( 131 session_ = session_manager_->Connect(
132 host_jid_, authenticator, candidate_config, 132 host_jid_, authenticator.Pass(), candidate_config.Pass(),
133 base::Bind(&ConnectionToHost::OnSessionStateChange, 133 base::Bind(&ConnectionToHost::OnSessionStateChange,
134 base::Unretained(this)))); 134 base::Unretained(this)));
135 } 135 }
136 136
137 void ConnectionToHost::OnIncomingSession( 137 void ConnectionToHost::OnIncomingSession(
138 Session* session, 138 Session* session,
139 SessionManager::IncomingSessionResponse* response) { 139 SessionManager::IncomingSessionResponse* response) {
140 DCHECK(message_loop_->BelongsToCurrentThread()); 140 DCHECK(message_loop_->BelongsToCurrentThread());
141 // Client always rejects incoming sessions. 141 // Client always rejects incoming sessions.
142 *response = SessionManager::DECLINE; 142 *response = SessionManager::DECLINE;
143 } 143 }
144 144
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 if (state != state_) { 241 if (state != state_) {
242 state_ = state; 242 state_ = state;
243 error_ = error; 243 error_ = error;
244 event_callback_->OnConnectionState(state_, error_); 244 event_callback_->OnConnectionState(state_, error_);
245 } 245 }
246 } 246 }
247 247
248 } // namespace protocol 248 } // namespace protocol
249 } // namespace remoting 249 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698