| 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/setup/me2me_native_messaging_host.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host.h" |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 scoped_ptr<base::DictionaryValue> message, | 175 scoped_ptr<base::DictionaryValue> message, |
| 176 scoped_ptr<base::DictionaryValue> response) { | 176 scoped_ptr<base::DictionaryValue> response) { |
| 177 DCHECK(thread_checker_.CalledOnValidThread()); | 177 DCHECK(thread_checker_.CalledOnValidThread()); |
| 178 | 178 |
| 179 if (needs_elevation_) { | 179 if (needs_elevation_) { |
| 180 if (!DelegateToElevatedHost(message.Pass())) | 180 if (!DelegateToElevatedHost(message.Pass())) |
| 181 SendBooleanResult(response.Pass(), false); | 181 SendBooleanResult(response.Pass(), false); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 | 184 |
| 185 if (pairing_registry_) { | 185 if (pairing_registry_.get()) { |
| 186 pairing_registry_->ClearAllPairings( | 186 pairing_registry_->ClearAllPairings( |
| 187 base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, weak_ptr_, | 187 base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, weak_ptr_, |
| 188 base::Passed(&response))); | 188 base::Passed(&response))); |
| 189 } else { | 189 } else { |
| 190 SendBooleanResult(response.Pass(), false); | 190 SendBooleanResult(response.Pass(), false); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 void Me2MeNativeMessagingHost::ProcessDeletePairedClient( | 194 void Me2MeNativeMessagingHost::ProcessDeletePairedClient( |
| 195 scoped_ptr<base::DictionaryValue> message, | 195 scoped_ptr<base::DictionaryValue> message, |
| 196 scoped_ptr<base::DictionaryValue> response) { | 196 scoped_ptr<base::DictionaryValue> response) { |
| 197 DCHECK(thread_checker_.CalledOnValidThread()); | 197 DCHECK(thread_checker_.CalledOnValidThread()); |
| 198 | 198 |
| 199 if (needs_elevation_) { | 199 if (needs_elevation_) { |
| 200 if (!DelegateToElevatedHost(message.Pass())) | 200 if (!DelegateToElevatedHost(message.Pass())) |
| 201 SendBooleanResult(response.Pass(), false); | 201 SendBooleanResult(response.Pass(), false); |
| 202 return; | 202 return; |
| 203 } | 203 } |
| 204 | 204 |
| 205 std::string client_id; | 205 std::string client_id; |
| 206 if (!message->GetString(protocol::PairingRegistry::kClientIdKey, | 206 if (!message->GetString(protocol::PairingRegistry::kClientIdKey, |
| 207 &client_id)) { | 207 &client_id)) { |
| 208 LOG(ERROR) << "'" << protocol::PairingRegistry::kClientIdKey | 208 LOG(ERROR) << "'" << protocol::PairingRegistry::kClientIdKey |
| 209 << "' string not found."; | 209 << "' string not found."; |
| 210 OnError(); | 210 OnError(); |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 | 213 |
| 214 if (pairing_registry_) { | 214 if (pairing_registry_.get()) { |
| 215 pairing_registry_->DeletePairing( | 215 pairing_registry_->DeletePairing( |
| 216 client_id, base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, | 216 client_id, base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, |
| 217 weak_ptr_, base::Passed(&response))); | 217 weak_ptr_, base::Passed(&response))); |
| 218 } else { | 218 } else { |
| 219 SendBooleanResult(response.Pass(), false); | 219 SendBooleanResult(response.Pass(), false); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 void Me2MeNativeMessagingHost::ProcessGetHostName( | 223 void Me2MeNativeMessagingHost::ProcessGetHostName( |
| 224 scoped_ptr<base::DictionaryValue> message, | 224 scoped_ptr<base::DictionaryValue> message, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 daemon_controller_->GetConfig( | 287 daemon_controller_->GetConfig( |
| 288 base::Bind(&Me2MeNativeMessagingHost::SendConfigResponse, weak_ptr_, | 288 base::Bind(&Me2MeNativeMessagingHost::SendConfigResponse, weak_ptr_, |
| 289 base::Passed(&response))); | 289 base::Passed(&response))); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void Me2MeNativeMessagingHost::ProcessGetPairedClients( | 292 void Me2MeNativeMessagingHost::ProcessGetPairedClients( |
| 293 scoped_ptr<base::DictionaryValue> message, | 293 scoped_ptr<base::DictionaryValue> message, |
| 294 scoped_ptr<base::DictionaryValue> response) { | 294 scoped_ptr<base::DictionaryValue> response) { |
| 295 DCHECK(thread_checker_.CalledOnValidThread()); | 295 DCHECK(thread_checker_.CalledOnValidThread()); |
| 296 | 296 |
| 297 if (pairing_registry_) { | 297 if (pairing_registry_.get()) { |
| 298 pairing_registry_->GetAllPairings( | 298 pairing_registry_->GetAllPairings( |
| 299 base::Bind(&Me2MeNativeMessagingHost::SendPairedClientsResponse, | 299 base::Bind(&Me2MeNativeMessagingHost::SendPairedClientsResponse, |
| 300 weak_ptr_, base::Passed(&response))); | 300 weak_ptr_, base::Passed(&response))); |
| 301 } else { | 301 } else { |
| 302 scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue); | 302 scoped_ptr<base::ListValue> no_paired_clients(new base::ListValue); |
| 303 SendPairedClientsResponse(response.Pass(), no_paired_clients.Pass()); | 303 SendPairedClientsResponse(response.Pass(), no_paired_clients.Pass()); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 void Me2MeNativeMessagingHost::ProcessGetUsageStatsConsent( | 307 void Me2MeNativeMessagingHost::ProcessGetUsageStatsConsent( |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 691 |
| 692 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( | 692 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( |
| 693 scoped_ptr<base::DictionaryValue> message) { | 693 scoped_ptr<base::DictionaryValue> message) { |
| 694 NOTREACHED(); | 694 NOTREACHED(); |
| 695 return false; | 695 return false; |
| 696 } | 696 } |
| 697 | 697 |
| 698 #endif // !defined(OS_WIN) | 698 #endif // !defined(OS_WIN) |
| 699 | 699 |
| 700 } // namespace remoting | 700 } // namespace remoting |
| OLD | NEW |