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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Called when the network connection has failed. | 43 // Called when the network connection has failed. |
44 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; | 44 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; |
45 }; | 45 }; |
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, | |
54 InputStub* input_stub); | 53 InputStub* input_stub); |
55 | 54 |
56 virtual ~ConnectionToClient(); | |
57 | |
58 virtual void Init(Session* session); | 55 virtual void Init(Session* session); |
59 | 56 |
60 // Returns the connection in use. | 57 // Returns the connection in use. |
61 virtual Session* session(); | 58 virtual Session* session(); |
62 | 59 |
63 // Disconnect the client connection. This method is allowed to be called | 60 // Disconnect the client connection. This method is allowed to be called |
64 // more than once and calls after the first one will be ignored. | 61 // more than once and calls after the first one will be ignored. |
65 // | 62 // |
66 // After this method is called all the send method calls will be ignored. | 63 // After this method is called all the send method calls will be ignored. |
67 virtual void Disconnect(); | 64 virtual void Disconnect(); |
68 | 65 |
69 // Send encoded update stream data to the viewer. | 66 // Send encoded update stream data to the viewer. |
70 virtual VideoStub* video_stub(); | 67 virtual VideoStub* video_stub(); |
71 | 68 |
72 // Return pointer to ClientStub. | 69 // Return pointer to ClientStub. |
73 virtual ClientStub* client_stub(); | 70 virtual ClientStub* client_stub(); |
74 | 71 |
| 72 virtual HostStub* host_stub(); |
| 73 virtual void set_host_stub(HostStub* host_stub); |
| 74 |
75 // Called when the host accepts the client authentication. | 75 // Called when the host accepts the client authentication. |
76 void OnClientAuthenticated(); | 76 void OnClientAuthenticated(); |
77 | 77 |
| 78 // Whether the client has been authenticated. |
| 79 bool client_authenticated(); |
| 80 |
| 81 protected: |
| 82 friend class base::RefCountedThreadSafe<ConnectionToClient>; |
| 83 virtual ~ConnectionToClient(); |
| 84 |
78 private: | 85 private: |
79 // Callback for protocol Session. | 86 // Callback for protocol Session. |
80 void OnSessionStateChange(Session::State state); | 87 void OnSessionStateChange(Session::State state); |
81 | 88 |
82 // Process a libjingle state change event on the |loop_|. | 89 // Process a libjingle state change event on the |loop_|. |
83 void StateChangeTask(Session::State state); | 90 void StateChangeTask(Session::State state); |
84 | 91 |
85 void OnClosed(); | 92 void OnClosed(); |
86 | 93 |
87 // Initially false, this is set to true once the client has authenticated | 94 // 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. | 119 // Dispatcher for submitting messages to stubs. |
113 scoped_ptr<HostMessageDispatcher> dispatcher_; | 120 scoped_ptr<HostMessageDispatcher> dispatcher_; |
114 | 121 |
115 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 122 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
116 }; | 123 }; |
117 | 124 |
118 } // namespace protocol | 125 } // namespace protocol |
119 } // namespace remoting | 126 } // namespace remoting |
120 | 127 |
121 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 128 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |