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/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "remoting/client/chromoting_client.h" | 30 #include "remoting/client/chromoting_client.h" |
31 #include "remoting/client/frame_consumer_proxy.h" | 31 #include "remoting/client/frame_consumer_proxy.h" |
32 #include "remoting/client/mouse_input_filter.h" | 32 #include "remoting/client/mouse_input_filter.h" |
33 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 33 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
34 #include "remoting/client/plugin/pepper_input_handler.h" | 34 #include "remoting/client/plugin/pepper_input_handler.h" |
35 #include "remoting/client/plugin/pepper_view.h" | 35 #include "remoting/client/plugin/pepper_view.h" |
36 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 36 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
37 #include "remoting/client/rectangle_update_decoder.h" | 37 #include "remoting/client/rectangle_update_decoder.h" |
38 #include "remoting/protocol/connection_to_host.h" | 38 #include "remoting/protocol/connection_to_host.h" |
39 #include "remoting/protocol/host_stub.h" | 39 #include "remoting/protocol/host_stub.h" |
40 #include "remoting/protocol/key_event_tracker.h" | 40 #include "remoting/protocol/input_event_tracker.h" |
41 | 41 |
42 // Windows defines 'PostMessage', so we have to undef it. | 42 // Windows defines 'PostMessage', so we have to undef it. |
43 #if defined(PostMessage) | 43 #if defined(PostMessage) |
44 #undef PostMessage | 44 #undef PostMessage |
45 #endif | 45 #endif |
46 | 46 |
47 namespace remoting { | 47 namespace remoting { |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 host_connection_.reset(new protocol::ConnectionToHost( | 331 host_connection_.reset(new protocol::ConnectionToHost( |
332 context_.network_message_loop(), this, true)); | 332 context_.network_message_loop(), this, true)); |
333 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), | 333 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), |
334 view_.get(), rectangle_decoder_.get(), | 334 view_.get(), rectangle_decoder_.get(), |
335 base::Closure())); | 335 base::Closure())); |
336 | 336 |
337 // Construct the input pipeline | 337 // Construct the input pipeline |
338 mouse_input_filter_.reset( | 338 mouse_input_filter_.reset( |
339 new MouseInputFilter(host_connection_->input_stub())); | 339 new MouseInputFilter(host_connection_->input_stub())); |
340 mouse_input_filter_->set_input_size(view_->get_view_size()); | 340 mouse_input_filter_->set_input_size(view_->get_view_size()); |
341 key_event_tracker_.reset( | 341 input_tracker_.reset( |
342 new protocol::KeyEventTracker(mouse_input_filter_.get())); | 342 new protocol::InputEventTracker(mouse_input_filter_.get())); |
343 input_handler_.reset( | 343 input_handler_.reset( |
344 new PepperInputHandler(key_event_tracker_.get())); | 344 new PepperInputHandler(input_tracker_.get())); |
345 | 345 |
346 LOG(INFO) << "Connecting to " << config.host_jid | 346 LOG(INFO) << "Connecting to " << config.host_jid |
347 << ". Local jid: " << config.local_jid << "."; | 347 << ". Local jid: " << config.local_jid << "."; |
348 | 348 |
349 // Setup the XMPP Proxy. | 349 // Setup the XMPP Proxy. |
350 xmpp_proxy_ = new PepperXmppProxy( | 350 xmpp_proxy_ = new PepperXmppProxy( |
351 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), | 351 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), |
352 plugin_message_loop_, | 352 plugin_message_loop_, |
353 context_.network_message_loop()); | 353 context_.network_message_loop()); |
354 | 354 |
(...skipping 16 matching lines...) Expand all Loading... |
371 if (client_.get()) { | 371 if (client_.get()) { |
372 // TODO(sergeyu): Should we disconnect asynchronously? | 372 // TODO(sergeyu): Should we disconnect asynchronously? |
373 base::WaitableEvent done_event(true, false); | 373 base::WaitableEvent done_event(true, false); |
374 client_->Stop(base::Bind(&base::WaitableEvent::Signal, | 374 client_->Stop(base::Bind(&base::WaitableEvent::Signal, |
375 base::Unretained(&done_event))); | 375 base::Unretained(&done_event))); |
376 done_event.Wait(); | 376 done_event.Wait(); |
377 client_.reset(); | 377 client_.reset(); |
378 } | 378 } |
379 | 379 |
380 input_handler_.reset(); | 380 input_handler_.reset(); |
381 key_event_tracker_.reset(); | 381 input_tracker_.reset(); |
382 mouse_input_filter_.reset(); | 382 mouse_input_filter_.reset(); |
383 host_connection_.reset(); | 383 host_connection_.reset(); |
384 | 384 |
385 SetConnectionState(STATE_CLOSED, ERROR_NONE); | 385 SetConnectionState(STATE_CLOSED, ERROR_NONE); |
386 } | 386 } |
387 | 387 |
388 void ChromotingInstance::OnIncomingIq(const std::string& iq) { | 388 void ChromotingInstance::OnIncomingIq(const std::string& iq) { |
389 xmpp_proxy_->OnIq(iq); | 389 xmpp_proxy_->OnIq(iq); |
390 } | 390 } |
391 | 391 |
392 void ChromotingInstance::ReleaseAllKeys() { | 392 void ChromotingInstance::ReleaseAllKeys() { |
393 if (key_event_tracker_.get()) { | 393 if (input_tracker_.get()) { |
394 key_event_tracker_->ReleaseAllKeys(); | 394 input_tracker_->ReleaseAll(); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 ChromotingStats* ChromotingInstance::GetStats() { | 398 ChromotingStats* ChromotingInstance::GetStats() { |
399 if (!client_.get()) | 399 if (!client_.get()) |
400 return NULL; | 400 return NULL; |
401 return client_->GetStats(); | 401 return client_->GetStats(); |
402 } | 402 } |
403 | 403 |
404 void ChromotingInstance::PostChromotingMessage( | 404 void ChromotingInstance::PostChromotingMessage( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 536 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
537 data->SetString("message", message); | 537 data->SetString("message", message); |
538 PostChromotingMessage("logDebugMessage", data.Pass()); | 538 PostChromotingMessage("logDebugMessage", data.Pass()); |
539 | 539 |
540 scriptable_object->LogDebugInfo(message); | 540 scriptable_object->LogDebugInfo(message); |
541 } | 541 } |
542 g_logging_to_plugin = false; | 542 g_logging_to_plugin = false; |
543 } | 543 } |
544 | 544 |
545 } // namespace remoting | 545 } // namespace remoting |
OLD | NEW |