| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CLIENT_CHROMOTING_SESSION_H_ | 5 #ifndef REMOTING_CLIENT_CHROMOTING_SESSION_H_ |
| 6 #define REMOTING_CLIENT_CHROMOTING_SESSION_H_ | 6 #define REMOTING_CLIENT_CHROMOTING_SESSION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "remoting/client/chromoting_client.h" | 15 #include "remoting/client/chromoting_client.h" |
| 16 #include "remoting/client/client_context.h" | 16 #include "remoting/client/client_context.h" |
| 17 #include "remoting/client/client_telemetry_logger.h" | 17 #include "remoting/client/client_telemetry_logger.h" |
| 18 #include "remoting/client/client_user_interface.h" | 18 #include "remoting/client/client_user_interface.h" |
| 19 #include "remoting/client/connect_to_host_info.h" | 19 #include "remoting/client/connect_to_host_info.h" |
| 20 #include "remoting/client/input/client_input_injector.h" |
| 20 #include "remoting/proto/control.pb.h" | 21 #include "remoting/proto/control.pb.h" |
| 21 #include "remoting/proto/event.pb.h" | 22 #include "remoting/proto/event.pb.h" |
| 22 #include "remoting/protocol/clipboard_stub.h" | 23 #include "remoting/protocol/clipboard_stub.h" |
| 23 #include "remoting/protocol/cursor_shape_stub.h" | 24 #include "remoting/protocol/cursor_shape_stub.h" |
| 24 #include "remoting/signaling/xmpp_signal_strategy.h" | 25 #include "remoting/signaling/xmpp_signal_strategy.h" |
| 25 | 26 |
| 26 namespace remoting { | 27 namespace remoting { |
| 27 | 28 |
| 28 namespace protocol { | 29 namespace protocol { |
| 29 class AudioStub; | 30 class AudioStub; |
| 30 class ClipboardEvent; | 31 class ClipboardEvent; |
| 31 class PerformanceTracker; | 32 class PerformanceTracker; |
| 32 class VideoRenderer; | 33 class VideoRenderer; |
| 33 } // namespace protocol | 34 } // namespace protocol |
| 34 | 35 |
| 35 class ChromotingClientRuntime; | 36 class ChromotingClientRuntime; |
| 36 | 37 |
| 37 // ChromotingSession is scoped to the session. | 38 // ChromotingSession is scoped to the session. |
| 38 // This class is Created on the UI thread but thereafter it is used and | 39 // This class is Created on the UI thread but thereafter it is used and |
| 39 // destroyed on the network thread. Except where indicated, all methods are | 40 // destroyed on the network thread. Except where indicated, all methods are |
| 40 // called on the network thread. | 41 // called on the network thread. |
| 41 class ChromotingSession : public ClientUserInterface, | 42 class ChromotingSession : public ClientUserInterface, |
| 42 public protocol::ClipboardStub { | 43 public protocol::ClipboardStub, |
| 44 public ClientInputInjector { |
| 43 public: | 45 public: |
| 44 class Delegate { | 46 class Delegate { |
| 45 public: | 47 public: |
| 46 virtual ~Delegate() {} | 48 virtual ~Delegate() {} |
| 47 | 49 |
| 48 // Notifies Java code of the current connection status. | 50 // Notifies Java code of the current connection status. |
| 49 virtual void OnConnectionState(protocol::ConnectionToHost::State state, | 51 virtual void OnConnectionState(protocol::ConnectionToHost::State state, |
| 50 protocol::ErrorCode error) = 0; | 52 protocol::ErrorCode error) = 0; |
| 51 | 53 |
| 52 // Saves new pairing credentials to permanent storage. | 54 // Saves new pairing credentials to permanent storage. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const std::string& device_name); | 109 const std::string& device_name); |
| 108 | 110 |
| 109 // Moves the host's cursor to the specified coordinates, optionally with some | 111 // Moves the host's cursor to the specified coordinates, optionally with some |
| 110 // mouse button depressed. If |button| is BUTTON_UNDEFINED, no click is made. | 112 // mouse button depressed. If |button| is BUTTON_UNDEFINED, no click is made. |
| 111 void SendMouseEvent(int x, | 113 void SendMouseEvent(int x, |
| 112 int y, | 114 int y, |
| 113 protocol::MouseEvent_MouseButton button, | 115 protocol::MouseEvent_MouseButton button, |
| 114 bool button_down); | 116 bool button_down); |
| 115 void SendMouseWheelEvent(int delta_x, int delta_y); | 117 void SendMouseWheelEvent(int delta_x, int delta_y); |
| 116 | 118 |
| 117 // Sends the provided keyboard scan code to the host. | 119 // ClientInputInjector implementation. |
| 118 bool SendKeyEvent(int scan_code, int key_code, bool key_down); | 120 bool SendKeyEvent(int scan_code, int key_code, bool key_down) override; |
| 119 | 121 void SendTextEvent(const std::string& text) override; |
| 120 void SendTextEvent(const std::string& text); | |
| 121 | 122 |
| 122 // Sends the provided touch event payload to the host. | 123 // Sends the provided touch event payload to the host. |
| 123 void SendTouchEvent(const protocol::TouchEvent& touch_event); | 124 void SendTouchEvent(const protocol::TouchEvent& touch_event); |
| 124 | 125 |
| 125 // Enables or disables the video channel. May be called from any thread. | 126 // Enables or disables the video channel. May be called from any thread. |
| 126 void EnableVideoChannel(bool enable); | 127 void EnableVideoChannel(bool enable); |
| 127 | 128 |
| 128 void SendClientMessage(const std::string& type, const std::string& data); | 129 void SendClientMessage(const std::string& type, const std::string& data); |
| 129 | 130 |
| 130 // ClientUserInterface implementation. | 131 // ClientUserInterface implementation. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 base::WeakPtr<ChromotingSession> weak_ptr_; | 218 base::WeakPtr<ChromotingSession> weak_ptr_; |
| 218 base::WeakPtrFactory<ChromotingSession> weak_factory_; | 219 base::WeakPtrFactory<ChromotingSession> weak_factory_; |
| 219 | 220 |
| 220 DISALLOW_COPY_AND_ASSIGN(ChromotingSession); | 221 DISALLOW_COPY_AND_ASSIGN(ChromotingSession); |
| 221 }; | 222 }; |
| 222 | 223 |
| 223 } // namespace remoting | 224 } // namespace remoting |
| 224 | 225 |
| 225 #endif // REMOTING_CLIENT_CHROMOTING_SESSION_H_ | 226 #endif // REMOTING_CLIENT_CHROMOTING_SESSION_H_ |
| OLD | NEW |