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

Side by Side Diff: remoting/protocol/host_event_dispatcher.cc

Issue 214173002: Send TextEvent message from Android client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 #include "remoting/protocol/host_event_dispatcher.h" 5 #include "remoting/protocol/host_event_dispatcher.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "net/socket/stream_socket.h" 8 #include "net/socket/stream_socket.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/proto/event.pb.h" 10 #include "remoting/proto/event.pb.h"
(...skipping 23 matching lines...) Expand all
34 base::ScopedClosureRunner done_runner(done_task); 34 base::ScopedClosureRunner done_runner(done_task);
35 35
36 if (message->has_sequence_number() && !sequence_number_callback_.is_null()) 36 if (message->has_sequence_number() && !sequence_number_callback_.is_null())
37 sequence_number_callback_.Run(message->sequence_number()); 37 sequence_number_callback_.Run(message->sequence_number());
38 38
39 if (message->has_key_event()) { 39 if (message->has_key_event()) {
40 const KeyEvent& event = message->key_event(); 40 const KeyEvent& event = message->key_event();
41 41
42 // If |text| field is present in KeyEvent then no other fields required, 42 // If |text| field is present in KeyEvent then no other fields required,
43 // otherwise both |usb_keycode| and |pressed| must be present. 43 // otherwise both |usb_keycode| and |pressed| must be present.
44 if (event.has_text() || (event.has_usb_keycode() && event.has_pressed())) { 44 if (event.has_usb_keycode() && event.has_pressed()) {
45 input_stub_->InjectKeyEvent(event); 45 input_stub_->InjectKeyEvent(event);
46 } else { 46 } else {
47 LOG(WARNING) << "Received invalid key event."; 47 LOG(WARNING) << "Received invalid key event.";
48 } 48 }
49 } else if (message->has_text_event()) { 49 } else if (message->has_text_event()) {
50 const TextEvent& event = message->text_event(); 50 const TextEvent& event = message->text_event();
51 if (event.has_text()) { 51 if (event.has_text()) {
52 input_stub_->InjectTextEvent(event); 52 input_stub_->InjectTextEvent(event);
53 } else { 53 } else {
54 LOG(WARNING) << "Received invalid text event."; 54 LOG(WARNING) << "Received invalid text event.";
55 } 55 }
56 } else if (message->has_mouse_event()) { 56 } else if (message->has_mouse_event()) {
57 input_stub_->InjectMouseEvent(message->mouse_event()); 57 input_stub_->InjectMouseEvent(message->mouse_event());
58 } else { 58 } else {
59 LOG(WARNING) << "Unknown event message received."; 59 LOG(WARNING) << "Unknown event message received.";
60 } 60 }
61 } 61 }
62 62
63 } // namespace protocol 63 } // namespace protocol
64 } // namespace remoting 64 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698