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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 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
« no previous file with comments | « remoting/protocol/host_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('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 (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 "net/socket/stream_socket.h" 7 #include "net/socket/stream_socket.h"
8 #include "remoting/base/compound_buffer.h" 8 #include "remoting/base/compound_buffer.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"
11 #include "remoting/proto/internal.pb.h" 11 #include "remoting/proto/internal.pb.h"
12 #include "remoting/protocol/input_stub.h" 12 #include "remoting/protocol/input_stub.h"
13 #include "remoting/protocol/message_serialization.h" 13 #include "remoting/protocol/message_serialization.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 namespace protocol { 16 namespace protocol {
17 17
18 HostEventDispatcher::HostEventDispatcher() 18 HostEventDispatcher::HostEventDispatcher()
19 : ChannelDispatcherBase(kEventChannelName) {} 19 : ChannelDispatcherBase(kEventChannelName) {}
20 HostEventDispatcher::~HostEventDispatcher() {} 20 HostEventDispatcher::~HostEventDispatcher() {}
21 21
22 void HostEventDispatcher::OnIncomingMessage(scoped_ptr<CompoundBuffer> buffer) { 22 void HostEventDispatcher::OnIncomingMessage(
23 std::unique_ptr<CompoundBuffer> buffer) {
23 DCHECK(input_stub_); 24 DCHECK(input_stub_);
24 25
25 scoped_ptr<EventMessage> message = ParseMessage<EventMessage>(buffer.get()); 26 std::unique_ptr<EventMessage> message =
27 ParseMessage<EventMessage>(buffer.get());
26 if (!message) 28 if (!message)
27 return; 29 return;
28 30
29 if (!on_input_event_callback_.is_null()) 31 if (!on_input_event_callback_.is_null())
30 on_input_event_callback_.Run(message->timestamp()); 32 on_input_event_callback_.Run(message->timestamp());
31 33
32 if (message->has_key_event()) { 34 if (message->has_key_event()) {
33 const KeyEvent& event = message->key_event(); 35 const KeyEvent& event = message->key_event();
34 if (event.has_usb_keycode() && event.has_pressed()) { 36 if (event.has_usb_keycode() && event.has_pressed()) {
35 input_stub_->InjectKeyEvent(event); 37 input_stub_->InjectKeyEvent(event);
(...skipping 11 matching lines...) Expand all
47 input_stub_->InjectMouseEvent(message->mouse_event()); 49 input_stub_->InjectMouseEvent(message->mouse_event());
48 } else if (message->has_touch_event()) { 50 } else if (message->has_touch_event()) {
49 input_stub_->InjectTouchEvent(message->touch_event()); 51 input_stub_->InjectTouchEvent(message->touch_event());
50 } else { 52 } else {
51 LOG(WARNING) << "Unknown event message received."; 53 LOG(WARNING) << "Unknown event message received.";
52 } 54 }
53 } 55 }
54 56
55 } // namespace protocol 57 } // namespace protocol
56 } // namespace remoting 58 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/host_event_dispatcher.h ('k') | remoting/protocol/host_video_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698