libchromeos: Replace scoped_ptr with std::unique_ptr in D-Bus method handlers

Changed callbacks to use std::unique_ptr in D-Bus method handlers instead of
scoped_ptr, now that we can do this with base::Callback.
This eliminates the need to mix scoped_ptr and std::unique_ptr in the same
translation unit.

Sweep the code in the rest of platform2 that used libchromeos's D-Bus framework.

BUG=None
TEST=`FEATURES=test emerge-link libchromeos apmanager attestation buffet chromeos-dbus-bindings`

Change-Id: I50289198ef9ab183d5bc7d0c8cc7a8f53085e5a4
Reviewed-on: https://chromium-review.googlesource.com/267337
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/daemon.cc b/daemon.cc
index 46882c6..15d457c 100644
--- a/daemon.cc
+++ b/daemon.cc
@@ -6,7 +6,6 @@
 
 #include <sysexits.h>
 
-#include <base/bind.h>
 #include <base/logging.h>
 #include <base/message_loop/message_loop_proxy.h>
 #include <base/run_loop.h>
diff --git a/daemon.h b/daemon.h
index 3588da9..cd6af1c 100644
--- a/daemon.h
+++ b/daemon.h
@@ -5,7 +5,7 @@
 #ifndef APMANAGER_DAEMON_H_
 #define APMANAGER_DAEMON_H_
 
-#include <base/cancelable_callback.h>
+#include <base/callback_forward.h>
 #include <chromeos/daemons/dbus_daemon.h>
 
 #include "apmanager/manager.h"
diff --git a/manager.cc b/manager.cc
index 2472777..959119d 100644
--- a/manager.cc
+++ b/manager.cc
@@ -54,11 +54,11 @@
 }
 
 void Manager::CreateService(
-    scoped_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
+    std::unique_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
     dbus::Message* message) {
   LOG(INFO) << "Manager::CreateService";
   scoped_refptr<AsyncEventSequencer> sequencer(new AsyncEventSequencer());
-  scoped_ptr<Service> service(new Service(this, service_identifier_));
+  std::unique_ptr<Service> service(new Service(this, service_identifier_));
 
   service->RegisterAsync(
       dbus_object_->GetObjectManager().get(), bus_, sequencer.get());
@@ -160,8 +160,8 @@
 }
 
 void Manager::OnServiceRegistered(
-    scoped_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
-    scoped_ptr<Service> service,
+    std::unique_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
+    std::unique_ptr<Service> service,
     bool success) {
   LOG(INFO) << "ServiceRegistered";
   // Success should always be true since we've said that failures are fatal.
@@ -181,7 +181,7 @@
   // Add service to the service list and return the service dbus path for the
   // CreateService call.
   dbus::ObjectPath service_path = service->dbus_path();
-  services_.push_back(std::unique_ptr<Service>(service.release()));
+  services_.push_back(std::move(service));
   response->Return(service_path);
 }
 
diff --git a/manager.h b/manager.h
index 0ee7766..9c5fb93 100644
--- a/manager.h
+++ b/manager.h
@@ -10,7 +10,6 @@
 #include <vector>
 
 #include <base/macros.h>
-#include <base/memory/scoped_ptr.h>
 #include <chromeos/dbus/dbus_service_watcher.h>
 
 #include "apmanager/dbus_adaptors/org.chromium.apmanager.Manager.h"
@@ -25,6 +24,9 @@
 class Manager : public org::chromium::apmanager::ManagerAdaptor,
                 public org::chromium::apmanager::ManagerInterface {
  public:
+  template<typename T>
+  using DBusMethodResponse = chromeos::dbus_utils::DBusMethodResponse<T>;
+
   Manager();
   virtual ~Manager();
 
@@ -33,8 +35,7 @@
   // This is an asynchronous call, response is invoked when Service and Config
   // dbus objects complete the DBus service registration.
   virtual void CreateService(
-      scoped_ptr<chromeos::dbus_utils::DBusMethodResponse<dbus::ObjectPath>>
-          response,
+      std::unique_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
       dbus::Message* message);
   // Handles calls to org.chromium.apmanager.Manager.RemoveService().
   virtual bool RemoveService(chromeos::ErrorPtr* error,
@@ -75,9 +76,8 @@
   // A callback that will be called when the Service/Config D-Bus
   // objects/interfaces are exported successfully and ready to be used.
   void OnServiceRegistered(
-      scoped_ptr<chromeos::dbus_utils::DBusMethodResponse<dbus::ObjectPath>>
-          response,
-      scoped_ptr<Service> service,
+      std::unique_ptr<DBusMethodResponse<dbus::ObjectPath>> response,
+      std::unique_ptr<Service> service,
       bool success);
 
   // A callback that will be called when a Device D-Bus object/interface is