diff options
Diffstat (limited to 'remoting')
26 files changed, 88 insertions, 64 deletions
diff --git a/remoting/base/decoder_row_based.cc b/remoting/base/decoder_row_based.cc index 8e34e1d..a657331 100644 --- a/remoting/base/decoder_row_based.cc +++ b/remoting/base/decoder_row_based.cc @@ -66,8 +66,7 @@ void DecoderRowBased::Initialize(scoped_refptr<media::VideoFrame> frame) { state_ = kReady; } -Decoder::DecodeResult DecoderRowBased::DecodePacket( - const VideoPacket* packet) { +Decoder::DecodeResult DecoderRowBased::DecodePacket(const VideoPacket* packet) { UpdateStateForPacket(packet); if (state_ == kError) { diff --git a/remoting/client/input_handler.cc b/remoting/client/input_handler.cc index 7048e73..68c29f8 100644 --- a/remoting/client/input_handler.cc +++ b/remoting/client/input_handler.cc @@ -10,6 +10,9 @@ namespace remoting { +using protocol::KeyEvent; +using protocol::MouseEvent; + InputHandler::InputHandler(ClientContext* context, protocol::ConnectionToHost* connection, ChromotingView* view) @@ -41,7 +44,7 @@ void InputHandler::SendMouseMoveEvent(int x, int y) { } void InputHandler::SendMouseButtonEvent(bool button_down, - MouseButton button) { + MouseEvent::MouseButton button) { protocol::InputStub* stub = connection_->input_stub(); if (stub) { MouseEvent* event = new MouseEvent(); diff --git a/remoting/client/input_handler.h b/remoting/client/input_handler.h index 8d7c86d..f3f647e 100644 --- a/remoting/client/input_handler.h +++ b/remoting/client/input_handler.h @@ -30,7 +30,8 @@ class InputHandler { protected: void SendKeyEvent(bool press, int keycode); void SendMouseMoveEvent(int x, int y); - void SendMouseButtonEvent(bool down, MouseButton button); + void SendMouseButtonEvent(bool down, + protocol::MouseEvent::MouseButton button); ClientContext* context_; protocol::ConnectionToHost* connection_; diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc index 3c4f00a..81ace4e 100644 --- a/remoting/client/plugin/pepper_input_handler.cc +++ b/remoting/client/plugin/pepper_input_handler.cc @@ -8,6 +8,9 @@ namespace remoting { +using protocol::KeyEvent; +using protocol::MouseEvent; + PepperInputHandler::PepperInputHandler(ClientContext* context, protocol::ConnectionToHost* connection, ChromotingView* view) @@ -38,16 +41,16 @@ void PepperInputHandler::HandleMouseMoveEvent(const PP_InputEvent_Mouse& event) void PepperInputHandler::HandleMouseButtonEvent( bool button_down, const PP_InputEvent_Mouse& event) { - MouseButton button = MouseButtonUndefined; + MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { - button = MouseButtonLeft; + button = MouseEvent::BUTTON_LEFT; } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) { - button = MouseButtonMiddle; + button = MouseEvent::BUTTON_MIDDLE; } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) { - button = MouseButtonRight; + button = MouseEvent::BUTTON_RIGHT; } - if (button != MouseButtonUndefined) { + if (button != MouseEvent::BUTTON_UNDEFINED) { SendMouseButtonEvent(button_down, button); } } diff --git a/remoting/client/x11_input_handler.cc b/remoting/client/x11_input_handler.cc index 4c3d142..b7ee8df 100644 --- a/remoting/client/x11_input_handler.cc +++ b/remoting/client/x11_input_handler.cc @@ -16,6 +16,9 @@ namespace remoting { +using protocol::KeyEvent; +using protocol::MouseEvent; + X11InputHandler::X11InputHandler(ClientContext* context, protocol::ConnectionToHost* connection, ChromotingView* view) @@ -88,16 +91,16 @@ void X11InputHandler::HandleMouseMoveEvent(int x, int y) { } void X11InputHandler::HandleMouseButtonEvent(bool button_down, int xbutton_id) { - MouseButton button = MouseButtonUndefined; + MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED; if (xbutton_id == 1) { - button = MouseButtonLeft; + button = MouseEvent::BUTTON_LEFT; } else if (xbutton_id == 2) { - button = MouseButtonMiddle; + button = MouseEvent::BUTTON_MIDDLE; } else if (xbutton_id == 3) { - button = MouseButtonRight; + button = MouseEvent::BUTTON_RIGHT; } - if (button != MouseButtonUndefined) { + if (button != MouseEvent::BUTTON_UNDEFINED) { SendMouseButtonEvent(button_down, button); } } diff --git a/remoting/host/event_executor_linux.cc b/remoting/host/event_executor_linux.cc index f540d44..5096fac 100644 --- a/remoting/host/event_executor_linux.cc +++ b/remoting/host/event_executor_linux.cc @@ -15,18 +15,22 @@ namespace remoting { -static int MouseButtonToX11ButtonNumber(MouseButton button) { +using protocol::MouseEvent; +using protocol::KeyEvent; + +static int MouseButtonToX11ButtonNumber( + protocol::MouseEvent::MouseButton button) { switch (button) { - case MouseButtonLeft: + case MouseEvent::BUTTON_LEFT: return 1; - case MouseButtonRight: + case MouseEvent::BUTTON_RIGHT: return 2; - case MouseButtonMiddle: + case MouseEvent::BUTTON_MIDDLE: return 3; - case MouseButtonUndefined: + case MouseEvent::BUTTON_UNDEFINED: default: return -1; } @@ -202,6 +206,7 @@ class EventExecutorLinuxPimpl { ~EventExecutorLinuxPimpl(); bool Init(); // TODO(ajwong): Do we really want this to be synchronous? + void HandleMouse(const MouseEvent* message); void HandleKey(const KeyEvent* key_event); diff --git a/remoting/host/event_executor_linux.h b/remoting/host/event_executor_linux.h index af765f8..c20b06f 100644 --- a/remoting/host/event_executor_linux.h +++ b/remoting/host/event_executor_linux.h @@ -24,8 +24,8 @@ class EventExecutorLinux : public protocol::InputStub { Capturer* capturer); virtual ~EventExecutorLinux(); - virtual void InjectKeyEvent(const KeyEvent* event, Task* done); - virtual void InjectMouseEvent(const MouseEvent* event, Task* done); + virtual void InjectKeyEvent(const protocol::KeyEvent* event, Task* done); + virtual void InjectMouseEvent(const protocol::MouseEvent* event, Task* done); private: MessageLoop* message_loop_; diff --git a/remoting/host/event_executor_mac.cc b/remoting/host/event_executor_mac.cc index e89ad33..37041a8 100644 --- a/remoting/host/event_executor_mac.cc +++ b/remoting/host/event_executor_mac.cc @@ -10,6 +10,9 @@ namespace remoting { +using protocol::MouseEvent; +using protocol::KeyEvent; + EventExecutorMac::EventExecutorMac( MessageLoop* message_loop, Capturer* capturer) : message_loop_(message_loop), diff --git a/remoting/host/event_executor_mac.h b/remoting/host/event_executor_mac.h index 0e38852..758ccc0 100644 --- a/remoting/host/event_executor_mac.h +++ b/remoting/host/event_executor_mac.h @@ -19,8 +19,8 @@ class EventExecutorMac : public protocol::InputStub { EventExecutorMac(MessageLoop* message_loop, Capturer* capturer); virtual ~EventExecutorMac(); - virtual void InjectKeyEvent(const KeyEvent* event, Task* done); - virtual void InjectMouseEvent(const MouseEvent* event, Task* done); + virtual void InjectKeyEvent(const protocol::KeyEvent* event, Task* done); + virtual void InjectMouseEvent(const protocol::MouseEvent* event, Task* done); private: MessageLoop* message_loop_; diff --git a/remoting/host/event_executor_win.cc b/remoting/host/event_executor_win.cc index f79d9eb..1fe3beb 100644 --- a/remoting/host/event_executor_win.cc +++ b/remoting/host/event_executor_win.cc @@ -14,6 +14,9 @@ namespace remoting { +using protocol::MouseEvent; +using protocol::KeyEvent; + EventExecutorWin::EventExecutorWin( MessageLoop* message_loop, Capturer* capturer) : message_loop_(message_loop), @@ -36,8 +39,7 @@ void EventExecutorWin::InjectKeyEvent(const KeyEvent* event, Task* done) { delete done; } -void EventExecutorWin::InjectMouseEvent(const MouseEvent* event, - Task* done) { +void EventExecutorWin::InjectMouseEvent(const MouseEvent* event, Task* done) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask( FROM_HERE, @@ -126,15 +128,15 @@ void EventExecutorWin::HandleMouse(const MouseEvent* event) { button_event.mi.dx = 0; button_event.mi.dy = 0; - MouseButton button = event->button(); + MouseEvent::MouseButton button = event->button(); bool down = event->button_down(); - if (button == MouseButtonLeft) { + if (button == MouseEvent::BUTTON_LEFT) { button_event.mi.dwFlags = down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; - } else if (button == MouseButtonMiddle) { + } else if (button == MouseEvent::BUTTON_MIDDLE) { button_event.mi.dwFlags = down ? MOUSEEVENTF_MIDDLEDOWN : MOUSEEVENTF_MIDDLEUP; - } else if (button == MouseButtonRight) { + } else if (button == MouseEvent::BUTTON_RIGHT) { button_event.mi.dwFlags = down ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP; } else { diff --git a/remoting/host/event_executor_win.h b/remoting/host/event_executor_win.h index b7be3c8..4ba4aad 100644 --- a/remoting/host/event_executor_win.h +++ b/remoting/host/event_executor_win.h @@ -23,12 +23,12 @@ class EventExecutorWin : public protocol::InputStub { EventExecutorWin(MessageLoop* message_loop, Capturer* capturer); virtual ~EventExecutorWin(); - virtual void InjectKeyEvent(const KeyEvent* event, Task* done); - virtual void InjectMouseEvent(const MouseEvent* event, Task* done); + virtual void InjectKeyEvent(const protocol::KeyEvent* event, Task* done); + virtual void InjectMouseEvent(const protocol::MouseEvent* event, Task* done); private: - void HandleKey(const KeyEvent* event); - void HandleMouse(const MouseEvent* event); + void HandleKey(const protocol::KeyEvent* event); + void HandleMouse(const protocol::MouseEvent* event); MessageLoop* message_loop_; Capturer* capturer_; diff --git a/remoting/proto/control.proto b/remoting/proto/control.proto index 6e40658..b53775f 100644 --- a/remoting/proto/control.proto +++ b/remoting/proto/control.proto @@ -20,9 +20,3 @@ message NotifyResolutionRequest { required int32 width = 1; required int32 height = 2; }; - -// Represents a message being sent on the control channel. -message ControlMessage { - optional SuggestResolutionRequest suggest_resolution = 1; - optional NotifyResolutionRequest notify_resolution = 2; -} diff --git a/remoting/proto/event.proto b/remoting/proto/event.proto index 887f77f..f4cc690 100644 --- a/remoting/proto/event.proto +++ b/remoting/proto/event.proto @@ -8,7 +8,7 @@ syntax = "proto2"; option optimize_for = LITE_RUNTIME; -package remoting; +package remoting.protocol; // Defines a keyboard event. // NEXT ID: 3 @@ -18,15 +18,16 @@ message KeyEvent { required bool pressed = 2; } -enum MouseButton { - MouseButtonUndefined = 0; - MouseButtonLeft = 1; - MouseButtonMiddle = 2; - MouseButtonRight = 3; -} - // Defines a mouse event message on the event channel. message MouseEvent { + + enum MouseButton { + BUTTON_UNDEFINED = 0; + BUTTON_LEFT = 1; + BUTTON_MIDDLE = 2; + BUTTON_RIGHT = 3; + } + // Mouse position information. optional int32 x = 1; optional int32 y = 2; diff --git a/remoting/proto/internal.proto b/remoting/proto/internal.proto index 6949375..7c4385b 100644 --- a/remoting/proto/internal.proto +++ b/remoting/proto/internal.proto @@ -9,11 +9,16 @@ syntax = "proto2"; import "control.proto"; import "event.proto"; -import "video.proto"; option optimize_for = LITE_RUNTIME; -package remoting; +package remoting.protocol; + +// Represents a message being sent on the control channel. +message ControlMessage { + optional SuggestResolutionRequest suggest_resolution = 1; + optional NotifyResolutionRequest notify_resolution = 2; +} // TODO(garykac) This is dead, remove remaining references and delete. message ChromotingClientMessage { diff --git a/remoting/proto/video.proto b/remoting/proto/video.proto index b193461c..e1cf5cf 100644 --- a/remoting/proto/video.proto +++ b/remoting/proto/video.proto @@ -10,15 +10,6 @@ option optimize_for = LITE_RUNTIME; package remoting; -// A message that gets sent to the client after the client is connected to the -// host. It contains information that the client needs to know about the host. -// NEXT ID: 3 -// TODO(sergeyu): Move to the control channel. -message InitClientMessage { - required int32 width = 1; - required int32 height = 2; -} - // TODO(ajwong): Determine if these fields should be optional or required. message VideoPacketFormat { // Identifies how the image was encoded. diff --git a/remoting/protocol/client_control_sender.cc b/remoting/protocol/client_control_sender.cc index 8fff967..d1fd2f5 100644 --- a/remoting/protocol/client_control_sender.cc +++ b/remoting/protocol/client_control_sender.cc @@ -10,6 +10,7 @@ #include "base/task.h" #include "remoting/protocol/buffered_socket_writer.h" #include "remoting/proto/control.pb.h" +#include "remoting/proto/internal.pb.h" #include "remoting/protocol/util.h" namespace remoting { @@ -25,7 +26,7 @@ ClientControlSender::~ClientControlSender() { void ClientControlSender::NotifyResolution( const NotifyResolutionRequest* msg, Task* done) { - ControlMessage message; + protocol::ControlMessage message; message.mutable_notify_resolution()->CopyFrom(*msg); buffered_writer_->Write(SerializeAndFrameMessage(message)); done->Run(); diff --git a/remoting/protocol/host_message_dispatcher.cc b/remoting/protocol/host_message_dispatcher.cc index 13fa803..eec734c 100644 --- a/remoting/protocol/host_message_dispatcher.cc +++ b/remoting/protocol/host_message_dispatcher.cc @@ -6,6 +6,7 @@ #include "net/base/io_buffer.h" #include "remoting/proto/control.pb.h" #include "remoting/proto/event.pb.h" +#include "remoting/proto/internal.pb.h" #include "remoting/protocol/host_message_dispatcher.h" #include "remoting/protocol/host_stub.h" #include "remoting/protocol/input_stub.h" diff --git a/remoting/protocol/host_message_dispatcher.h b/remoting/protocol/host_message_dispatcher.h index c8b7a39..0a9aa5e 100644 --- a/remoting/protocol/host_message_dispatcher.h +++ b/remoting/protocol/host_message_dispatcher.h @@ -12,12 +12,12 @@ namespace remoting { class EventMessage; -class MessageReader; namespace protocol { class ControlMessage; class HostStub; +class MessageReader; class InputStub; class Session; diff --git a/remoting/protocol/input_stub.h b/remoting/protocol/input_stub.h index c36ff07..8b89c7a 100644 --- a/remoting/protocol/input_stub.h +++ b/remoting/protocol/input_stub.h @@ -11,12 +11,11 @@ class Task; namespace remoting { +namespace protocol { class KeyEvent; class MouseEvent; -namespace protocol { - class InputStub { public: InputStub() {} diff --git a/remoting/protocol/message_decoder.cc b/remoting/protocol/message_decoder.cc index cf44d45..09f331a 100644 --- a/remoting/protocol/message_decoder.cc +++ b/remoting/protocol/message_decoder.cc @@ -11,6 +11,7 @@ #include "third_party/libjingle/source/talk/base/byteorder.h" namespace remoting { +namespace protocol { MessageDecoder::MessageDecoder() : next_payload_(0), @@ -64,4 +65,5 @@ bool MessageDecoder::GetPayloadSize(int* size) { return true; } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/message_decoder.h b/remoting/protocol/message_decoder.h index d2ba80a..8b521fe 100644 --- a/remoting/protocol/message_decoder.h +++ b/remoting/protocol/message_decoder.h @@ -15,6 +15,7 @@ #include "third_party/protobuf/src/google/protobuf/message_lite.h" namespace remoting { +namespace protocol { // MessageDecoder uses CompoundBuffer to decode bytes into protocol // buffer messages. This can be used to decode bytes received from the @@ -87,6 +88,7 @@ class MessageDecoder { bool next_payload_known_; }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_MESSAGES_DECODER_H_ diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc index d237f49..d85c37b 100644 --- a/remoting/protocol/message_decoder_unittest.cc +++ b/remoting/protocol/message_decoder_unittest.cc @@ -12,6 +12,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace remoting { +namespace protocol { static const int kTestKey = 142; @@ -105,4 +106,5 @@ TEST(MessageDecoderTest, EmptyReads) { SimulateReadSequence(kReads, arraysize(kReads)); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/message_reader.cc b/remoting/protocol/message_reader.cc index ce0ca0f..75b14f2 100644 --- a/remoting/protocol/message_reader.cc +++ b/remoting/protocol/message_reader.cc @@ -12,6 +12,7 @@ #include "remoting/proto/internal.pb.h" namespace remoting { +namespace protocol { static const int kReadBufferSize = 4096; @@ -65,4 +66,5 @@ void MessageReader::HandleReadResult(int result) { } } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/message_reader.h b/remoting/protocol/message_reader.h index 93a7f92..8522630 100644 --- a/remoting/protocol/message_reader.h +++ b/remoting/protocol/message_reader.h @@ -18,8 +18,8 @@ class Socket; } // namespace net namespace remoting { +namespace protocol { -class ChromotocolConnection; class MessageReader; namespace internal { @@ -27,7 +27,7 @@ namespace internal { template <class T> class MessageReaderPrivate { private: - friend class remoting::MessageReader; + friend class remoting::protocol::MessageReader; typedef typename Callback1<T*>::Type MessageReceivedCallback; @@ -102,6 +102,7 @@ class MessageReader { scoped_ptr<Callback0::Type> destruction_callback_; }; +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_MESSAGE_READER_H_ diff --git a/remoting/protocol/util.cc b/remoting/protocol/util.cc index cfb9001..9dfa016 100644 --- a/remoting/protocol/util.cc +++ b/remoting/protocol/util.cc @@ -20,6 +20,7 @@ void DeleteMessage(google::protobuf::MessageLite* message) { } // namespace namespace remoting { +namespace protocol { scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( const google::protobuf::MessageLite& msg) { @@ -38,4 +39,5 @@ Task* NewDeleteMessageTask(google::protobuf::MessageLite* message) { return NewRunnableFunction(&DeleteMessage, message); } +} // namespace protocol } // namespace remoting diff --git a/remoting/protocol/util.h b/remoting/protocol/util.h index d8435b3..53e1f67 100644 --- a/remoting/protocol/util.h +++ b/remoting/protocol/util.h @@ -14,6 +14,7 @@ class Task; namespace remoting { +namespace protocol { // Serialize the Protocol Buffer message and provide sufficient framing for // sending it over the wire. @@ -25,6 +26,7 @@ scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( // Create a runnable task that deletes a message. Task* NewDeleteMessageTask(google::protobuf::MessageLite* message); +} // namespace protocol } // namespace remoting #endif // REMOTING_PROTOCOL_UTIL_H_ |