OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 | 46 |
47 // Constructs a ConnectionToClient object. |message_loop| is the message loop | 47 // Constructs a ConnectionToClient object. |message_loop| is the message loop |
48 // that this object runs on. A viewer object receives events and messages from | 48 // that this object runs on. A viewer object receives events and messages from |
49 // a libjingle channel, these events are delegated to |handler|. | 49 // a libjingle channel, these events are delegated to |handler|. |
50 // It is guranteed that |handler| is called only on the |message_loop|. | 50 // It is guranteed that |handler| is called only on the |message_loop|. |
51 ConnectionToClient(MessageLoop* message_loop, | 51 ConnectionToClient(MessageLoop* message_loop, |
52 EventHandler* handler, | 52 EventHandler* handler, |
53 HostStub* host_stub, | 53 HostStub* host_stub, |
54 InputStub* input_stub); | 54 InputStub* input_stub); |
55 | 55 |
56 virtual ~ConnectionToClient(); | |
57 | |
58 virtual void Init(Session* session); | 56 virtual void Init(Session* session); |
59 | 57 |
60 // Returns the connection in use. | 58 // Returns the connection in use. |
61 virtual Session* session(); | 59 virtual Session* session(); |
62 | 60 |
63 // Disconnect the client connection. This method is allowed to be called | 61 // Disconnect the client connection. This method is allowed to be called |
64 // more than once and calls after the first one will be ignored. | 62 // more than once and calls after the first one will be ignored. |
65 // | 63 // |
66 // After this method is called all the send method calls will be ignored. | 64 // After this method is called all the send method calls will be ignored. |
67 virtual void Disconnect(); | 65 virtual void Disconnect(); |
68 | 66 |
69 // Send encoded update stream data to the viewer. | 67 // Send encoded update stream data to the viewer. |
70 virtual VideoStub* video_stub(); | 68 virtual VideoStub* video_stub(); |
71 | 69 |
72 // Return pointer to ClientStub. | 70 // Return pointer to ClientStub. |
73 virtual ClientStub* client_stub(); | 71 virtual ClientStub* client_stub(); |
74 | 72 |
73 virtual HostStub* host_stub(); | |
74 virtual void set_host_stub(HostStub* host_stub); | |
75 | |
75 // Called when the host accepts the client authentication. | 76 // Called when the host accepts the client authentication. |
76 void OnClientAuthenticated(); | 77 void OnClientAuthenticated(); |
77 | 78 |
79 // Whether the client has been authenticated. | |
80 bool client_authenticated(); | |
81 | |
82 protected: | |
83 friend class base::RefCountedThreadSafe<ConnectionToClient>; | |
84 virtual ~ConnectionToClient(); | |
awong
2011/03/22 15:11:56
Does this need to be virtual?
Sergey Ulanov
2011/03/22 23:19:14
I think the rule is to make destructor virtual if
simonmorris
2011/03/23 10:35:20
Yes: this is a base class for MockConnectionToClie
| |
85 | |
78 private: | 86 private: |
79 // Callback for protocol Session. | 87 // Callback for protocol Session. |
80 void OnSessionStateChange(Session::State state); | 88 void OnSessionStateChange(Session::State state); |
81 | 89 |
82 // Process a libjingle state change event on the |loop_|. | 90 // Process a libjingle state change event on the |loop_|. |
83 void StateChangeTask(Session::State state); | 91 void StateChangeTask(Session::State state); |
84 | 92 |
85 void OnClosed(); | 93 void OnClosed(); |
86 | 94 |
87 // Initially false, this is set to true once the client has authenticated | 95 // Initially false, this is set to true once the client has authenticated |
(...skipping 24 matching lines...) Expand all Loading... | |
112 // Dispatcher for submitting messages to stubs. | 120 // Dispatcher for submitting messages to stubs. |
113 scoped_ptr<HostMessageDispatcher> dispatcher_; | 121 scoped_ptr<HostMessageDispatcher> dispatcher_; |
114 | 122 |
115 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 123 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
116 }; | 124 }; |
117 | 125 |
118 } // namespace protocol | 126 } // namespace protocol |
119 } // namespace remoting | 127 } // namespace remoting |
120 | 128 |
121 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 129 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |