| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/host/it2me/it2me_native_messaging_host.h" | 5 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 void It2MeNativeMessagingHost::Start(Client* client) { | 115 void It2MeNativeMessagingHost::Start(Client* client) { |
| 116 DCHECK(task_runner()->BelongsToCurrentThread()); | 116 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 117 client_ = client; | 117 client_ = client; |
| 118 } | 118 } |
| 119 | 119 |
| 120 void It2MeNativeMessagingHost::SendMessageToClient( | 120 void It2MeNativeMessagingHost::SendMessageToClient( |
| 121 scoped_ptr<base::DictionaryValue> message) const { | 121 scoped_ptr<base::DictionaryValue> message) const { |
| 122 DCHECK(task_runner()->BelongsToCurrentThread()); | 122 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 123 std::string message_json; | 123 std::string message_json; |
| 124 base::JSONWriter::Write(message.get(), &message_json); | 124 base::JSONWriter::Write(*message, &message_json); |
| 125 client_->PostMessageFromNativeHost(message_json); | 125 client_->PostMessageFromNativeHost(message_json); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void It2MeNativeMessagingHost::ProcessHello( | 128 void It2MeNativeMessagingHost::ProcessHello( |
| 129 const base::DictionaryValue& message, | 129 const base::DictionaryValue& message, |
| 130 scoped_ptr<base::DictionaryValue> response) const { | 130 scoped_ptr<base::DictionaryValue> response) const { |
| 131 DCHECK(task_runner()->BelongsToCurrentThread()); | 131 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 132 | 132 |
| 133 response->SetString("version", STRINGIZE(VERSION)); | 133 response->SetString("version", STRINGIZE(VERSION)); |
| 134 | 134 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 | 310 |
| 311 /* static */ | 311 /* static */ |
| 312 std::string It2MeNativeMessagingHost::HostStateToString( | 312 std::string It2MeNativeMessagingHost::HostStateToString( |
| 313 It2MeHostState host_state) { | 313 It2MeHostState host_state) { |
| 314 return ValueToName(kIt2MeHostStates, host_state); | 314 return ValueToName(kIt2MeHostStates, host_state); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace remoting | 317 } // namespace remoting |
| 318 | 318 |
| OLD | NEW |