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

Side by Side Diff: remoting/client/jni/chromoting_jni_instance.h

Issue 19500017: Implement basic point-and-touch mouse input for Android client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 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_JNI_INSTANCE_H_ 5 #ifndef REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
6 #define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_ 6 #define REMOTING_CLIENT_CHROMOTING_JNI_INSTANCE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "remoting/client/chromoting_client.h" 14 #include "remoting/client/chromoting_client.h"
15 #include "remoting/client/client_config.h" 15 #include "remoting/client/client_config.h"
16 #include "remoting/client/client_context.h" 16 #include "remoting/client/client_context.h"
17 #include "remoting/client/client_user_interface.h" 17 #include "remoting/client/client_user_interface.h"
18 #include "remoting/client/frame_consumer_proxy.h" 18 #include "remoting/client/frame_consumer_proxy.h"
19 #include "remoting/client/jni/jni_frame_consumer.h" 19 #include "remoting/client/jni/jni_frame_consumer.h"
20 #include "remoting/jingle_glue/network_settings.h" 20 #include "remoting/jingle_glue/network_settings.h"
21 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 21 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
22 #include "remoting/protocol/clipboard_stub.h"
22 #include "remoting/protocol/connection_to_host.h" 23 #include "remoting/protocol/connection_to_host.h"
24 #include "remoting/protocol/cursor_shape_stub.h"
23 25
24 namespace remoting { 26 namespace remoting {
27 namespace protocol {
28 class ClipboardEvent;
29 class CursorShapeInfo;
30 } // namespace protocol
25 31
26 // ClientUserInterface that indirectly makes and receives JNI calls. 32 // ClientUserInterface that indirectly makes and receives JNI calls.
27 class ChromotingJniInstance 33 class ChromotingJniInstance
28 : public ClientUserInterface, 34 : public ClientUserInterface,
35 public protocol::ClipboardStub,
36 public protocol::CursorShapeStub,
29 public base::RefCountedThreadSafe<ChromotingJniInstance> { 37 public base::RefCountedThreadSafe<ChromotingJniInstance> {
30 public: 38 public:
31 // Initiates a connection with the specified host. Call from the UI thread. 39 // Initiates a connection with the specified host. Call from the UI thread.
32 ChromotingJniInstance( 40 ChromotingJniInstance(
33 const char* username, 41 const char* username,
34 const char* auth_token, 42 const char* auth_token,
35 const char* host_jid, 43 const char* host_jid,
36 const char* host_id, 44 const char* host_id,
37 const char* host_pubkey); 45 const char* host_pubkey);
38 46
39 // Terminates the current connection (if it hasn't already failed) and cleans 47 // Terminates the current connection (if it hasn't already failed) and cleans
40 // up. Must be called before destruction. 48 // up. Must be called before destruction.
41 void Cleanup(); 49 void Cleanup();
42 50
43 // Provides the user's PIN and resumes the host authentication attempt. Call 51 // Provides the user's PIN and resumes the host authentication attempt. Call
44 // on the UI thread once the user has finished entering this PIN into the UI, 52 // on the UI thread once the user has finished entering this PIN into the UI,
45 // but only after the UI has been asked to provide a PIN (via FetchSecret()). 53 // but only after the UI has been asked to provide a PIN (via FetchSecret()).
46 void ProvideSecret(const char* pin); 54 void ProvideSecret(const char* pin);
47 55
48 // Schedules a redraw on the display thread. May be called from any thread. 56 // Schedules a redraw on the display thread. May be called from any thread.
49 void RedrawDesktop(); 57 void RedrawDesktop();
50 58
59 // Moves the host's cursor to the specified coordinates, optionally with some
60 // mouse button depressed. If |button| is BUTTON_UNDEFINED, no click is made.
61 // A negative value of |button| releases the button described by -|button|.
garykac 2013/07/20 21:25:26 Button press/release should be stored as a boolean
solb 2013/07/22 19:13:48 Done.
62 void PerformMouseAction(int x,
63 int y,
64 protocol::MouseEvent_MouseButton button);
65
51 // ClientUserInterface implementation. 66 // ClientUserInterface implementation.
52 virtual void OnConnectionState( 67 virtual void OnConnectionState(
53 protocol::ConnectionToHost::State state, 68 protocol::ConnectionToHost::State state,
54 protocol::ErrorCode error) OVERRIDE; 69 protocol::ErrorCode error) OVERRIDE;
55 virtual void OnConnectionReady(bool ready) OVERRIDE; 70 virtual void OnConnectionReady(bool ready) OVERRIDE;
56 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE; 71 virtual void SetCapabilities(const std::string& capabilities) OVERRIDE;
57 virtual void SetPairingResponse( 72 virtual void SetPairingResponse(
58 const protocol::PairingResponse& response) OVERRIDE; 73 const protocol::PairingResponse& response) OVERRIDE;
59 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE; 74 virtual protocol::ClipboardStub* GetClipboardStub() OVERRIDE;
60 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE; 75 virtual protocol::CursorShapeStub* GetCursorShapeStub() OVERRIDE;
61 virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> 76 virtual scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>
62 GetTokenFetcher(const std::string& host_public_key) OVERRIDE; 77 GetTokenFetcher(const std::string& host_public_key) OVERRIDE;
63 78
79 // CursorShapeStub implementation.
80 virtual void InjectClipboardEvent(
81 const protocol::ClipboardEvent& event) OVERRIDE;
82
83 // ClipboardStub implementation.
84 virtual void SetCursorShape(const protocol::CursorShapeInfo& shape) OVERRIDE;
85
64 private: 86 private:
65 // This object is ref-counted, so it cleans itself up. 87 // This object is ref-counted, so it cleans itself up.
66 virtual ~ChromotingJniInstance(); 88 virtual ~ChromotingJniInstance();
67 89
68 void ConnectToHostOnDisplayThread(); 90 void ConnectToHostOnDisplayThread();
69 void ConnectToHostOnNetworkThread(); 91 void ConnectToHostOnNetworkThread();
70 void DisconnectFromHostOnNetworkThread(); 92 void DisconnectFromHostOnNetworkThread();
71 93
72 // Notifies the user interface that the user needs to enter a PIN. The 94 // Notifies the user interface that the user needs to enter a PIN. The
73 // current authentication attempt is put on hold until |callback| is invoked. 95 // current authentication attempt is put on hold until |callback| is invoked.
(...skipping 30 matching lines...) Expand all
104 std::string host_pubkey_; 126 std::string host_pubkey_;
105 127
106 friend class base::RefCountedThreadSafe<ChromotingJniInstance>; 128 friend class base::RefCountedThreadSafe<ChromotingJniInstance>;
107 129
108 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance); 130 DISALLOW_COPY_AND_ASSIGN(ChromotingJniInstance);
109 }; 131 };
110 132
111 } // namespace remoting 133 } // namespace remoting
112 134
113 #endif 135 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698