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

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

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
« no previous file with comments | « no previous file | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
6 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace net {
15 class StreamSocket;
16 } // namespace net
17
18 namespace remoting {
19 namespace protocol {
20
21 class Session;
22
23 // Base class for channel message dispatchers. It's responsible for
24 // creating the named channel. Derived dispatchers then dispatch
25 // incoming messages on this channel as well as send outgoing
26 // messages.
27 class ChannelDispatcherBase {
28 public:
29 // The callback is called when initialization is finished. The
30 // parameter is set to true on success.
31 typedef base::Callback<void(bool)> InitializedCallback;
32
33 virtual ~ChannelDispatcherBase();
34
35 // Creates and connects the channel in the specified
36 // |session|. Caller retains ownership of the Session.
37 void Init(Session* session, const InitializedCallback& callback);
38
39 // Returns true if the channel is currently connected.
40 bool is_connected() { return channel() != NULL; }
41
42 protected:
43 explicit ChannelDispatcherBase(const char* channel_name);
44
45 net::StreamSocket* channel() { return channel_.get(); }
46
47 // Called when channel is initialized. Must be overriden in the
48 // child classes. Should not delete the dispatcher.
49 virtual void OnInitialized() = 0;
50
51 private:
52 void OnChannelReady(net::StreamSocket* socket);
53
54 std::string channel_name_;
55 Session* session_;
56 InitializedCallback initialized_callback_;
57 scoped_ptr<net::StreamSocket> channel_;
58
59 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase);
60 };
61
62 } // namespace protocol
63 } // namespace remoting
64
65 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/channel_dispatcher_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698