diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 23:09:59 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 23:09:59 +0000 |
commit | 67f5981451794db2ed89d87d5a053c6489494303 (patch) | |
tree | 24933713cf9a609f0211d8bfdc8865481ee05a1a /remoting | |
parent | 1b9dc9f800c12e3421ff08659bc3466a3be0a81d (diff) | |
download | chromium_src-67f5981451794db2ed89d87d5a053c6489494303.zip chromium_src-67f5981451794db2ed89d87d5a053c6489494303.tar.gz chromium_src-67f5981451794db2ed89d87d5a053c6489494303.tar.bz2 |
Check whether the client is connected before trying to write to channels.
BUG=125795,110212
Review URL: http://codereview.chromium.org/10262035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 15 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_instance.h | 4 |
2 files changed, 14 insertions, 5 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 6bb34a8..b3c28d3 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -330,7 +330,7 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position, bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { DCHECK(plugin_message_loop_->BelongsToCurrentThread()); - if (!input_handler_.get()) + if (!IsConnected()) return false; // TODO(wez): When we have a good hook into Host dimensions changes, move @@ -452,13 +452,13 @@ void ChromotingInstance::OnIncomingIq(const std::string& iq) { } void ChromotingInstance::ReleaseAllKeys() { - if (input_tracker_.get()) + if (IsConnected()) input_tracker_->ReleaseAll(); } void ChromotingInstance::InjectKeyEvent(const protocol::KeyEvent& event) { // Inject after the KeyEventMapper, so the event won't get mapped or trapped. - if (input_tracker_.get()) + if (IsConnected()) input_tracker_->InjectKeyEvent(event); } @@ -473,7 +473,7 @@ void ChromotingInstance::TrapKey(uint32 usb_keycode, bool trap) { void ChromotingInstance::SendClipboardItem(const std::string& mime_type, const std::string& item) { - if (!host_connection_.get()) { + if (!IsConnected()) { return; } protocol::ClipboardEvent event; @@ -483,7 +483,7 @@ void ChromotingInstance::SendClipboardItem(const std::string& mime_type, } void ChromotingInstance::NotifyClientDimensions(int width, int height) { - if (!host_connection_.get()) { + if (!IsConnected()) { return; } protocol::ClientDimensions client_dimensions; @@ -654,4 +654,9 @@ void ChromotingInstance::ProcessLogToUI(const std::string& message) { g_logging_to_plugin = false; } +bool ChromotingInstance::IsConnected() { + return host_connection_.get() && + (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); +} + } // namespace remoting diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index 66e00b1..a223382 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -190,6 +190,9 @@ class ChromotingInstance : void ProcessLogToUI(const std::string& message); + // Returns true if there is a ConnectionToHost and it is connected. + bool IsConnected(); + bool initialized_; PepperPluginThreadDelegate plugin_thread_delegate_; @@ -199,6 +202,7 @@ class ChromotingInstance : scoped_ptr<PepperView> view_; scoped_refptr<RectangleUpdateDecoder> rectangle_decoder_; + scoped_ptr<protocol::MouseInputFilter> mouse_input_filter_; scoped_ptr<protocol::InputEventTracker> input_tracker_; KeyEventMapper key_mapper_; |