| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 LOG(ERROR) << "No valid authentication methods specified."; | 161 LOG(ERROR) << "No valid authentication methods specified."; |
| 162 return false; | 162 return false; |
| 163 } | 163 } |
| 164 | 164 |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 | 167 |
| 168 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) | 168 ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) |
| 169 : pp::Instance(pp_instance), | 169 : pp::Instance(pp_instance), |
| 170 initialized_(false), | 170 initialized_(false), |
| 171 plugin_task_runner_( | 171 plugin_task_runner_(new PluginThreadTaskRunner(&plugin_thread_delegate_)), |
| 172 new PluginThreadTaskRunner(&plugin_thread_delegate_)), | 172 context_(plugin_task_runner_.get()), |
| 173 context_(plugin_task_runner_), | |
| 174 input_tracker_(&mouse_input_filter_), | 173 input_tracker_(&mouse_input_filter_), |
| 175 #if defined(OS_MACOSX) | 174 #if defined(OS_MACOSX) |
| 176 // On Mac we need an extra filter to inject missing keyup events. | 175 // On Mac we need an extra filter to inject missing keyup events. |
| 177 // See remoting/client/plugin/mac_key_event_processor.h for more details. | 176 // See remoting/client/plugin/mac_key_event_processor.h for more details. |
| 178 mac_key_event_processor_(&input_tracker_), | 177 mac_key_event_processor_(&input_tracker_), |
| 179 key_mapper_(&mac_key_event_processor_), | 178 key_mapper_(&mac_key_event_processor_), |
| 180 #else | 179 #else |
| 181 key_mapper_(&input_tracker_), | 180 key_mapper_(&input_tracker_), |
| 182 #endif | 181 #endif |
| 183 input_handler_(&key_mapper_), | 182 input_handler_(&key_mapper_), |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // Connect the input pipeline to the protocol stub & initialize components. | 638 // Connect the input pipeline to the protocol stub & initialize components. |
| 640 mouse_input_filter_.set_input_stub(host_connection_->input_stub()); | 639 mouse_input_filter_.set_input_stub(host_connection_->input_stub()); |
| 641 mouse_input_filter_.set_input_size(view_->get_view_size_dips()); | 640 mouse_input_filter_.set_input_size(view_->get_view_size_dips()); |
| 642 | 641 |
| 643 LOG(INFO) << "Connecting to " << config.host_jid | 642 LOG(INFO) << "Connecting to " << config.host_jid |
| 644 << ". Local jid: " << config.local_jid << "."; | 643 << ". Local jid: " << config.local_jid << "."; |
| 645 | 644 |
| 646 // Setup the XMPP Proxy. | 645 // Setup the XMPP Proxy. |
| 647 xmpp_proxy_ = new PepperXmppProxy( | 646 xmpp_proxy_ = new PepperXmppProxy( |
| 648 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), | 647 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), |
| 649 plugin_task_runner_, context_.main_task_runner()); | 648 plugin_task_runner_.get(), |
| 649 context_.main_task_runner()); |
| 650 | 650 |
| 651 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator( | 651 scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator( |
| 652 PepperPortAllocator::Create(this)); | 652 PepperPortAllocator::Create(this)); |
| 653 scoped_ptr<protocol::TransportFactory> transport_factory( | 653 scoped_ptr<protocol::TransportFactory> transport_factory( |
| 654 new protocol::LibjingleTransportFactory(port_allocator.Pass(), false)); | 654 new protocol::LibjingleTransportFactory(port_allocator.Pass(), false)); |
| 655 | 655 |
| 656 // Kick off the connection. | 656 // Kick off the connection. |
| 657 client_->Start(xmpp_proxy_, transport_factory.Pass()); | 657 client_->Start(xmpp_proxy_, transport_factory.Pass()); |
| 658 | 658 |
| 659 // Start timer that periodically sends perf stats. | 659 // Start timer that periodically sends perf stats. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 679 } | 679 } |
| 680 | 680 |
| 681 // Disconnect the input pipeline and teardown the connection. | 681 // Disconnect the input pipeline and teardown the connection. |
| 682 mouse_input_filter_.set_input_stub(NULL); | 682 mouse_input_filter_.set_input_stub(NULL); |
| 683 host_connection_.reset(); | 683 host_connection_.reset(); |
| 684 } | 684 } |
| 685 | 685 |
| 686 void ChromotingInstance::OnIncomingIq(const std::string& iq) { | 686 void ChromotingInstance::OnIncomingIq(const std::string& iq) { |
| 687 // Just ignore the message if it's received before Connect() is called. It's | 687 // Just ignore the message if it's received before Connect() is called. It's |
| 688 // likely to be a leftover from a previous session, so it's safe to ignore it. | 688 // likely to be a leftover from a previous session, so it's safe to ignore it. |
| 689 if (xmpp_proxy_) | 689 if (xmpp_proxy_.get()) |
| 690 xmpp_proxy_->OnIq(iq); | 690 xmpp_proxy_->OnIq(iq); |
| 691 } | 691 } |
| 692 | 692 |
| 693 void ChromotingInstance::ReleaseAllKeys() { | 693 void ChromotingInstance::ReleaseAllKeys() { |
| 694 if (IsConnected()) | 694 if (IsConnected()) |
| 695 input_tracker_.ReleaseAll(); | 695 input_tracker_.ReleaseAll(); |
| 696 } | 696 } |
| 697 | 697 |
| 698 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { | 698 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { |
| 699 // Inject after the KeyEventMapper, so the event won't get mapped or trapped. | 699 // Inject after the KeyEventMapper, so the event won't get mapped or trapped. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 url_components.scheme.len); | 948 url_components.scheme.len); |
| 949 return url_scheme == kChromeExtensionUrlScheme; | 949 return url_scheme == kChromeExtensionUrlScheme; |
| 950 } | 950 } |
| 951 | 951 |
| 952 bool ChromotingInstance::IsConnected() { | 952 bool ChromotingInstance::IsConnected() { |
| 953 return host_connection_.get() && | 953 return host_connection_.get() && |
| 954 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 954 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
| 955 } | 955 } |
| 956 | 956 |
| 957 } // namespace remoting | 957 } // namespace remoting |
| OLD | NEW |