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

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

Issue 9921034: [Chromoting] Add plumbing to carry clipboard events from the host to the client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 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
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | no next file » | 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_control_dispatcher.h" 5 #include "remoting/protocol/host_control_dispatcher.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.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/control.pb.h" 10 #include "remoting/proto/control.pb.h"
(...skipping 16 matching lines...) Expand all
27 HostControlDispatcher::~HostControlDispatcher() { 27 HostControlDispatcher::~HostControlDispatcher() {
28 writer_->Close(); 28 writer_->Close();
29 } 29 }
30 30
31 void HostControlDispatcher::OnInitialized() { 31 void HostControlDispatcher::OnInitialized() {
32 reader_.Init(channel(), base::Bind( 32 reader_.Init(channel(), base::Bind(
33 &HostControlDispatcher::OnMessageReceived, base::Unretained(this))); 33 &HostControlDispatcher::OnMessageReceived, base::Unretained(this)));
34 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback()); 34 writer_->Init(channel(), BufferedSocketWriter::WriteFailedCallback());
35 } 35 }
36 36
37 void HostControlDispatcher::InjectClipboardEvent(const ClipboardEvent& event) {
38 ControlMessage message;
39 message.mutable_clipboard_event()->CopyFrom(event);
40 writer_->Write(SerializeAndFrameMessage(message), base::Closure());
41 }
42
37 void HostControlDispatcher::OnMessageReceived( 43 void HostControlDispatcher::OnMessageReceived(
38 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { 44 scoped_ptr<ControlMessage> message, const base::Closure& done_task) {
39 DCHECK(clipboard_stub_); 45 DCHECK(clipboard_stub_);
40 DCHECK(host_stub_); 46 DCHECK(host_stub_);
41 47
42 base::ScopedClosureRunner done_runner(done_task); 48 base::ScopedClosureRunner done_runner(done_task);
43 49
44 if (message->has_clipboard_event()) { 50 if (message->has_clipboard_event()) {
45 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); 51 clipboard_stub_->InjectClipboardEvent(message->clipboard_event());
46 } else { 52 } else {
47 LOG(WARNING) << "Unknown control message received."; 53 LOG(WARNING) << "Unknown control message received.";
48 } 54 }
49 } 55 }
50 56
51 } // namespace protocol 57 } // namespace protocol
52 } // namespace remoting 58 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/host_control_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698