Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: remoting/host/client_session.h

Issue 9646013: Add the plumbing that will carry a clipboard item from a chromoting client to a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor InputStub, ClipboardStub, and HostEventStub. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_HOST_CLIENT_SESSION_H_ 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_
6 #define REMOTING_HOST_CLIENT_SESSION_H_ 6 #define REMOTING_HOST_CLIENT_SESSION_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 10
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "remoting/protocol/clipboard_stub.h"
13 #include "remoting/protocol/connection_to_client.h" 14 #include "remoting/protocol/connection_to_client.h"
14 #include "remoting/protocol/host_stub.h" 15 #include "remoting/protocol/host_stub.h"
15 #include "remoting/protocol/input_stub.h" 16 #include "remoting/protocol/input_stub.h"
16 #include "third_party/skia/include/core/SkPoint.h" 17 #include "third_party/skia/include/core/SkPoint.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 class Capturer; 21 class Capturer;
21 22
22 // A ClientSession keeps a reference to a connection to a client, and maintains 23 // A ClientSession keeps a reference to a connection to a client, and maintains
23 // per-client state. 24 // per-client state.
24 class ClientSession : public protocol::HostStub, 25 class ClientSession : public protocol::ClipboardStub,
Wez 2012/03/15 20:37:19 Implement HostEventStub rather than ClipboardStub
simonmorris 2012/03/15 21:49:31 Done.
26 public protocol::HostStub,
25 public protocol::InputStub, 27 public protocol::InputStub,
26 public protocol::ConnectionToClient::EventHandler, 28 public protocol::ConnectionToClient::EventHandler,
27 public base::NonThreadSafe { 29 public base::NonThreadSafe {
28 public: 30 public:
29 // Callback interface for passing events to the ChromotingHost. 31 // Callback interface for passing events to the ChromotingHost.
30 class EventHandler { 32 class EventHandler {
31 public: 33 public:
32 virtual ~EventHandler() {} 34 virtual ~EventHandler() {}
33 35
34 // Called after authentication has finished successfully. 36 // Called after authentication has finished successfully.
(...skipping 15 matching lines...) Expand all
50 // Called on notification of a route change event, when a channel is 52 // Called on notification of a route change event, when a channel is
51 // connected. 53 // connected.
52 virtual void OnSessionRouteChange( 54 virtual void OnSessionRouteChange(
53 ClientSession* client, 55 ClientSession* client,
54 const std::string& channel_name, 56 const std::string& channel_name,
55 const net::IPEndPoint& remote_end_point, 57 const net::IPEndPoint& remote_end_point,
56 const net::IPEndPoint& local_end_point) = 0; 58 const net::IPEndPoint& local_end_point) = 0;
57 }; 59 };
58 60
59 // Takes ownership of |connection|. Does not take ownership of 61 // Takes ownership of |connection|. Does not take ownership of
60 // |event_handler|, |input_stub| or |capturer|. 62 // |event_handler|, |clipboard_stub|, |input_stub| or |capturer|.
61 ClientSession(EventHandler* event_handler, 63 ClientSession(EventHandler* event_handler,
62 protocol::ConnectionToClient* connection, 64 protocol::ConnectionToClient* connection,
65 protocol::ClipboardStub* clipboard_stub,
Wez 2012/03/15 20:37:19 Use HostEventStub here rather than separate InputS
simonmorris 2012/03/15 21:49:31 Done.
63 protocol::InputStub* input_stub, 66 protocol::InputStub* input_stub,
64 Capturer* capturer); 67 Capturer* capturer);
65 virtual ~ClientSession(); 68 virtual ~ClientSession();
66 69
70 // protocol::ClipboardStub interface.
71 virtual void InjectClipboardEvent(
72 const protocol::ClipboardEvent& event) OVERRIDE;
73
67 // protocol::InputStub interface. 74 // protocol::InputStub interface.
68 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; 75 virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
69 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE; 76 virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
70 77
71 // protocol::ConnectionToClient::EventHandler interface. 78 // protocol::ConnectionToClient::EventHandler interface.
72 virtual void OnConnectionOpened( 79 virtual void OnConnectionOpened(
73 protocol::ConnectionToClient* connection) OVERRIDE; 80 protocol::ConnectionToClient* connection) OVERRIDE;
74 virtual void OnConnectionClosed( 81 virtual void OnConnectionClosed(
75 protocol::ConnectionToClient* connection) OVERRIDE; 82 protocol::ConnectionToClient* connection) OVERRIDE;
76 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection, 83 virtual void OnConnectionFailed(protocol::ConnectionToClient* connection,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // when the user disconnects. 130 // when the user disconnects.
124 void RestoreEventState(); 131 void RestoreEventState();
125 132
126 EventHandler* event_handler_; 133 EventHandler* event_handler_;
127 134
128 // The connection to the client. 135 // The connection to the client.
129 scoped_ptr<protocol::ConnectionToClient> connection_; 136 scoped_ptr<protocol::ConnectionToClient> connection_;
130 137
131 std::string client_jid_; 138 std::string client_jid_;
132 139
140 // The clipboard stub to which this object delegates.
141 protocol::ClipboardStub* clipboard_stub_;
142
133 // The input stub to which this object delegates. 143 // The input stub to which this object delegates.
134 protocol::InputStub* input_stub_; 144 protocol::InputStub* input_stub_;
135 145
136 // Capturer, used to determine current screen size for ensuring injected 146 // Capturer, used to determine current screen size for ensuring injected
137 // mouse events fall within the screen area. 147 // mouse events fall within the screen area.
138 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen 148 // TODO(lambroslambrou): Move floor-control logic, and clamping to screen
139 // area, out of this class (crbug.com/96508). 149 // area, out of this class (crbug.com/96508).
140 Capturer* capturer_; 150 Capturer* capturer_;
141 151
142 // Whether this client is authenticated. 152 // Whether this client is authenticated.
(...skipping 20 matching lines...) Expand all
163 // Set of keys that are currently pressed down by the user. This is used so 173 // Set of keys that are currently pressed down by the user. This is used so
164 // we can release them if the user disconnects. 174 // we can release them if the user disconnects.
165 std::set<int> pressed_keys_; 175 std::set<int> pressed_keys_;
166 176
167 DISALLOW_COPY_AND_ASSIGN(ClientSession); 177 DISALLOW_COPY_AND_ASSIGN(ClientSession);
168 }; 178 };
169 179
170 } // namespace remoting 180 } // namespace remoting
171 181
172 #endif // REMOTING_HOST_CLIENT_SESSION_H_ 182 #endif // REMOTING_HOST_CLIENT_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698