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 <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ProcessIncomingIq(std::move(message_dict), std::move(response)); | 152 ProcessIncomingIq(std::move(message_dict), std::move(response)); |
153 } else { | 153 } else { |
154 SendErrorAndExit(std::move(response), "Unsupported request type: " + type); | 154 SendErrorAndExit(std::move(response), "Unsupported request type: " + type); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void It2MeNativeMessagingHost::Start(Client* client) { | 158 void It2MeNativeMessagingHost::Start(Client* client) { |
159 DCHECK(task_runner()->BelongsToCurrentThread()); | 159 DCHECK(task_runner()->BelongsToCurrentThread()); |
160 client_ = client; | 160 client_ = client; |
161 #if !defined(OS_CHROMEOS) | 161 #if !defined(OS_CHROMEOS) |
162 log_message_handler_.reset( | 162 log_message_listener_.reset(new LogMessageListener(base::Bind( |
163 new LogMessageHandler( | 163 &It2MeNativeMessagingHost::SendMessageToClient, base::Unretained(this)))); |
164 base::Bind(&It2MeNativeMessagingHost::SendMessageToClient, | |
165 base::Unretained(this)))); | |
166 #endif // !defined(OS_CHROMEOS) | 164 #endif // !defined(OS_CHROMEOS) |
167 } | 165 } |
168 | 166 |
169 void It2MeNativeMessagingHost::SendMessageToClient( | 167 void It2MeNativeMessagingHost::SendMessageToClient( |
170 std::unique_ptr<base::Value> message) const { | 168 std::unique_ptr<base::Value> message) const { |
171 DCHECK(task_runner()->BelongsToCurrentThread()); | 169 DCHECK(task_runner()->BelongsToCurrentThread()); |
172 std::string message_json; | 170 std::string message_json; |
173 base::JSONWriter::Write(*message, &message_json); | 171 base::JSONWriter::Write(*message, &message_json); |
174 client_->PostMessageFromNativeHost(message_json); | 172 client_->PostMessageFromNativeHost(message_json); |
175 } | 173 } |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 526 |
529 bool It2MeNativeMessagingHost::DelegateToElevatedHost( | 527 bool It2MeNativeMessagingHost::DelegateToElevatedHost( |
530 std::unique_ptr<base::DictionaryValue> message) { | 528 std::unique_ptr<base::DictionaryValue> message) { |
531 NOTREACHED(); | 529 NOTREACHED(); |
532 return false; | 530 return false; |
533 } | 531 } |
534 | 532 |
535 #endif // !defined(OS_WIN) | 533 #endif // !defined(OS_WIN) |
536 | 534 |
537 } // namespace remoting | 535 } // namespace remoting |
OLD | NEW |