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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 10692179: Propagate connection state from networking layer to UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 void ChromotingInstance::OnConnectionState( 382 void ChromotingInstance::OnConnectionState(
383 protocol::ConnectionToHost::State state, 383 protocol::ConnectionToHost::State state,
384 protocol::ErrorCode error) { 384 protocol::ErrorCode error) {
385 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 385 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
386 data->SetString("state", ConnectionStateToString(state)); 386 data->SetString("state", ConnectionStateToString(state));
387 data->SetString("error", ConnectionErrorToString(error)); 387 data->SetString("error", ConnectionErrorToString(error));
388 PostChromotingMessage("onConnectionStatus", data.Pass()); 388 PostChromotingMessage("onConnectionStatus", data.Pass());
389 } 389 }
390 390
391 void ChromotingInstance::OnConnectionInactive(bool inactive) {
392 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
393 data->SetBoolean("inactive", inactive);
394 PostChromotingMessage("onConnectionInactive", data.Pass());
395 }
396
391 void ChromotingInstance::ProcessClipboardEvent( 397 void ChromotingInstance::ProcessClipboardEvent(
392 const protocol::ClipboardEvent& event) { 398 const protocol::ClipboardEvent& event) {
393 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 399 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
394 data->SetString("mimeType", event.mime_type()); 400 data->SetString("mimeType", event.mime_type());
395 data->SetString("item", event.data()); 401 data->SetString("item", event.data());
396 PostChromotingMessage("injectClipboardItem", data.Pass()); 402 PostChromotingMessage("injectClipboardItem", data.Pass());
397 } 403 }
398 404
399 void ChromotingInstance::SetCursorShape( 405 void ChromotingInstance::SetCursorShape(
400 const protocol::CursorShapeInfo& cursor_shape) { 406 const protocol::CursorShapeInfo& cursor_shape) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 PostChromotingMessage("logDebugMessage", data.Pass()); 734 PostChromotingMessage("logDebugMessage", data.Pass());
729 g_logging_to_plugin = false; 735 g_logging_to_plugin = false;
730 } 736 }
731 737
732 bool ChromotingInstance::IsConnected() { 738 bool ChromotingInstance::IsConnected() {
733 return host_connection_.get() && 739 return host_connection_.get() &&
734 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED); 740 (host_connection_->state() == protocol::ConnectionToHost::CONNECTED);
735 } 741 }
736 742
737 } // namespace remoting 743 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698