OLD | NEW |
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/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 "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "google/protobuf/message.h" | 10 #include "google/protobuf/message.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 DCHECK(handler_); | 96 DCHECK(handler_); |
97 switch(state) { | 97 switch(state) { |
98 case Session::INITIALIZING: | 98 case Session::INITIALIZING: |
99 case Session::CONNECTING: | 99 case Session::CONNECTING: |
100 case Session::CONNECTED: | 100 case Session::CONNECTED: |
101 // Don't care about these events. | 101 // Don't care about these events. |
102 break; | 102 break; |
103 | 103 |
104 case Session::AUTHENTICATED: | 104 case Session::AUTHENTICATED: |
105 handler_->OnConnectionAuthenticated(this); | |
106 | |
107 // Initialize channels. | 105 // Initialize channels. |
108 control_dispatcher_.reset(new HostControlDispatcher()); | 106 control_dispatcher_.reset(new HostControlDispatcher()); |
109 control_dispatcher_->Init(session_.get(), base::Bind( | 107 control_dispatcher_->Init(session_.get(), base::Bind( |
110 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); | 108 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
111 control_dispatcher_->set_clipboard_stub(clipboard_stub_); | 109 control_dispatcher_->set_clipboard_stub(clipboard_stub_); |
112 control_dispatcher_->set_host_stub(host_stub_); | 110 control_dispatcher_->set_host_stub(host_stub_); |
113 | 111 |
114 event_dispatcher_.reset(new HostEventDispatcher()); | 112 event_dispatcher_.reset(new HostEventDispatcher()); |
115 event_dispatcher_->Init(session_.get(), base::Bind( | 113 event_dispatcher_->Init(session_.get(), base::Bind( |
116 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); | 114 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
117 event_dispatcher_->set_input_stub(input_stub_); | 115 event_dispatcher_->set_input_stub(input_stub_); |
118 event_dispatcher_->set_sequence_number_callback(base::Bind( | 116 event_dispatcher_->set_sequence_number_callback(base::Bind( |
119 &ConnectionToClient::UpdateSequenceNumber, base::Unretained(this))); | 117 &ConnectionToClient::UpdateSequenceNumber, base::Unretained(this))); |
120 | 118 |
121 video_writer_.reset(VideoWriter::Create( | 119 video_writer_.reset(VideoWriter::Create( |
122 base::MessageLoopProxy::current(), session_->config())); | 120 base::MessageLoopProxy::current(), session_->config())); |
123 video_writer_->Init(session_.get(), base::Bind( | 121 video_writer_->Init(session_.get(), base::Bind( |
124 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); | 122 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
125 | 123 |
| 124 // Notify the handler after initializing the channels, so that |
| 125 // ClientSession can get a client clipboard stub. |
| 126 handler_->OnConnectionAuthenticated(this); |
126 break; | 127 break; |
127 | 128 |
128 case Session::CLOSED: | 129 case Session::CLOSED: |
129 Close(OK); | 130 Close(OK); |
130 break; | 131 break; |
131 | 132 |
132 case Session::FAILED: | 133 case Session::FAILED: |
133 Close(session_->error()); | 134 Close(session_->error()); |
134 break; | 135 break; |
135 } | 136 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 170 } |
170 | 171 |
171 void ConnectionToClient::CloseChannels() { | 172 void ConnectionToClient::CloseChannels() { |
172 control_dispatcher_.reset(); | 173 control_dispatcher_.reset(); |
173 event_dispatcher_.reset(); | 174 event_dispatcher_.reset(); |
174 video_writer_.reset(); | 175 video_writer_.reset(); |
175 } | 176 } |
176 | 177 |
177 } // namespace protocol | 178 } // namespace protocol |
178 } // namespace remoting | 179 } // namespace remoting |
OLD | NEW |