Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: remoting/client/plugin/chromoting_instance.cc

Issue 10262035: Check whether the client is connected before trying to write to channels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/chromoting_instance.cc
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 6bb34a852af25cdd67265a94a87402dd7c832f92..b3c28d39fa0b9591fe2c12bc8e8296c29b521a0c 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
« no previous file with comments | « remoting/client/plugin/chromoting_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698