OLD | NEW |
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 #ifndef REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ | 5 #ifndef REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ |
6 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ | 6 #define REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Returns true if the channel is currently connected. | 59 // Returns true if the channel is currently connected. |
60 bool is_connected() { return channel_ != nullptr; } | 60 bool is_connected() { return channel_ != nullptr; } |
61 | 61 |
62 protected: | 62 protected: |
63 explicit ChannelDispatcherBase(const char* channel_name); | 63 explicit ChannelDispatcherBase(const char* channel_name); |
64 | 64 |
65 BufferedSocketWriter* writer() { return &writer_; } | 65 BufferedSocketWriter* writer() { return &writer_; } |
66 MessageReader* reader() { return &reader_; } | 66 MessageReader* reader() { return &reader_; } |
67 | 67 |
68 private: | 68 private: |
69 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | 69 void OnChannelReady(scoped_ptr<P2PStreamSocket> socket); |
70 void OnReadWriteFailed(int error); | 70 void OnReadWriteFailed(int error); |
71 | 71 |
72 std::string channel_name_; | 72 std::string channel_name_; |
73 StreamChannelFactory* channel_factory_; | 73 StreamChannelFactory* channel_factory_; |
74 EventHandler* event_handler_; | 74 EventHandler* event_handler_; |
75 scoped_ptr<net::StreamSocket> channel_; | 75 scoped_ptr<P2PStreamSocket> channel_; |
76 | 76 |
77 BufferedSocketWriter writer_; | 77 BufferedSocketWriter writer_; |
78 MessageReader reader_; | 78 MessageReader reader_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); | 80 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); |
81 }; | 81 }; |
82 | 82 |
83 } // namespace protocol | 83 } // namespace protocol |
84 } // namespace remoting | 84 } // namespace remoting |
85 | 85 |
86 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ | 86 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ |
OLD | NEW |