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(session_->config())); | 119 video_writer_.reset(VideoWriter::Create(session_->config())); |
122 video_writer_->Init(session_.get(), base::Bind( | 120 video_writer_->Init(session_.get(), base::Bind( |
123 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); | 121 &ConnectionToClient::OnChannelInitialized, base::Unretained(this))); |
124 | 122 |
| 123 // Notify the handler after initializing the channels, so that |
| 124 // ClientSession can get a client clipboard stub. |
| 125 handler_->OnConnectionAuthenticated(this); |
125 break; | 126 break; |
126 | 127 |
127 case Session::CLOSED: | 128 case Session::CLOSED: |
128 Close(OK); | 129 Close(OK); |
129 break; | 130 break; |
130 | 131 |
131 case Session::FAILED: | 132 case Session::FAILED: |
132 Close(session_->error()); | 133 Close(session_->error()); |
133 break; | 134 break; |
134 } | 135 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 169 } |
169 | 170 |
170 void ConnectionToClient::CloseChannels() { | 171 void ConnectionToClient::CloseChannels() { |
171 control_dispatcher_.reset(); | 172 control_dispatcher_.reset(); |
172 event_dispatcher_.reset(); | 173 event_dispatcher_.reset(); |
173 video_writer_.reset(); | 174 video_writer_.reset(); |
174 } | 175 } |
175 | 176 |
176 } // namespace protocol | 177 } // namespace protocol |
177 } // namespace remoting | 178 } // namespace remoting |
OLD | NEW |