OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // ChromotingClient is the controller for the Client implementation. | 5 // ChromotingClient is the controller for the Client implementation. |
6 | 6 |
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H | 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H |
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H | 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "remoting/client/host_connection.h" | 11 #include "remoting/client/host_connection.h" |
12 | 12 |
13 class MessageLoop; | 13 class MessageLoop; |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 class ChromotingView; | 17 class ChromotingView; |
| 18 class ClientConfig; |
| 19 class ClientContext; |
| 20 class InputHandler; |
18 | 21 |
19 class ChromotingClient : public HostConnection::HostEventCallback { | 22 class ChromotingClient : public HostConnection::HostEventCallback { |
20 public: | 23 public: |
21 ChromotingClient(MessageLoop* message_loop, | 24 // Objects passed in are not owned by this class. |
| 25 ChromotingClient(ClientConfig* config, |
| 26 ClientContext* context, |
22 HostConnection* connection, | 27 HostConnection* connection, |
23 ChromotingView* view); | 28 ChromotingView* view, |
| 29 InputHandler* input_handler, |
| 30 CancelableTask* client_done); |
24 virtual ~ChromotingClient(); | 31 virtual ~ChromotingClient(); |
25 | 32 |
| 33 void Start(); |
| 34 void Stop(); |
| 35 void ClientDone(); |
| 36 |
26 // Signals that the associated view may need updating. | 37 // Signals that the associated view may need updating. |
27 virtual void Repaint(); | 38 virtual void Repaint(); |
28 | 39 |
29 // Sets the viewport to do display. The viewport may be larger and/or | 40 // Sets the viewport to do display. The viewport may be larger and/or |
30 // smaller than the actual image background being displayed. | 41 // smaller than the actual image background being displayed. |
31 // | 42 // |
32 // TODO(ajwong): This doesn't make sense to have here. We're going to have | 43 // TODO(ajwong): This doesn't make sense to have here. We're going to have |
33 // threading isseus since pepper view needs to be called from the main pepper | 44 // threading isseus since pepper view needs to be called from the main pepper |
34 // thread synchronously really. | 45 // thread synchronously really. |
35 virtual void SetViewport(int x, int y, int width, int height); | 46 virtual void SetViewport(int x, int y, int width, int height); |
(...skipping 10 matching lines...) Expand all Loading... |
46 CONNECTED, | 57 CONNECTED, |
47 DISCONNECTED, | 58 DISCONNECTED, |
48 FAILED, | 59 FAILED, |
49 }; | 60 }; |
50 | 61 |
51 MessageLoop* message_loop(); | 62 MessageLoop* message_loop(); |
52 | 63 |
53 // Convenience method for modifying the state on this object's message loop. | 64 // Convenience method for modifying the state on this object's message loop. |
54 void SetState(State s); | 65 void SetState(State s); |
55 | 66 |
56 // TODO(ajwong): Do all of these methods need to run on the client's thread? | 67 // Handles for chromotocol messages. |
57 void DoSetState(State s); | 68 void InitClient(HostMessage* msg); |
58 void DoRepaint(); | 69 void BeginUpdate(HostMessage* msg); |
59 void DoSetViewport(int x, int y, int width, int height); | 70 void HandleUpdate(HostMessage* msg); |
| 71 void EndUpdate(HostMessage* msg); |
60 | 72 |
61 // Handles for chromotocol messages. | 73 // The following are not owned by this class. |
62 void DoInitClient(HostMessage* msg); | 74 ClientConfig* config_; |
63 void DoBeginUpdate(HostMessage* msg); | 75 ClientContext* context_; |
64 void DoHandleUpdate(HostMessage* msg); | 76 HostConnection* connection_; |
65 void DoEndUpdate(HostMessage* msg); | 77 ChromotingView* view_; |
| 78 InputHandler* input_handler_; |
66 | 79 |
67 MessageLoop* message_loop_; | 80 // If non-NULL, this is called when the client is done. |
| 81 CancelableTask* client_done_; |
68 | 82 |
69 State state_; | 83 State state_; |
70 | 84 |
71 // Connection to views and hosts. Not owned. | |
72 HostConnection* host_connection_; | |
73 ChromotingView* view_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); | 85 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); |
76 }; | 86 }; |
77 | 87 |
78 } // namespace remoting | 88 } // namespace remoting |
79 | 89 |
80 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::ChromotingClient); | 90 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::ChromotingClient); |
81 | 91 |
82 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H | 92 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H |
OLD | NEW |