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

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

Issue 8587053: Remove event_channel() and control_channel() from Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/protocol/channel_dispatcher_base.h"
6
7 #include "base/bind.h"
8 #include "net/socket/stream_socket.h"
9 #include "remoting/protocol/session.h"
10
11 namespace remoting {
12 namespace protocol {
13
14 ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
15 : channel_name_(channel_name),
16 session_(NULL) {
17 }
18
19 ChannelDispatcherBase::~ChannelDispatcherBase() {
20 if (session_)
21 session_->CancelChannelCreation(channel_name_);
22 }
23
24 void ChannelDispatcherBase::Init(Session* session,
25 const InitializedCallback& callback) {
26 DCHECK(session);
27 session_ = session;
28 initialized_callback_ = callback;
29
30 session_->CreateStreamChannel(channel_name_, base::Bind(
31 &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
32 }
33
34 void ChannelDispatcherBase::OnChannelReady(net::StreamSocket* socket) {
35 if (!socket) {
36 initialized_callback_.Run(false);
37 return;
38 }
39
40 channel_.reset(socket);
41
42 OnInitialized();
43
44 initialized_callback_.Run(true);
45 }
46
47 } // namespace protocol
48 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698