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

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

Issue 22477006: Added JsonMessage to the control channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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/client_control_dispatcher.h ('k') | remoting/protocol/client_stub.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/client_control_dispatcher.h" 5 #include "remoting/protocol/client_control_dispatcher.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "net/socket/stream_socket.h" 10 #include "net/socket/stream_socket.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); 67 writer_.Write(SerializeAndFrameMessage(message), base::Closure());
68 } 68 }
69 69
70 void ClientControlDispatcher::RequestPairing( 70 void ClientControlDispatcher::RequestPairing(
71 const PairingRequest& pairing_request) { 71 const PairingRequest& pairing_request) {
72 ControlMessage message; 72 ControlMessage message;
73 message.mutable_pairing_request()->CopyFrom(pairing_request); 73 message.mutable_pairing_request()->CopyFrom(pairing_request);
74 writer_.Write(SerializeAndFrameMessage(message), base::Closure()); 74 writer_.Write(SerializeAndFrameMessage(message), base::Closure());
75 } 75 }
76 76
77 void ClientControlDispatcher::DeliverClientMessage(
78 const ExtensionMessage& message) {
79 ControlMessage control_message;
80 control_message.mutable_extension_message()->CopyFrom(message);
81 writer_.Write(SerializeAndFrameMessage(control_message), base::Closure());
82 }
83
77 void ClientControlDispatcher::OnMessageReceived( 84 void ClientControlDispatcher::OnMessageReceived(
78 scoped_ptr<ControlMessage> message, const base::Closure& done_task) { 85 scoped_ptr<ControlMessage> message, const base::Closure& done_task) {
79 DCHECK(client_stub_); 86 DCHECK(client_stub_);
80 DCHECK(clipboard_stub_); 87 DCHECK(clipboard_stub_);
81 base::ScopedClosureRunner done_runner(done_task); 88 base::ScopedClosureRunner done_runner(done_task);
82 89
83 if (message->has_clipboard_event()) { 90 if (message->has_clipboard_event()) {
84 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); 91 clipboard_stub_->InjectClipboardEvent(message->clipboard_event());
85 } else if (message->has_capabilities()) { 92 } else if (message->has_capabilities()) {
86 client_stub_->SetCapabilities(message->capabilities()); 93 client_stub_->SetCapabilities(message->capabilities());
87 } else if (message->has_cursor_shape()) { 94 } else if (message->has_cursor_shape()) {
88 client_stub_->SetCursorShape(message->cursor_shape()); 95 client_stub_->SetCursorShape(message->cursor_shape());
89 } else if (message->has_pairing_response()) { 96 } else if (message->has_pairing_response()) {
90 client_stub_->SetPairingResponse(message->pairing_response()); 97 client_stub_->SetPairingResponse(message->pairing_response());
98 } else if (message->has_extension_message()) {
99 client_stub_->DeliverHostMessage(message->extension_message());
91 } else { 100 } else {
92 LOG(WARNING) << "Unknown control message received."; 101 LOG(WARNING) << "Unknown control message received.";
93 } 102 }
94 } 103 }
95 104
96 } // namespace protocol 105 } // namespace protocol
97 } // namespace remoting 106 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/client_control_dispatcher.h ('k') | remoting/protocol/client_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698