Chromium Code Reviews| Index: remoting/client/plugin/chromoting_instance.cc |
| diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc |
| index 8be169c9d227874a17b053e262cd7db27e4054d5..93bfb53e64b6b8d05df57b8707b8dcc845db4d0b 100644 |
| --- a/remoting/client/plugin/chromoting_instance.cc |
| +++ b/remoting/client/plugin/chromoting_instance.cc |
| @@ -144,7 +144,7 @@ logging::LogMessageHandlerFunction g_logging_old_handler = NULL; |
| const char ChromotingInstance::kApiFeatures[] = |
| "highQualityScaling injectKeyEvent sendClipboardItem remapKey trapKey " |
| "notifyClientDimensions notifyClientResolution pauseVideo pauseAudio " |
| - "asyncPin thirdPartyAuth pinlessAuth"; |
| + "asyncPin thirdPartyAuth pinlessAuth jsonMessage"; |
| const char ChromotingInstance::kRequestedCapabilities[] = ""; |
| const char ChromotingInstance::kSupportedCapabilities[] = "desktopShape"; |
| @@ -433,6 +433,13 @@ void ChromotingInstance::HandleMessage(const pp::Var& message) { |
| return; |
| } |
| RequestPairing(client_name); |
| + } else if (method == "jsonMessage") { |
| + std::string type, json; |
| + if (!data->GetString("type", &type) || !data->GetString("json", &json)) { |
| + LOG(ERROR) << "Invalid jsonMessage."; |
| + return; |
| + } |
| + SendClientJson(type, json); |
|
Wez
2013/08/09 21:25:48
Why not leave it up to the caller to choose the fo
Jamie
2013/08/09 21:39:06
In case we want to have more than one supported me
|
| } |
| } |
| @@ -537,6 +544,13 @@ void ChromotingInstance::SetPairingResponse( |
| PostChromotingMessage("pairingResponse", data.Pass()); |
| } |
| +void ChromotingInstance::ProcessHostJson(const protocol::JsonMessage& message) { |
| + scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
| + data->SetString("type", message.type()); |
| + data->SetString("json", message.json()); |
| + PostChromotingMessage("jsonMessage", data.Pass()); |
| +} |
| + |
| void ChromotingInstance::FetchSecretFromDialog( |
| bool pairing_supported, |
| const protocol::SecretFetchedCallback& secret_fetched_callback) { |
| @@ -839,6 +853,17 @@ void ChromotingInstance::RequestPairing(const std::string& client_name) { |
| host_connection_->host_stub()->RequestPairing(pairing_request); |
| } |
| +void ChromotingInstance::SendClientJson(const std::string& type, |
| + const std::string& json) { |
| + if (!IsConnected()) { |
| + return; |
| + } |
| + protocol::JsonMessage message; |
| + message.set_type(type); |
| + message.set_json(json); |
| + host_connection_->host_stub()->ProcessClientJson(message); |
| +} |
| + |
| ChromotingStats* ChromotingInstance::GetStats() { |
| if (!client_.get()) |
| return NULL; |