Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: chromeos/dbus/bluetooth_agent_service_provider.cc

Issue 660663003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chromeos/dbus/bluetooth_agent_service_provider.h" 5 #include "chromeos/dbus/bluetooth_agent_service_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 switch (status) { 340 switch (status) {
341 case Delegate::SUCCESS: { 341 case Delegate::SUCCESS: {
342 scoped_ptr<dbus::Response> response( 342 scoped_ptr<dbus::Response> response(
343 dbus::Response::FromMethodCall(method_call)); 343 dbus::Response::FromMethodCall(method_call));
344 dbus::MessageWriter writer(response.get()); 344 dbus::MessageWriter writer(response.get());
345 writer.AppendString(pincode); 345 writer.AppendString(pincode);
346 response_sender.Run(response.Pass()); 346 response_sender.Run(response.Pass());
347 break; 347 break;
348 } 348 }
349 case Delegate::REJECTED: { 349 case Delegate::REJECTED: {
350 response_sender.Run( 350 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
351 dbus::ErrorResponse::FromMethodCall( 351 method_call, bluetooth_agent::kErrorRejected, "rejected"));
352 method_call, bluetooth_agent::kErrorRejected, "rejected")
353 .PassAs<dbus::Response>());
354 break; 352 break;
355 } 353 }
356 case Delegate::CANCELLED: { 354 case Delegate::CANCELLED: {
357 response_sender.Run( 355 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
358 dbus::ErrorResponse::FromMethodCall( 356 method_call, bluetooth_agent::kErrorCanceled, "canceled"));
359 method_call, bluetooth_agent::kErrorCanceled, "canceled")
360 .PassAs<dbus::Response>());
361 break; 357 break;
362 } 358 }
363 default: 359 default:
364 NOTREACHED() << "Unexpected status code from delegate: " << status; 360 NOTREACHED() << "Unexpected status code from delegate: " << status;
365 } 361 }
366 } 362 }
367 363
368 // Called by the Delegate to response to a method requesting a Passkey. 364 // Called by the Delegate to response to a method requesting a Passkey.
369 void OnPasskey(dbus::MethodCall* method_call, 365 void OnPasskey(dbus::MethodCall* method_call,
370 dbus::ExportedObject::ResponseSender response_sender, 366 dbus::ExportedObject::ResponseSender response_sender,
371 Delegate::Status status, 367 Delegate::Status status,
372 uint32 passkey) { 368 uint32 passkey) {
373 DCHECK(OnOriginThread()); 369 DCHECK(OnOriginThread());
374 370
375 switch (status) { 371 switch (status) {
376 case Delegate::SUCCESS: { 372 case Delegate::SUCCESS: {
377 scoped_ptr<dbus::Response> response( 373 scoped_ptr<dbus::Response> response(
378 dbus::Response::FromMethodCall(method_call)); 374 dbus::Response::FromMethodCall(method_call));
379 dbus::MessageWriter writer(response.get()); 375 dbus::MessageWriter writer(response.get());
380 writer.AppendUint32(passkey); 376 writer.AppendUint32(passkey);
381 response_sender.Run(response.Pass()); 377 response_sender.Run(response.Pass());
382 break; 378 break;
383 } 379 }
384 case Delegate::REJECTED: { 380 case Delegate::REJECTED: {
385 response_sender.Run( 381 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
386 dbus::ErrorResponse::FromMethodCall( 382 method_call, bluetooth_agent::kErrorRejected, "rejected"));
387 method_call, bluetooth_agent::kErrorRejected, "rejected")
388 .PassAs<dbus::Response>());
389 break; 383 break;
390 } 384 }
391 case Delegate::CANCELLED: { 385 case Delegate::CANCELLED: {
392 response_sender.Run( 386 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
393 dbus::ErrorResponse::FromMethodCall( 387 method_call, bluetooth_agent::kErrorCanceled, "canceled"));
394 method_call, bluetooth_agent::kErrorCanceled, "canceled")
395 .PassAs<dbus::Response>());
396 break; 388 break;
397 } 389 }
398 default: 390 default:
399 NOTREACHED() << "Unexpected status code from delegate: " << status; 391 NOTREACHED() << "Unexpected status code from delegate: " << status;
400 } 392 }
401 } 393 }
402 394
403 // Called by the Delegate in response to a method requiring confirmation. 395 // Called by the Delegate in response to a method requiring confirmation.
404 void OnConfirmation(dbus::MethodCall* method_call, 396 void OnConfirmation(dbus::MethodCall* method_call,
405 dbus::ExportedObject::ResponseSender response_sender, 397 dbus::ExportedObject::ResponseSender response_sender,
406 Delegate::Status status) { 398 Delegate::Status status) {
407 DCHECK(OnOriginThread()); 399 DCHECK(OnOriginThread());
408 400
409 switch (status) { 401 switch (status) {
410 case Delegate::SUCCESS: { 402 case Delegate::SUCCESS: {
411 response_sender.Run(dbus::Response::FromMethodCall(method_call)); 403 response_sender.Run(dbus::Response::FromMethodCall(method_call));
412 break; 404 break;
413 } 405 }
414 case Delegate::REJECTED: { 406 case Delegate::REJECTED: {
415 response_sender.Run( 407 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
416 dbus::ErrorResponse::FromMethodCall( 408 method_call, bluetooth_agent::kErrorRejected, "rejected"));
417 method_call, bluetooth_agent::kErrorRejected, "rejected")
418 .PassAs<dbus::Response>());
419 break; 409 break;
420 } 410 }
421 case Delegate::CANCELLED: { 411 case Delegate::CANCELLED: {
422 response_sender.Run( 412 response_sender.Run(dbus::ErrorResponse::FromMethodCall(
423 dbus::ErrorResponse::FromMethodCall( 413 method_call, bluetooth_agent::kErrorCanceled, "canceled"));
424 method_call, bluetooth_agent::kErrorCanceled, "canceled")
425 .PassAs<dbus::Response>());
426 break; 414 break;
427 } 415 }
428 default: 416 default:
429 NOTREACHED() << "Unexpected status code from delegate: " << status; 417 NOTREACHED() << "Unexpected status code from delegate: " << status;
430 } 418 }
431 } 419 }
432 420
433 // Origin thread (i.e. the UI thread in production). 421 // Origin thread (i.e. the UI thread in production).
434 base::PlatformThreadId origin_thread_id_; 422 base::PlatformThreadId origin_thread_id_;
435 423
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 const dbus::ObjectPath& object_path, 458 const dbus::ObjectPath& object_path,
471 Delegate* delegate) { 459 Delegate* delegate) {
472 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { 460 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) {
473 return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate); 461 return new BluetoothAgentServiceProviderImpl(bus, object_path, delegate);
474 } else { 462 } else {
475 return new FakeBluetoothAgentServiceProvider(object_path, delegate); 463 return new FakeBluetoothAgentServiceProvider(object_path, delegate);
476 } 464 }
477 } 465 }
478 466
479 } // namespace chromeos 467 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/cryptohome/homedir_methods_unittest.cc ('k') | chromeos/dbus/bluetooth_gatt_characteristic_service_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698