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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 done_event.Wait(); | 609 done_event.Wait(); |
610 client_.reset(); | 610 client_.reset(); |
611 } | 611 } |
612 | 612 |
613 // Disconnect the input pipeline and teardown the connection. | 613 // Disconnect the input pipeline and teardown the connection. |
614 mouse_input_filter_.set_input_stub(NULL); | 614 mouse_input_filter_.set_input_stub(NULL); |
615 host_connection_.reset(); | 615 host_connection_.reset(); |
616 } | 616 } |
617 | 617 |
618 void ChromotingInstance::OnIncomingIq(const std::string& iq) { | 618 void ChromotingInstance::OnIncomingIq(const std::string& iq) { |
619 xmpp_proxy_->OnIq(iq); | 619 // Just ignore the message if it's received before Connect() is called. It's |
| 620 // likely to be a leftover from a previous session, so it's safe to ignore it. |
| 621 if (xmpp_proxy_) |
| 622 xmpp_proxy_->OnIq(iq); |
620 } | 623 } |
621 | 624 |
622 void ChromotingInstance::ReleaseAllKeys() { | 625 void ChromotingInstance::ReleaseAllKeys() { |
623 if (IsConnected()) | 626 if (IsConnected()) |
624 input_tracker_.ReleaseAll(); | 627 input_tracker_.ReleaseAll(); |
625 } | 628 } |
626 | 629 |
627 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { | 630 void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { |
628 // Inject after the KeyEventMapper, so the event won't get mapped or trapped. | 631 // Inject after the KeyEventMapper, so the event won't get mapped or trapped. |
629 if (IsConnected()) | 632 if (IsConnected()) |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 url_components.scheme.len); | 870 url_components.scheme.len); |
868 return url_scheme == kChromeExtensionUrlScheme; | 871 return url_scheme == kChromeExtensionUrlScheme; |
869 } | 872 } |
870 | 873 |
871 bool ChromotingInstance::IsConnected() { | 874 bool ChromotingInstance::IsConnected() { |
872 return host_connection_.get() && | 875 return host_connection_.get() && |
873 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); | 876 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); |
874 } | 877 } |
875 | 878 |
876 } // namespace remoting | 879 } // namespace remoting |
OLD | NEW |