Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 } else if (type == "disconnect") { | 108 } else if (type == "disconnect") { |
| 109 ProcessDisconnect(*message_dict, response.Pass()); | 109 ProcessDisconnect(*message_dict, response.Pass()); |
| 110 } else { | 110 } else { |
| 111 SendErrorAndExit(response.Pass(), "Unsupported request type: " + type); | 111 SendErrorAndExit(response.Pass(), "Unsupported request type: " + type); |
| 112 } | 112 } |
| 113 } | 113 } |
| 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 log_message_handler_.reset( | |
|
Sergey Ulanov
2015/08/16 23:22:02
This should be disabled on ChromeOS. We don't want
Jamie
2015/08/17 17:32:23
Done.
| |
| 119 new LogMessageHandler( | |
| 120 base::Bind(&It2MeNativeMessagingHost::SendMessageToClient, | |
| 121 base::Unretained(this)))); | |
| 118 } | 122 } |
| 119 | 123 |
| 120 void It2MeNativeMessagingHost::SendMessageToClient( | 124 void It2MeNativeMessagingHost::SendMessageToClient( |
| 121 scoped_ptr<base::DictionaryValue> message) const { | 125 scoped_ptr<base::Value> message) const { |
| 122 DCHECK(task_runner()->BelongsToCurrentThread()); | 126 DCHECK(task_runner()->BelongsToCurrentThread()); |
| 123 std::string message_json; | 127 std::string message_json; |
| 124 base::JSONWriter::Write(*message, &message_json); | 128 base::JSONWriter::Write(*message, &message_json); |
| 125 client_->PostMessageFromNativeHost(message_json); | 129 client_->PostMessageFromNativeHost(message_json); |
| 126 } | 130 } |
| 127 | 131 |
| 128 void It2MeNativeMessagingHost::ProcessHello( | 132 void It2MeNativeMessagingHost::ProcessHello( |
| 129 const base::DictionaryValue& message, | 133 const base::DictionaryValue& message, |
| 130 scoped_ptr<base::DictionaryValue> response) const { | 134 scoped_ptr<base::DictionaryValue> response) const { |
| 131 DCHECK(task_runner()->BelongsToCurrentThread()); | 135 DCHECK(task_runner()->BelongsToCurrentThread()); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 return host_context_->ui_task_runner(); | 323 return host_context_->ui_task_runner(); |
| 320 } | 324 } |
| 321 | 325 |
| 322 /* static */ | 326 /* static */ |
| 323 std::string It2MeNativeMessagingHost::HostStateToString( | 327 std::string It2MeNativeMessagingHost::HostStateToString( |
| 324 It2MeHostState host_state) { | 328 It2MeHostState host_state) { |
| 325 return ValueToName(kIt2MeHostStates, host_state); | 329 return ValueToName(kIt2MeHostStates, host_state); |
| 326 } | 330 } |
| 327 | 331 |
| 328 } // namespace remoting | 332 } // namespace remoting |
| OLD | NEW |