OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/connection_to_client.h" | 5 #include "remoting/protocol/connection_to_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "remoting/protocol/clipboard_stub.h" | 10 #include "remoting/protocol/clipboard_stub.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 void ConnectionToClient::Disconnect() { | 39 void ConnectionToClient::Disconnect() { |
40 DCHECK(CalledOnValidThread()); | 40 DCHECK(CalledOnValidThread()); |
41 | 41 |
42 CloseChannels(); | 42 CloseChannels(); |
43 | 43 |
44 // This should trigger OnConnectionClosed() event and this object | 44 // This should trigger OnConnectionClosed() event and this object |
45 // may be destroyed as the result. | 45 // may be destroyed as the result. |
46 session_->Close(); | 46 session_->Close(); |
47 } | 47 } |
48 | 48 |
49 void ConnectionToClient::OnEventTimestamp(int64 sequence_number) { | 49 void ConnectionToClient::OnInputEventReceived(int64_t timestamp) { |
50 DCHECK(CalledOnValidThread()); | 50 DCHECK(CalledOnValidThread()); |
51 handler_->OnEventTimestamp(this, sequence_number); | 51 handler_->OnInputEventReceived(this, timestamp); |
52 } | 52 } |
53 | 53 |
54 VideoStub* ConnectionToClient::video_stub() { | 54 VideoStub* ConnectionToClient::video_stub() { |
55 DCHECK(CalledOnValidThread()); | 55 DCHECK(CalledOnValidThread()); |
56 return video_dispatcher_.get(); | 56 return video_dispatcher_.get(); |
57 } | 57 } |
58 | 58 |
59 AudioStub* ConnectionToClient::audio_stub() { | 59 AudioStub* ConnectionToClient::audio_stub() { |
60 DCHECK(CalledOnValidThread()); | 60 DCHECK(CalledOnValidThread()); |
61 return audio_writer_.get(); | 61 return audio_writer_.get(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 break; | 105 break; |
106 case Session::AUTHENTICATED: | 106 case Session::AUTHENTICATED: |
107 // Initialize channels. | 107 // Initialize channels. |
108 control_dispatcher_.reset(new HostControlDispatcher()); | 108 control_dispatcher_.reset(new HostControlDispatcher()); |
109 control_dispatcher_->Init(session_.get(), | 109 control_dispatcher_->Init(session_.get(), |
110 session_->config().control_config(), this); | 110 session_->config().control_config(), this); |
111 | 111 |
112 event_dispatcher_.reset(new HostEventDispatcher()); | 112 event_dispatcher_.reset(new HostEventDispatcher()); |
113 event_dispatcher_->Init(session_.get(), session_->config().event_config(), | 113 event_dispatcher_->Init(session_.get(), session_->config().event_config(), |
114 this); | 114 this); |
115 event_dispatcher_->set_event_timestamp_callback(base::Bind( | 115 event_dispatcher_->set_on_input_event_callback(base::Bind( |
116 &ConnectionToClient::OnEventTimestamp, base::Unretained(this))); | 116 &ConnectionToClient::OnInputEventReceived, base::Unretained(this))); |
117 | 117 |
118 video_dispatcher_.reset(new HostVideoDispatcher()); | 118 video_dispatcher_.reset(new HostVideoDispatcher()); |
119 video_dispatcher_->Init(session_.get(), session_->config().video_config(), | 119 video_dispatcher_->Init(session_.get(), session_->config().video_config(), |
120 this); | 120 this); |
121 | 121 |
122 audio_writer_ = AudioWriter::Create(session_->config()); | 122 audio_writer_ = AudioWriter::Create(session_->config()); |
123 if (audio_writer_.get()) { | 123 if (audio_writer_.get()) { |
124 audio_writer_->Init(session_.get(), session_->config().audio_config(), | 124 audio_writer_->Init(session_.get(), session_->config().audio_config(), |
125 this); | 125 this); |
126 } | 126 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 void ConnectionToClient::CloseChannels() { | 187 void ConnectionToClient::CloseChannels() { |
188 control_dispatcher_.reset(); | 188 control_dispatcher_.reset(); |
189 event_dispatcher_.reset(); | 189 event_dispatcher_.reset(); |
190 video_dispatcher_.reset(); | 190 video_dispatcher_.reset(); |
191 audio_writer_.reset(); | 191 audio_writer_.reset(); |
192 } | 192 } |
193 | 193 |
194 } // namespace protocol | 194 } // namespace protocol |
195 } // namespace remoting | 195 } // namespace remoting |
OLD | NEW |