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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/client_control_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/channel_dispatcher_base.cc
diff --git a/remoting/protocol/channel_dispatcher_base.cc b/remoting/protocol/channel_dispatcher_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..21f118784803eff251aec88f7d6ea9cbeb661358
--- /dev/null
+++ b/remoting/protocol/channel_dispatcher_base.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 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 "remoting/protocol/channel_dispatcher_base.h"
+
+#include "base/bind.h"
+#include "net/socket/stream_socket.h"
+#include "remoting/protocol/session.h"
+
+namespace remoting {
+namespace protocol {
+
+ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
+ : channel_name_(channel_name),
+ session_(NULL) {
+}
+
+ChannelDispatcherBase::~ChannelDispatcherBase() {
+ if (session_)
+ session_->CancelChannelCreation(channel_name_);
+}
+
+void ChannelDispatcherBase::Init(Session* session,
+ const InitializedCallback& callback) {
+ DCHECK(session);
+ session_ = session;
+ initialized_callback_ = callback;
+
+ session_->CreateStreamChannel(channel_name_, base::Bind(
+ &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
+}
+
+void ChannelDispatcherBase::OnChannelReady(net::StreamSocket* socket) {
+ if (!socket) {
+ initialized_callback_.Run(false);
+ return;
+ }
+
+ channel_.reset(socket);
+
+ OnInitialized();
+
+ initialized_callback_.Run(true);
+}
+
+} // namespace protocol
+} // namespace remoting
« no previous file with comments | « remoting/protocol/channel_dispatcher_base.h ('k') | remoting/protocol/client_control_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698