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 20 matching lines...) Expand all Loading... |
31 #include "remoting/client/chromoting_client.h" | 31 #include "remoting/client/chromoting_client.h" |
32 #include "remoting/client/frame_consumer_proxy.h" | 32 #include "remoting/client/frame_consumer_proxy.h" |
33 #include "remoting/client/mouse_input_filter.h" | 33 #include "remoting/client/mouse_input_filter.h" |
34 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 34 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
35 #include "remoting/client/plugin/pepper_input_handler.h" | 35 #include "remoting/client/plugin/pepper_input_handler.h" |
36 #include "remoting/client/plugin/pepper_view.h" | 36 #include "remoting/client/plugin/pepper_view.h" |
37 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 37 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
38 #include "remoting/client/rectangle_update_decoder.h" | 38 #include "remoting/client/rectangle_update_decoder.h" |
39 #include "remoting/protocol/connection_to_host.h" | 39 #include "remoting/protocol/connection_to_host.h" |
40 #include "remoting/protocol/host_stub.h" | 40 #include "remoting/protocol/host_stub.h" |
41 #include "remoting/protocol/key_event_tracker.h" | 41 #include "remoting/protocol/input_event_tracker.h" |
42 | 42 |
43 // Windows defines 'PostMessage', so we have to undef it. | 43 // Windows defines 'PostMessage', so we have to undef it. |
44 #if defined(PostMessage) | 44 #if defined(PostMessage) |
45 #undef PostMessage | 45 #undef PostMessage |
46 #endif | 46 #endif |
47 | 47 |
48 namespace remoting { | 48 namespace remoting { |
49 | 49 |
50 namespace { | 50 namespace { |
51 | 51 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 host_connection_.reset(new protocol::ConnectionToHost( | 356 host_connection_.reset(new protocol::ConnectionToHost( |
357 context_.network_message_loop(), this, true)); | 357 context_.network_message_loop(), this, true)); |
358 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), | 358 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), |
359 view_.get(), rectangle_decoder_.get(), | 359 view_.get(), rectangle_decoder_.get(), |
360 base::Closure())); | 360 base::Closure())); |
361 | 361 |
362 // Construct the input pipeline | 362 // Construct the input pipeline |
363 mouse_input_filter_.reset( | 363 mouse_input_filter_.reset( |
364 new MouseInputFilter(host_connection_->input_stub())); | 364 new MouseInputFilter(host_connection_->input_stub())); |
365 mouse_input_filter_->set_input_size(view_->get_view_size()); | 365 mouse_input_filter_->set_input_size(view_->get_view_size()); |
366 key_event_tracker_.reset( | 366 input_tracker_.reset( |
367 new protocol::KeyEventTracker(mouse_input_filter_.get())); | 367 new protocol::InputEventTracker(mouse_input_filter_.get())); |
368 input_handler_.reset( | 368 input_handler_.reset( |
369 new PepperInputHandler(key_event_tracker_.get())); | 369 new PepperInputHandler(input_tracker_.get())); |
370 | 370 |
371 LOG(INFO) << "Connecting to " << config.host_jid | 371 LOG(INFO) << "Connecting to " << config.host_jid |
372 << ". Local jid: " << config.local_jid << "."; | 372 << ". Local jid: " << config.local_jid << "."; |
373 | 373 |
374 // Setup the XMPP Proxy. | 374 // Setup the XMPP Proxy. |
375 xmpp_proxy_ = new PepperXmppProxy( | 375 xmpp_proxy_ = new PepperXmppProxy( |
376 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), | 376 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), |
377 plugin_message_loop_, | 377 plugin_message_loop_, |
378 context_.network_message_loop()); | 378 context_.network_message_loop()); |
379 | 379 |
(...skipping 16 matching lines...) Expand all Loading... |
396 if (client_.get()) { | 396 if (client_.get()) { |
397 // TODO(sergeyu): Should we disconnect asynchronously? | 397 // TODO(sergeyu): Should we disconnect asynchronously? |
398 base::WaitableEvent done_event(true, false); | 398 base::WaitableEvent done_event(true, false); |
399 client_->Stop(base::Bind(&base::WaitableEvent::Signal, | 399 client_->Stop(base::Bind(&base::WaitableEvent::Signal, |
400 base::Unretained(&done_event))); | 400 base::Unretained(&done_event))); |
401 done_event.Wait(); | 401 done_event.Wait(); |
402 client_.reset(); | 402 client_.reset(); |
403 } | 403 } |
404 | 404 |
405 input_handler_.reset(); | 405 input_handler_.reset(); |
406 key_event_tracker_.reset(); | 406 input_tracker_.reset(); |
407 mouse_input_filter_.reset(); | 407 mouse_input_filter_.reset(); |
408 host_connection_.reset(); | 408 host_connection_.reset(); |
409 | 409 |
410 SetConnectionState(STATE_CLOSED, ERROR_NONE); | 410 SetConnectionState(STATE_CLOSED, ERROR_NONE); |
411 } | 411 } |
412 | 412 |
413 void ChromotingInstance::OnIncomingIq(const std::string& iq) { | 413 void ChromotingInstance::OnIncomingIq(const std::string& iq) { |
414 xmpp_proxy_->OnIq(iq); | 414 xmpp_proxy_->OnIq(iq); |
415 } | 415 } |
416 | 416 |
417 void ChromotingInstance::ReleaseAllKeys() { | 417 void ChromotingInstance::ReleaseAllKeys() { |
418 if (key_event_tracker_.get()) | 418 if (input_tracker_.get()) |
419 key_event_tracker_->ReleaseAllKeys(); | 419 input_tracker_->ReleaseAll(); |
420 } | 420 } |
421 | 421 |
422 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { | 422 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { |
423 if (key_event_tracker_.get()) | 423 if (input_tracker_.get()) |
424 key_event_tracker_->InjectKeyEvent(event); | 424 input_tracker_->InjectKeyEvent(event); |
425 } | 425 } |
426 | 426 |
427 void ChromotingInstance::SendClipboardItem(const std::string& mime_type, | 427 void ChromotingInstance::SendClipboardItem(const std::string& mime_type, |
428 const std::string& item) { | 428 const std::string& item) { |
429 // TODO(simonmorris): Plumb this in to a ClipboardStub. | 429 // TODO(simonmorris): Plumb this in to a ClipboardStub. |
430 } | 430 } |
431 | 431 |
432 ChromotingStats* ChromotingInstance::GetStats() { | 432 ChromotingStats* ChromotingInstance::GetStats() { |
433 if (!client_.get()) | 433 if (!client_.get()) |
434 return NULL; | 434 return NULL; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 570 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
571 data->SetString("message", message); | 571 data->SetString("message", message); |
572 PostChromotingMessage("logDebugMessage", data.Pass()); | 572 PostChromotingMessage("logDebugMessage", data.Pass()); |
573 | 573 |
574 scriptable_object->LogDebugInfo(message); | 574 scriptable_object->LogDebugInfo(message); |
575 } | 575 } |
576 g_logging_to_plugin = false; | 576 g_logging_to_plugin = false; |
577 } | 577 } |
578 | 578 |
579 } // namespace remoting | 579 } // namespace remoting |
OLD | NEW |