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

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

Issue 19500017: Implement basic point-and-touch mouse input for Android client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bump version number to 0.01 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
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/jni_interface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "remoting/client/jni/chromoting_jni_instance.h" 5 #include "remoting/client/jni/chromoting_jni_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "remoting/client/audio_player.h" 9 #include "remoting/client/audio_player.h"
10 #include "remoting/client/jni/chromoting_jni.h" 10 #include "remoting/client/jni/chromoting_jni.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // asynchronous run, since Java might want it back as soon as we return. 68 // asynchronous run, since Java might want it back as soon as we return.
69 ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE, 69 ChromotingJni::GetInstance()->network_task_runner()->PostTask(FROM_HERE,
70 base::Bind(pin_callback_, pin)); 70 base::Bind(pin_callback_, pin));
71 } 71 }
72 72
73 void ChromotingJniInstance::RedrawDesktop() { 73 void ChromotingJniInstance::RedrawDesktop() {
74 if (!ChromotingJni::GetInstance()-> 74 if (!ChromotingJni::GetInstance()->
75 display_task_runner()->BelongsToCurrentThread()) { 75 display_task_runner()->BelongsToCurrentThread()) {
76 ChromotingJni::GetInstance()->display_task_runner()->PostTask( 76 ChromotingJni::GetInstance()->display_task_runner()->PostTask(
77 FROM_HERE, 77 FROM_HERE,
78 base::Bind(&ChromotingJniInstance::RedrawDesktop, 78 base::Bind(&ChromotingJniInstance::RedrawDesktop, this));
79 this));
80 return; 79 return;
81 } 80 }
82 81
83 ChromotingJni::GetInstance()->RedrawCanvas(); 82 ChromotingJni::GetInstance()->RedrawCanvas();
84 } 83 }
85 84
85 void ChromotingJniInstance::PerformMouseAction(
86 int x,
87 int y,
88 protocol::MouseEvent_MouseButton button,
89 bool buttonDown) {
90 if(!ChromotingJni::GetInstance()->
91 network_task_runner()->BelongsToCurrentThread()) {
92 ChromotingJni::GetInstance()->network_task_runner()->PostTask(
93 FROM_HERE,
94 base::Bind(&ChromotingJniInstance::PerformMouseAction,
95 this,
96 x,
97 y,
98 button,
99 buttonDown));
100 return;
101 }
102
103 protocol::MouseEvent action;
104 action.set_x(x);
105 action.set_y(y);
106 action.set_button(button);
107 if (button != protocol::MouseEvent::BUTTON_UNDEFINED)
108 action.set_button_down(buttonDown);
109
110 connection_->input_stub()->InjectMouseEvent(action);
111 }
112
86 void ChromotingJniInstance::OnConnectionState( 113 void ChromotingJniInstance::OnConnectionState(
87 protocol::ConnectionToHost::State state, 114 protocol::ConnectionToHost::State state,
88 protocol::ErrorCode error) { 115 protocol::ErrorCode error) {
89 if (!ChromotingJni::GetInstance()-> 116 if (!ChromotingJni::GetInstance()->
90 ui_task_runner()->BelongsToCurrentThread()) { 117 ui_task_runner()->BelongsToCurrentThread()) {
91 ChromotingJni::GetInstance()-> 118 ChromotingJni::GetInstance()->
92 ui_task_runner()->PostTask( 119 ui_task_runner()->PostTask(
93 FROM_HERE, 120 FROM_HERE,
94 base::Bind(&ChromotingJniInstance::OnConnectionState, 121 base::Bind(&ChromotingJniInstance::OnConnectionState,
95 this, 122 this,
(...skipping 10 matching lines...) Expand all
106 } 133 }
107 134
108 void ChromotingJniInstance::SetCapabilities(const std::string& capabilities) {} 135 void ChromotingJniInstance::SetCapabilities(const std::string& capabilities) {}
109 136
110 void ChromotingJniInstance::SetPairingResponse( 137 void ChromotingJniInstance::SetPairingResponse(
111 const protocol::PairingResponse& response) { 138 const protocol::PairingResponse& response) {
112 NOTIMPLEMENTED(); 139 NOTIMPLEMENTED();
113 } 140 }
114 141
115 protocol::ClipboardStub* ChromotingJniInstance::GetClipboardStub() { 142 protocol::ClipboardStub* ChromotingJniInstance::GetClipboardStub() {
116 NOTIMPLEMENTED(); 143 return this;
117 return NULL;
118 } 144 }
119 145
120 protocol::CursorShapeStub* ChromotingJniInstance::GetCursorShapeStub() { 146 protocol::CursorShapeStub* ChromotingJniInstance::GetCursorShapeStub() {
121 NOTIMPLEMENTED(); 147 return this;
122 return NULL;
123 } 148 }
124 149
125 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> 150 scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>
126 ChromotingJniInstance::GetTokenFetcher(const std::string& host_public_key) { 151 ChromotingJniInstance::GetTokenFetcher(const std::string& host_public_key) {
127 // Return null to indicate that third-party authentication is unsupported. 152 // Return null to indicate that third-party authentication is unsupported.
128 return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>(); 153 return scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher>();
129 } 154 }
130 155
156 void ChromotingJniInstance::InjectClipboardEvent(
157 const protocol::ClipboardEvent& event) {
158 NOTIMPLEMENTED();
159 }
160
161 void ChromotingJniInstance::SetCursorShape(
162 const protocol::CursorShapeInfo& shape) {
163 NOTIMPLEMENTED();
164 }
165
131 void ChromotingJniInstance::ConnectToHostOnDisplayThread() { 166 void ChromotingJniInstance::ConnectToHostOnDisplayThread() {
132 DCHECK(ChromotingJni::GetInstance()-> 167 DCHECK(ChromotingJni::GetInstance()->
133 display_task_runner()->BelongsToCurrentThread()); 168 display_task_runner()->BelongsToCurrentThread());
134 169
135 frame_consumer_ = new FrameConsumerProxy( 170 frame_consumer_ = new FrameConsumerProxy(
136 ChromotingJni::GetInstance()->display_task_runner()); 171 ChromotingJni::GetInstance()->display_task_runner());
137 view_.reset(new JniFrameConsumer()); 172 view_.reset(new JniFrameConsumer());
138 view_weak_factory_.reset(new base::WeakPtrFactory<JniFrameConsumer>( 173 view_weak_factory_.reset(new base::WeakPtrFactory<JniFrameConsumer>(
139 view_.get())); 174 view_.get()));
140 frame_consumer_->Attach(view_weak_factory_->GetWeakPtr()); 175 frame_consumer_->Attach(view_weak_factory_->GetWeakPtr());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 pairable, 262 pairable,
228 callback)); 263 callback));
229 return; 264 return;
230 } 265 }
231 266
232 pin_callback_ = callback; 267 pin_callback_ = callback;
233 ChromotingJni::GetInstance()->DisplayAuthenticationPrompt(); 268 ChromotingJni::GetInstance()->DisplayAuthenticationPrompt();
234 } 269 }
235 270
236 } // namespace remoting 271 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/chromoting_jni_instance.h ('k') | remoting/client/jni/jni_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698