Chromium Code Reviews| 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 #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/android_keymap.h" | 10 #include "remoting/client/jni/android_keymap.h" |
| 11 #include "remoting/client/jni/chromoting_jni_runtime.h" | 11 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 12 #include "remoting/protocol/libjingle_transport_factory.h" | 12 #include "remoting/protocol/libjingle_transport_factory.h" |
| 13 | 13 |
| 14 // TODO(solb) Move into location shared with client plugin. | 14 // TODO(solb) Move into location shared with client plugin. |
| 15 const char* const CHAT_SERVER = "talk.google.com"; | 15 const char* const CHAT_SERVER = "talk.google.com"; |
|
Sergey Ulanov
2013/07/30 21:55:18
This should be kChatServer (though it might be bet
solb
2013/07/30 23:03:38
Wez and I have discussed this very same issue (see
| |
| 16 const int CHAT_PORT = 5222; | 16 const int CHAT_PORT = 5222; |
| 17 const bool CHAT_USE_TLS = true; | 17 const bool CHAT_USE_TLS = true; |
| 18 | 18 |
| 19 namespace remoting { | 19 namespace remoting { |
| 20 | 20 |
| 21 ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, | 21 ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, |
| 22 const char* username, | 22 const char* username, |
| 23 const char* auth_token, | 23 const char* auth_token, |
| 24 const char* host_jid, | 24 const char* host_jid, |
| 25 const char* host_id, | 25 const char* host_id, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 protocol::MouseEvent action; | 99 protocol::MouseEvent action; |
| 100 action.set_x(x); | 100 action.set_x(x); |
| 101 action.set_y(y); | 101 action.set_y(y); |
| 102 action.set_button(button); | 102 action.set_button(button); |
| 103 if (button != protocol::MouseEvent::BUTTON_UNDEFINED) | 103 if (button != protocol::MouseEvent::BUTTON_UNDEFINED) |
| 104 action.set_button_down(buttonDown); | 104 action.set_button_down(buttonDown); |
| 105 | 105 |
| 106 connection_->input_stub()->InjectMouseEvent(action); | 106 connection_->input_stub()->InjectMouseEvent(action); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void ChromotingJniInstance::PerformKeyboardAction(int keyCode, bool keyDown) { | 109 void ChromotingJniInstance::PerformKeyboardAction(int keyCode, bool keyDown) { |
|
Sergey Ulanov
2013/07/30 21:55:18
Here and in other functions: we don't use camel ca
solb
2013/07/30 23:03:38
I just fixed it in this CL since it's already back
| |
| 110 if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) { | 110 if (!jni_runtime_->network_task_runner()->BelongsToCurrentThread()) { |
| 111 jni_runtime_->network_task_runner()->PostTask( | 111 jni_runtime_->network_task_runner()->PostTask( |
| 112 FROM_HERE, | 112 FROM_HERE, |
| 113 base::Bind(&ChromotingJniInstance::PerformKeyboardAction, | 113 base::Bind(&ChromotingJniInstance::PerformKeyboardAction, |
| 114 this, | 114 this, |
| 115 keyCode, | 115 keyCode, |
| 116 keyDown)); | 116 keyDown)); |
| 117 return; | 117 return; |
| 118 } | 118 } |
| 119 | 119 |
| 120 uint32 usbCode = AndroidKeycodeToUsbKeycode(keyCode); | 120 uint32 usbCode = AndroidKeycodeToUsbKeycode(keyCode); |
| 121 if (usbCode) { | 121 if (usbCode) { |
| 122 protocol::KeyEvent action; | 122 protocol::KeyEvent action; |
| 123 action.set_usb_keycode(usbCode); | 123 action.set_usb_keycode(usbCode); |
| 124 action.set_pressed(keyDown); | 124 action.set_pressed(keyDown); |
| 125 connection_->input_stub()->InjectKeyEvent(action); | 125 connection_->input_stub()->InjectKeyEvent(action); |
| 126 } | 126 } |
| 127 else | 127 else { |
| 128 LOG(WARNING) << "Ignoring unknown keycode: " << keyCode; | 128 LOG(WARNING) << "Ignoring unknown keycode: " << keyCode; |
| 129 } | |
| 129 } | 130 } |
| 130 | 131 |
| 131 void ChromotingJniInstance::OnConnectionState( | 132 void ChromotingJniInstance::OnConnectionState( |
| 132 protocol::ConnectionToHost::State state, | 133 protocol::ConnectionToHost::State state, |
| 133 protocol::ErrorCode error) { | 134 protocol::ErrorCode error) { |
| 134 if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) { | 135 if (!jni_runtime_->ui_task_runner()->BelongsToCurrentThread()) { |
| 135 jni_runtime_->ui_task_runner()->PostTask( | 136 jni_runtime_->ui_task_runner()->PostTask( |
| 136 FROM_HERE, | 137 FROM_HERE, |
| 137 base::Bind(&ChromotingJniInstance::OnConnectionState, | 138 base::Bind(&ChromotingJniInstance::OnConnectionState, |
| 138 this, | 139 this, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 pairable, | 273 pairable, |
| 273 callback)); | 274 callback)); |
| 274 return; | 275 return; |
| 275 } | 276 } |
| 276 | 277 |
| 277 pin_callback_ = callback; | 278 pin_callback_ = callback; |
| 278 jni_runtime_->DisplayAuthenticationPrompt(); | 279 jni_runtime_->DisplayAuthenticationPrompt(); |
| 279 } | 280 } |
| 280 | 281 |
| 281 } // namespace remoting | 282 } // namespace remoting |
| OLD | NEW |