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 <sstream> | |
6 #include <string> | 7 #include <string> |
7 | 8 |
8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/strings/stringize_macros.h" | 15 #include "base/strings/stringize_macros.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 ProcessGetDaemonState(message_dict.Pass(), response.Pass()); | 161 ProcessGetDaemonState(message_dict.Pass(), response.Pass()); |
161 } else if (type == "getHostClientId") { | 162 } else if (type == "getHostClientId") { |
162 ProcessGetHostClientId(message_dict.Pass(), response.Pass()); | 163 ProcessGetHostClientId(message_dict.Pass(), response.Pass()); |
163 } else if (type == "getCredentialsFromAuthCode") { | 164 } else if (type == "getCredentialsFromAuthCode") { |
164 ProcessGetCredentialsFromAuthCode( | 165 ProcessGetCredentialsFromAuthCode( |
165 message_dict.Pass(), response.Pass(), true); | 166 message_dict.Pass(), response.Pass(), true); |
166 } else if (type == "getRefreshTokenFromAuthCode") { | 167 } else if (type == "getRefreshTokenFromAuthCode") { |
167 ProcessGetCredentialsFromAuthCode( | 168 ProcessGetCredentialsFromAuthCode( |
168 message_dict.Pass(), response.Pass(), false); | 169 message_dict.Pass(), response.Pass(), false); |
169 } else { | 170 } else { |
170 LOG(ERROR) << "Unsupported request type: " << type; | 171 std::ostringstream error_message; |
171 OnError(); | 172 error_message << "Unsupported request type: " << type; |
173 LOG(ERROR) << error_message; | |
174 SendAsyncFailure(response.Pass(), error_message.str(), FROM_HERE); | |
172 } | 175 } |
173 } | 176 } |
174 | 177 |
175 void Me2MeNativeMessagingHost::OnDisconnect() { | 178 void Me2MeNativeMessagingHost::OnDisconnect() { |
176 if (!quit_closure_.is_null()) | 179 if (!quit_closure_.is_null()) |
177 base::ResetAndReturn(&quit_closure_).Run(); | 180 base::ResetAndReturn(&quit_closure_).Run(); |
178 } | 181 } |
179 | 182 |
180 void Me2MeNativeMessagingHost::ProcessHello( | 183 void Me2MeNativeMessagingHost::ProcessHello( |
181 scoped_ptr<base::DictionaryValue> message, | 184 scoped_ptr<base::DictionaryValue> message, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
217 | 220 |
218 if (needs_elevation_) { | 221 if (needs_elevation_) { |
219 if (!DelegateToElevatedHost(message.Pass())) | 222 if (!DelegateToElevatedHost(message.Pass())) |
220 SendBooleanResult(response.Pass(), false); | 223 SendBooleanResult(response.Pass(), false); |
221 return; | 224 return; |
222 } | 225 } |
223 | 226 |
224 std::string client_id; | 227 std::string client_id; |
225 if (!message->GetString(protocol::PairingRegistry::kClientIdKey, | 228 if (!message->GetString(protocol::PairingRegistry::kClientIdKey, |
226 &client_id)) { | 229 &client_id)) { |
227 LOG(ERROR) << "'" << protocol::PairingRegistry::kClientIdKey | 230 std::ostringstream error_message; |
Sergey Ulanov
2015/08/06 22:40:57
This code may be simpler with base::StringPrintf()
Jamie
2015/08/06 23:06:17
I'm not a fan of printf, but the +-operator would
| |
228 << "' string not found."; | 231 error_message << "'" << protocol::PairingRegistry::kClientIdKey |
229 OnError(); | 232 << "' string not found"; |
233 LOG(ERROR) << error_message; | |
234 SendAsyncFailure(response.Pass(), error_message.str(), FROM_HERE); | |
230 return; | 235 return; |
231 } | 236 } |
232 | 237 |
233 if (pairing_registry_.get()) { | 238 if (pairing_registry_.get()) { |
234 pairing_registry_->DeletePairing( | 239 pairing_registry_->DeletePairing( |
235 client_id, base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, | 240 client_id, base::Bind(&Me2MeNativeMessagingHost::SendBooleanResult, |
236 weak_ptr_, base::Passed(&response))); | 241 weak_ptr_, base::Passed(&response))); |
237 } else { | 242 } else { |
238 SendBooleanResult(response.Pass(), false); | 243 SendBooleanResult(response.Pass(), false); |
239 } | 244 } |
240 } | 245 } |
241 | 246 |
242 void Me2MeNativeMessagingHost::ProcessGetHostName( | 247 void Me2MeNativeMessagingHost::ProcessGetHostName( |
243 scoped_ptr<base::DictionaryValue> message, | 248 scoped_ptr<base::DictionaryValue> message, |
244 scoped_ptr<base::DictionaryValue> response) { | 249 scoped_ptr<base::DictionaryValue> response) { |
245 DCHECK(thread_checker_.CalledOnValidThread()); | 250 DCHECK(thread_checker_.CalledOnValidThread()); |
246 | 251 |
247 response->SetString("hostname", net::GetHostName()); | 252 response->SetString("hostname", net::GetHostName()); |
248 channel_->SendMessage(response.Pass()); | 253 channel_->SendMessage(response.Pass()); |
249 } | 254 } |
250 | 255 |
251 void Me2MeNativeMessagingHost::ProcessGetPinHash( | 256 void Me2MeNativeMessagingHost::ProcessGetPinHash( |
252 scoped_ptr<base::DictionaryValue> message, | 257 scoped_ptr<base::DictionaryValue> message, |
253 scoped_ptr<base::DictionaryValue> response) { | 258 scoped_ptr<base::DictionaryValue> response) { |
254 DCHECK(thread_checker_.CalledOnValidThread()); | 259 DCHECK(thread_checker_.CalledOnValidThread()); |
255 | 260 |
256 std::string host_id; | 261 std::string host_id; |
257 if (!message->GetString("hostId", &host_id)) { | 262 if (!message->GetString("hostId", &host_id)) { |
258 LOG(ERROR) << "'hostId' not found: " << message; | 263 std::string error_message = "'hostId' not found"; |
259 OnError(); | 264 LOG(ERROR) << error_message; |
265 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
260 return; | 266 return; |
261 } | 267 } |
262 std::string pin; | 268 std::string pin; |
263 if (!message->GetString("pin", &pin)) { | 269 if (!message->GetString("pin", &pin)) { |
264 LOG(ERROR) << "'pin' not found: " << message; | 270 std::string error_message = "'pin' not found"; |
265 OnError(); | 271 LOG(ERROR) << error_message; |
272 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
266 return; | 273 return; |
267 } | 274 } |
268 response->SetString("hash", MakeHostPinHash(host_id, pin)); | 275 response->SetString("hash", MakeHostPinHash(host_id, pin)); |
269 channel_->SendMessage(response.Pass()); | 276 channel_->SendMessage(response.Pass()); |
270 } | 277 } |
271 | 278 |
272 void Me2MeNativeMessagingHost::ProcessGenerateKeyPair( | 279 void Me2MeNativeMessagingHost::ProcessGenerateKeyPair( |
273 scoped_ptr<base::DictionaryValue> message, | 280 scoped_ptr<base::DictionaryValue> message, |
274 scoped_ptr<base::DictionaryValue> response) { | 281 scoped_ptr<base::DictionaryValue> response) { |
275 DCHECK(thread_checker_.CalledOnValidThread()); | 282 DCHECK(thread_checker_.CalledOnValidThread()); |
276 | 283 |
277 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate(); | 284 scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate(); |
278 response->SetString("privateKey", key_pair->ToString()); | 285 response->SetString("privateKey", key_pair->ToString()); |
279 response->SetString("publicKey", key_pair->GetPublicKey()); | 286 response->SetString("publicKey", key_pair->GetPublicKey()); |
280 channel_->SendMessage(response.Pass()); | 287 channel_->SendMessage(response.Pass()); |
281 } | 288 } |
282 | 289 |
283 void Me2MeNativeMessagingHost::ProcessUpdateDaemonConfig( | 290 void Me2MeNativeMessagingHost::ProcessUpdateDaemonConfig( |
284 scoped_ptr<base::DictionaryValue> message, | 291 scoped_ptr<base::DictionaryValue> message, |
285 scoped_ptr<base::DictionaryValue> response) { | 292 scoped_ptr<base::DictionaryValue> response) { |
286 DCHECK(thread_checker_.CalledOnValidThread()); | 293 DCHECK(thread_checker_.CalledOnValidThread()); |
287 | 294 |
288 if (needs_elevation_) { | 295 if (needs_elevation_) { |
289 if (!DelegateToElevatedHost(message.Pass())) | 296 if (!DelegateToElevatedHost(message.Pass())) { |
290 SendAsyncResult(response.Pass(), DaemonController::RESULT_FAILED); | 297 std::string error_message = "DelegateToElevatedHost failed"; |
298 LOG(ERROR) << error_message; | |
299 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
300 } | |
291 return; | 301 return; |
292 } | 302 } |
293 | 303 |
294 scoped_ptr<base::DictionaryValue> config_dict = | 304 scoped_ptr<base::DictionaryValue> config_dict = |
295 ConfigDictionaryFromMessage(message.Pass()); | 305 ConfigDictionaryFromMessage(message.Pass()); |
296 if (!config_dict) { | 306 if (!config_dict) { |
297 OnError(); | 307 std::string error_message = "No config dictionary in message"; |
308 LOG(ERROR) << error_message; | |
309 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
298 return; | 310 return; |
299 } | 311 } |
300 | 312 |
313 scoped_ptr<base::DictionaryValue> response_copy(response->CreateDeepCopy()); | |
301 daemon_controller_->UpdateConfig( | 314 daemon_controller_->UpdateConfig( |
302 config_dict.Pass(), | 315 config_dict.Pass(), |
303 base::Bind(&Me2MeNativeMessagingHost::SendAsyncResult, weak_ptr_, | 316 base::Bind(&Me2MeNativeMessagingHost::SendAsyncSuccess, weak_ptr_, |
304 base::Passed(&response))); | 317 base::Passed(&response)), |
318 base::Bind(&Me2MeNativeMessagingHost::SendAsyncFailure, weak_ptr_, | |
319 base::Passed(&response_copy))); | |
305 } | 320 } |
306 | 321 |
307 void Me2MeNativeMessagingHost::ProcessGetDaemonConfig( | 322 void Me2MeNativeMessagingHost::ProcessGetDaemonConfig( |
308 scoped_ptr<base::DictionaryValue> message, | 323 scoped_ptr<base::DictionaryValue> message, |
309 scoped_ptr<base::DictionaryValue> response) { | 324 scoped_ptr<base::DictionaryValue> response) { |
310 DCHECK(thread_checker_.CalledOnValidThread()); | 325 DCHECK(thread_checker_.CalledOnValidThread()); |
311 | 326 |
312 daemon_controller_->GetConfig( | 327 daemon_controller_->GetConfig( |
313 base::Bind(&Me2MeNativeMessagingHost::SendConfigResponse, weak_ptr_, | 328 base::Bind(&Me2MeNativeMessagingHost::SendConfigResponse, weak_ptr_, |
314 base::Passed(&response))); | 329 base::Passed(&response))); |
(...skipping 23 matching lines...) Expand all Loading... | |
338 base::Bind(&Me2MeNativeMessagingHost::SendUsageStatsConsentResponse, | 353 base::Bind(&Me2MeNativeMessagingHost::SendUsageStatsConsentResponse, |
339 weak_ptr_, base::Passed(&response))); | 354 weak_ptr_, base::Passed(&response))); |
340 } | 355 } |
341 | 356 |
342 void Me2MeNativeMessagingHost::ProcessStartDaemon( | 357 void Me2MeNativeMessagingHost::ProcessStartDaemon( |
343 scoped_ptr<base::DictionaryValue> message, | 358 scoped_ptr<base::DictionaryValue> message, |
344 scoped_ptr<base::DictionaryValue> response) { | 359 scoped_ptr<base::DictionaryValue> response) { |
345 DCHECK(thread_checker_.CalledOnValidThread()); | 360 DCHECK(thread_checker_.CalledOnValidThread()); |
346 | 361 |
347 if (needs_elevation_) { | 362 if (needs_elevation_) { |
348 if (!DelegateToElevatedHost(message.Pass())) | 363 if (!DelegateToElevatedHost(message.Pass())) { |
349 SendAsyncResult(response.Pass(), DaemonController::RESULT_FAILED); | 364 std::string error_message = "DelegateToElevatedHost failed"; |
365 LOG(ERROR) << error_message; | |
366 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
367 } | |
350 return; | 368 return; |
351 } | 369 } |
352 | 370 |
353 bool consent; | 371 bool consent; |
354 if (!message->GetBoolean("consent", &consent)) { | 372 if (!message->GetBoolean("consent", &consent)) { |
355 LOG(ERROR) << "'consent' not found."; | 373 std::string error_message = "'consent' not found"; |
356 OnError(); | 374 LOG(ERROR) << error_message; |
375 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
357 return; | 376 return; |
358 } | 377 } |
359 | 378 |
360 scoped_ptr<base::DictionaryValue> config_dict = | 379 scoped_ptr<base::DictionaryValue> config_dict = |
361 ConfigDictionaryFromMessage(message.Pass()); | 380 ConfigDictionaryFromMessage(message.Pass()); |
362 if (!config_dict) { | 381 if (!config_dict) { |
363 OnError(); | 382 std::string error_message = "No config dictionary in message"; |
383 LOG(ERROR) << error_message; | |
384 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
364 return; | 385 return; |
365 } | 386 } |
366 | 387 |
388 scoped_ptr<base::DictionaryValue> response_copy(response->CreateDeepCopy()); | |
367 daemon_controller_->SetConfigAndStart( | 389 daemon_controller_->SetConfigAndStart( |
368 config_dict.Pass(), consent, | 390 config_dict.Pass(), consent, |
369 base::Bind(&Me2MeNativeMessagingHost::SendAsyncResult, weak_ptr_, | 391 base::Bind(&Me2MeNativeMessagingHost::SendAsyncSuccess, weak_ptr_, |
370 base::Passed(&response))); | 392 base::Passed(&response)), |
393 base::Bind(&Me2MeNativeMessagingHost::SendAsyncFailure, weak_ptr_, | |
394 base::Passed(&response_copy))); | |
371 } | 395 } |
372 | 396 |
373 void Me2MeNativeMessagingHost::ProcessStopDaemon( | 397 void Me2MeNativeMessagingHost::ProcessStopDaemon( |
374 scoped_ptr<base::DictionaryValue> message, | 398 scoped_ptr<base::DictionaryValue> message, |
375 scoped_ptr<base::DictionaryValue> response) { | 399 scoped_ptr<base::DictionaryValue> response) { |
376 DCHECK(thread_checker_.CalledOnValidThread()); | 400 DCHECK(thread_checker_.CalledOnValidThread()); |
377 | 401 |
378 if (needs_elevation_) { | 402 if (needs_elevation_) { |
379 if (!DelegateToElevatedHost(message.Pass())) | 403 if (!DelegateToElevatedHost(message.Pass())) { |
380 SendAsyncResult(response.Pass(), DaemonController::RESULT_FAILED); | 404 std::string error_message = "DelegateToElevatedHost failed"; |
405 LOG(ERROR) << error_message; | |
406 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
407 } | |
381 return; | 408 return; |
382 } | 409 } |
383 | 410 |
411 scoped_ptr<base::DictionaryValue> response_copy(response->CreateDeepCopy()); | |
384 daemon_controller_->Stop( | 412 daemon_controller_->Stop( |
385 base::Bind(&Me2MeNativeMessagingHost::SendAsyncResult, weak_ptr_, | 413 base::Bind(&Me2MeNativeMessagingHost::SendAsyncSuccess, weak_ptr_, |
386 base::Passed(&response))); | 414 base::Passed(&response)), |
415 base::Bind(&Me2MeNativeMessagingHost::SendAsyncFailure, weak_ptr_, | |
416 base::Passed(&response_copy))); | |
387 } | 417 } |
388 | 418 |
389 void Me2MeNativeMessagingHost::ProcessGetDaemonState( | 419 void Me2MeNativeMessagingHost::ProcessGetDaemonState( |
390 scoped_ptr<base::DictionaryValue> message, | 420 scoped_ptr<base::DictionaryValue> message, |
391 scoped_ptr<base::DictionaryValue> response) { | 421 scoped_ptr<base::DictionaryValue> response) { |
392 DCHECK(thread_checker_.CalledOnValidThread()); | 422 DCHECK(thread_checker_.CalledOnValidThread()); |
393 | 423 |
394 DaemonController::State state = daemon_controller_->GetState(); | 424 DaemonController::State state = daemon_controller_->GetState(); |
395 switch (state) { | 425 switch (state) { |
396 case DaemonController::STATE_NOT_IMPLEMENTED: | 426 case DaemonController::STATE_NOT_IMPLEMENTED: |
(...skipping 29 matching lines...) Expand all Loading... | |
426 } | 456 } |
427 | 457 |
428 void Me2MeNativeMessagingHost::ProcessGetCredentialsFromAuthCode( | 458 void Me2MeNativeMessagingHost::ProcessGetCredentialsFromAuthCode( |
429 scoped_ptr<base::DictionaryValue> message, | 459 scoped_ptr<base::DictionaryValue> message, |
430 scoped_ptr<base::DictionaryValue> response, | 460 scoped_ptr<base::DictionaryValue> response, |
431 bool need_user_email) { | 461 bool need_user_email) { |
432 DCHECK(thread_checker_.CalledOnValidThread()); | 462 DCHECK(thread_checker_.CalledOnValidThread()); |
433 | 463 |
434 std::string auth_code; | 464 std::string auth_code; |
435 if (!message->GetString("authorizationCode", &auth_code)) { | 465 if (!message->GetString("authorizationCode", &auth_code)) { |
436 LOG(ERROR) << "'authorizationCode' string not found."; | 466 std::string error_message = "'authorizationCode' string not found"; |
437 OnError(); | 467 LOG(ERROR) << error_message; |
468 SendAsyncFailure(response.Pass(), error_message, FROM_HERE); | |
438 return; | 469 return; |
439 } | 470 } |
440 | 471 |
441 gaia::OAuthClientInfo oauth_client_info = { | 472 gaia::OAuthClientInfo oauth_client_info = { |
442 google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING_HOST), | 473 google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING_HOST), |
443 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING_HOST), | 474 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING_HOST), |
444 kServiceAccountRedirectUri | 475 kServiceAccountRedirectUri |
445 }; | 476 }; |
446 | 477 |
447 oauth_client_->GetCredentialsFromAuthCode( | 478 oauth_client_->GetCredentialsFromAuthCode( |
(...skipping 28 matching lines...) Expand all Loading... | |
476 scoped_ptr<base::DictionaryValue> response, | 507 scoped_ptr<base::DictionaryValue> response, |
477 const DaemonController::UsageStatsConsent& consent) { | 508 const DaemonController::UsageStatsConsent& consent) { |
478 DCHECK(thread_checker_.CalledOnValidThread()); | 509 DCHECK(thread_checker_.CalledOnValidThread()); |
479 | 510 |
480 response->SetBoolean("supported", consent.supported); | 511 response->SetBoolean("supported", consent.supported); |
481 response->SetBoolean("allowed", consent.allowed); | 512 response->SetBoolean("allowed", consent.allowed); |
482 response->SetBoolean("setByPolicy", consent.set_by_policy); | 513 response->SetBoolean("setByPolicy", consent.set_by_policy); |
483 channel_->SendMessage(response.Pass()); | 514 channel_->SendMessage(response.Pass()); |
484 } | 515 } |
485 | 516 |
486 void Me2MeNativeMessagingHost::SendAsyncResult( | 517 void Me2MeNativeMessagingHost::SendAsyncSuccess( |
487 scoped_ptr<base::DictionaryValue> response, | 518 scoped_ptr<base::DictionaryValue> response) { |
488 DaemonController::AsyncResult result) { | |
489 DCHECK(thread_checker_.CalledOnValidThread()); | 519 DCHECK(thread_checker_.CalledOnValidThread()); |
490 | 520 |
491 switch (result) { | 521 response->SetString("result", "OK"); |
492 case DaemonController::RESULT_OK: | |
493 response->SetString("result", "OK"); | |
494 break; | |
495 case DaemonController::RESULT_FAILED: | |
496 response->SetString("result", "FAILED"); | |
497 break; | |
498 case DaemonController::RESULT_CANCELLED: | |
499 response->SetString("result", "CANCELLED"); | |
500 break; | |
501 case DaemonController::RESULT_FAILED_DIRECTORY: | |
502 response->SetString("result", "FAILED_DIRECTORY"); | |
503 break; | |
504 } | |
505 channel_->SendMessage(response.Pass()); | 522 channel_->SendMessage(response.Pass()); |
506 } | 523 } |
507 | 524 |
525 void Me2MeNativeMessagingHost::SendAsyncFailure( | |
526 scoped_ptr<base::DictionaryValue> response, | |
527 const std::string& error_message, | |
528 const tracked_objects::Location& location) { | |
529 DCHECK(thread_checker_.CalledOnValidThread()); | |
530 | |
531 response->SetString("result", "FAILED"); | |
532 response->SetString("error_message", error_message); | |
533 response->SetString("error_location", location.ToString()); | |
534 channel_->SendMessage(response.Pass()); | |
535 } | |
536 | |
508 void Me2MeNativeMessagingHost::SendBooleanResult( | 537 void Me2MeNativeMessagingHost::SendBooleanResult( |
509 scoped_ptr<base::DictionaryValue> response, bool result) { | 538 scoped_ptr<base::DictionaryValue> response, bool result) { |
510 DCHECK(thread_checker_.CalledOnValidThread()); | 539 DCHECK(thread_checker_.CalledOnValidThread()); |
511 | 540 |
512 response->SetBoolean("result", result); | 541 response->SetBoolean("result", result); |
513 channel_->SendMessage(response.Pass()); | 542 channel_->SendMessage(response.Pass()); |
514 } | 543 } |
515 | 544 |
516 void Me2MeNativeMessagingHost::SendCredentialsResponse( | 545 void Me2MeNativeMessagingHost::SendCredentialsResponse( |
517 scoped_ptr<base::DictionaryValue> response, | 546 scoped_ptr<base::DictionaryValue> response, |
518 const std::string& user_email, | 547 const std::string& user_email, |
519 const std::string& refresh_token) { | 548 const std::string& refresh_token) { |
520 DCHECK(thread_checker_.CalledOnValidThread()); | 549 DCHECK(thread_checker_.CalledOnValidThread()); |
521 | 550 |
522 if (!user_email.empty()) { | 551 if (!user_email.empty()) { |
523 response->SetString("userEmail", user_email); | 552 response->SetString("userEmail", user_email); |
524 } | 553 } |
525 response->SetString("refreshToken", refresh_token); | 554 response->SetString("refreshToken", refresh_token); |
526 channel_->SendMessage(response.Pass()); | 555 channel_->SendMessage(response.Pass()); |
527 } | 556 } |
528 | 557 |
529 void Me2MeNativeMessagingHost::OnError() { | |
530 // Trigger a host shutdown by sending a nullptr message. | |
531 channel_->SendMessage(nullptr); | |
532 } | |
533 | |
534 void Me2MeNativeMessagingHost::Stop() { | 558 void Me2MeNativeMessagingHost::Stop() { |
535 DCHECK(thread_checker_.CalledOnValidThread()); | 559 DCHECK(thread_checker_.CalledOnValidThread()); |
536 | 560 |
537 if (!quit_closure_.is_null()) | 561 if (!quit_closure_.is_null()) |
538 base::ResetAndReturn(&quit_closure_).Run(); | 562 base::ResetAndReturn(&quit_closure_).Run(); |
539 } | 563 } |
540 | 564 |
541 #if defined(OS_WIN) | 565 #if defined(OS_WIN) |
542 Me2MeNativeMessagingHost::ElevatedChannelEventHandler:: | 566 Me2MeNativeMessagingHost::ElevatedChannelEventHandler:: |
543 ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host) | 567 ElevatedChannelEventHandler(Me2MeNativeMessagingHost* host) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 | 759 |
736 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( | 760 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( |
737 scoped_ptr<base::DictionaryValue> message) { | 761 scoped_ptr<base::DictionaryValue> message) { |
738 NOTREACHED(); | 762 NOTREACHED(); |
739 return false; | 763 return false; |
740 } | 764 } |
741 | 765 |
742 #endif // !defined(OS_WIN) | 766 #endif // !defined(OS_WIN) |
743 | 767 |
744 } // namespace remoting | 768 } // namespace remoting |
OLD | NEW |