Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 class ChannelDispatcherBase { | |
|
Wez
2011/11/17 22:39:41
What is this class used for?
Sergey Ulanov
2011/11/17 23:10:38
Done.
| |
| 24 public: | |
| 25 // The callback is called when initialization is finished. The | |
| 26 // parameter is set to true on success. | |
| 27 typedef base::Callback<void(bool)> InitializedCallback; | |
| 28 | |
| 29 explicit ChannelDispatcherBase(const char* name); | |
|
Wez
2011/11/17 22:39:41
What does |name| refer to?
Sergey Ulanov
2011/11/17 23:10:38
renamed channel_name_
| |
| 30 virtual ~ChannelDispatcherBase(); | |
| 31 | |
| 32 // Initializes the channel the |session|. | |
|
Wez
2011/11/17 22:39:41
typo?
Sergey Ulanov
2011/11/17 23:10:38
Done.
| |
| 33 void Init(Session* session, const InitializedCallback& callback); | |
| 34 | |
| 35 protected: | |
| 36 net::StreamSocket* channel() { return channel_.get(); } | |
| 37 | |
| 38 // Following method should be overriden in the child classes. | |
| 39 virtual void OnInitialized() = 0; | |
| 40 | |
| 41 private: | |
| 42 void OnChannelReady(net::StreamSocket* socket); | |
| 43 | |
| 44 std::string name_; | |
| 45 Session* session_; | |
| 46 InitializedCallback initialized_callback_; | |
| 47 scoped_ptr<net::StreamSocket> channel_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(ChannelDispatcherBase); | |
| 50 }; | |
| 51 | |
| 52 } // namespace protocol | |
| 53 } // namespace remoting | |
| 54 | |
| 55 #endif // REMOTING_PROTOCOL_CHANNEL_DISPATCHER_BASE_H_ | |
| OLD | NEW |