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

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

Issue 14715012: Protocol-level changes required to support PIN-less authentication. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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_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"
11 #include "remoting/proto/internal.pb.h" 11 #include "remoting/proto/internal.pb.h"
12 #include "remoting/protocol/clipboard_stub.h" 12 #include "remoting/protocol/clipboard_stub.h"
13 #include "remoting/protocol/host_stub.h" 13 #include "remoting/protocol/host_stub.h"
14 #include "remoting/protocol/util.h" 14 #include "remoting/protocol/util.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 namespace protocol { 17 namespace protocol {
18 18
19 HostControlDispatcher::HostControlDispatcher() 19 HostControlDispatcher::HostControlDispatcher()
20 : ChannelDispatcherBase(kControlChannelName), 20 : ChannelDispatcherBase(kControlChannelName),
21 clipboard_stub_(NULL), 21 clipboard_stub_(NULL),
22 host_stub_(NULL) { 22 host_stub_(NULL),
23 weak_factory_(this) {
23 } 24 }
24 25
25 HostControlDispatcher::~HostControlDispatcher() { 26 HostControlDispatcher::~HostControlDispatcher() {
26 writer_.Close(); 27 writer_.Close();
27 } 28 }
28 29
29 void HostControlDispatcher::OnInitialized() { 30 void HostControlDispatcher::OnInitialized() {
30 reader_.Init(channel(), base::Bind( 31 reader_.Init(channel(), base::Bind(
31 &HostControlDispatcher::OnMessageReceived, base::Unretained(this))); 32 &HostControlDispatcher::OnMessageReceived, base::Unretained(this)));
32 writer_.Init(channel(), BufferedSocketWriter::WriteFailedCallback()); 33 writer_.Init(channel(), BufferedSocketWriter::WriteFailedCallback());
(...skipping 29 matching lines...) Expand all
62 if (message->has_clipboard_event()) { 63 if (message->has_clipboard_event()) {
63 clipboard_stub_->InjectClipboardEvent(message->clipboard_event()); 64 clipboard_stub_->InjectClipboardEvent(message->clipboard_event());
64 } else if (message->has_client_resolution()) { 65 } else if (message->has_client_resolution()) {
65 host_stub_->NotifyClientResolution(message->client_resolution()); 66 host_stub_->NotifyClientResolution(message->client_resolution());
66 } else if (message->has_video_control()) { 67 } else if (message->has_video_control()) {
67 host_stub_->ControlVideo(message->video_control()); 68 host_stub_->ControlVideo(message->video_control());
68 } else if (message->has_audio_control()) { 69 } else if (message->has_audio_control()) {
69 host_stub_->ControlAudio(message->audio_control()); 70 host_stub_->ControlAudio(message->audio_control());
70 } else if (message->has_capabilities()) { 71 } else if (message->has_capabilities()) {
71 host_stub_->SetCapabilities(message->capabilities()); 72 host_stub_->SetCapabilities(message->capabilities());
73 } else if (message->has_pairing_request()) {
74 host_stub_->RequestPairing(
75 message->pairing_request(),
76 base::Bind(&HostControlDispatcher::OnPairingReply,
rmsousa 2013/05/09 03:55:02 If you don't use a bound callback you can remove t
Jamie 2013/05/09 17:59:52 Done.
77 weak_factory_.GetWeakPtr()));
72 } else { 78 } else {
73 LOG(WARNING) << "Unknown control message received."; 79 LOG(WARNING) << "Unknown control message received.";
74 } 80 }
75 } 81 }
76 82
83 void HostControlDispatcher::OnPairingReply(const PairingReply& pairing_reply) {
rmsousa 2013/05/09 03:55:02 nit: Make this a verb (RespondToPairing?), move it
Jamie 2013/05/09 17:59:52 Done.
84 ControlMessage message;
85 message.mutable_pairing_reply()->CopyFrom(pairing_reply);
86 writer_.Write(SerializeAndFrameMessage(message), base::Closure());
87 }
88
77 } // namespace protocol 89 } // namespace protocol
78 } // namespace remoting 90 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698