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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 std::unique_ptr<base::DictionaryValue> message_dict( | 83 std::unique_ptr<base::DictionaryValue> message_dict( |
84 static_cast<base::DictionaryValue*>(message_value.release())); | 84 static_cast<base::DictionaryValue*>(message_value.release())); |
85 | 85 |
86 // If the client supplies an ID, it will expect it in the response. This | 86 // If the client supplies an ID, it will expect it in the response. This |
87 // might be a string or a number, so cope with both. | 87 // might be a string or a number, so cope with both. |
88 const base::Value* id; | 88 const base::Value* id; |
89 if (message_dict->Get("id", &id)) | 89 if (message_dict->Get("id", &id)) |
90 response->Set("id", id->DeepCopy()); | 90 response->Set("id", id->CreateDeepCopy()); |
91 | 91 |
92 std::string type; | 92 std::string type; |
93 if (!message_dict->GetString("type", &type)) { | 93 if (!message_dict->GetString("type", &type)) { |
94 SendErrorAndExit(std::move(response), "'type' not found in request."); | 94 SendErrorAndExit(std::move(response), "'type' not found in request."); |
95 return; | 95 return; |
96 } | 96 } |
97 | 97 |
98 response->SetString("type", type + "Response"); | 98 response->SetString("type", type + "Response"); |
99 | 99 |
100 if (type == "hello") { | 100 if (type == "hello") { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 return host_context_->ui_task_runner(); | 321 return host_context_->ui_task_runner(); |
322 } | 322 } |
323 | 323 |
324 /* static */ | 324 /* static */ |
325 std::string It2MeNativeMessagingHost::HostStateToString( | 325 std::string It2MeNativeMessagingHost::HostStateToString( |
326 It2MeHostState host_state) { | 326 It2MeHostState host_state) { |
327 return ValueToName(kIt2MeHostStates, host_state); | 327 return ValueToName(kIt2MeHostStates, host_state); |
328 } | 328 } |
329 | 329 |
330 } // namespace remoting | 330 } // namespace remoting |
OLD | NEW |