| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class StreamSocket; | 15 class StreamSocket; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 namespace remoting { | 18 namespace remoting { |
| 19 namespace protocol { | 19 namespace protocol { |
| 20 | 20 |
| 21 struct ChannelConfig; | 21 struct ChannelConfig; |
| 22 class ChannelFactory; | 22 class StreamChannelFactory; |
| 23 class Session; | 23 class Session; |
| 24 | 24 |
| 25 // Base class for channel message dispatchers. It's responsible for | 25 // Base class for channel message dispatchers. It's responsible for |
| 26 // creating the named channel. Derived dispatchers then dispatch | 26 // creating the named channel. Derived dispatchers then dispatch |
| 27 // incoming messages on this channel as well as send outgoing | 27 // incoming messages on this channel as well as send outgoing |
| 28 // messages. | 28 // messages. |
| 29 class ChannelDispatcherBase { | 29 class ChannelDispatcherBase { |
| 30 public: | 30 public: |
| 31 // The callback is called when initialization is finished. The | 31 // The callback is called when initialization is finished. The |
| 32 // parameter is set to true on success. | 32 // parameter is set to true on success. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 49 net::StreamSocket* channel() { return channel_.get(); } | 49 net::StreamSocket* channel() { return channel_.get(); } |
| 50 | 50 |
| 51 // Called when channel is initialized. Must be overriden in the | 51 // Called when channel is initialized. Must be overriden in the |
| 52 // child classes. Should not delete the dispatcher. | 52 // child classes. Should not delete the dispatcher. |
| 53 virtual void OnInitialized() = 0; | 53 virtual void OnInitialized() = 0; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); | 56 void OnChannelReady(scoped_ptr<net::StreamSocket> socket); |
| 57 | 57 |
| 58 std::string channel_name_; | 58 std::string channel_name_; |
| 59 ChannelFactory* channel_factory_; | 59 StreamChannelFactory* channel_factory_; |
| 60 InitializedCallback initialized_callback_; | 60 InitializedCallback initialized_callback_; |
| 61 scoped_ptr<net::StreamSocket> channel_; | 61 scoped_ptr<net::StreamSocket> channel_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); | 63 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace protocol | 66 } // namespace protocol |
| 67 } // namespace remoting | 67 } // namespace remoting |
| 68 | 68 |
| 69 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ | 69 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ |
| OLD | NEW |