Replace usage of base::Callback with std::function

Test: th
Change-Id: If1083578a78d33b0d149cce312dd36fc7ba5d8ce
diff --git a/aosp/binder_service_android.cc b/aosp/binder_service_android.cc
index e7c20c5..0f4b768 100644
--- a/aosp/binder_service_android.cc
+++ b/aosp/binder_service_android.cc
@@ -77,10 +77,7 @@
   auto binder_wrapper = android::BinderWrapper::Get();
   binder_wrapper->RegisterForDeathNotifications(
       callback_binder,
-      base::Bind(
-          base::IgnoreResult(&BinderUpdateEngineAndroidService::UnbindCallback),
-          base::Unretained(this),
-          base::Unretained(callback_binder.get())));
+      [this, callback = callback_binder.get()]() { UnbindCallback(callback); });
 
   *return_value = true;
   return Status::ok();
@@ -236,7 +233,7 @@
             update_engine::UpdateStatus::CLEANUP_PREVIOUS_UPDATE),
         progress));
   }
-  void RegisterForDeathNotifications(base::Closure unbind) {
+  void RegisterForDeathNotifications(const std::function<void()>& unbind) {
     const android::sp<android::IBinder>& callback_binder =
         IUpdateEngineCallback::asBinder(callback_);
     auto binder_wrapper = android::BinderWrapper::Get();
diff --git a/aosp/binder_service_stable_android.cc b/aosp/binder_service_stable_android.cc
index 9a9969d..3bc7f6c 100644
--- a/aosp/binder_service_stable_android.cc
+++ b/aosp/binder_service_stable_android.cc
@@ -82,10 +82,7 @@
   auto binder_wrapper = android::BinderWrapper::Get();
   binder_wrapper->RegisterForDeathNotifications(
       callback_binder,
-      base::Bind(base::IgnoreResult(
-                     &BinderUpdateEngineAndroidStableService::UnbindCallback),
-                 base::Unretained(this),
-                 base::Unretained(callback_binder.get())));
+      [this, callback = callback_binder.get()]() { UnbindCallback(callback); });
 
   *return_value = true;
   return Status::ok();
diff --git a/aosp/service_delegate_android_interface.h b/aosp/service_delegate_android_interface.h
index 981689d..45c0274 100644
--- a/aosp/service_delegate_android_interface.h
+++ b/aosp/service_delegate_android_interface.h
@@ -23,8 +23,7 @@
 #include <string>
 #include <vector>
 
-#include "base/callback_forward.h"
-#include "common/error.h"
+#include "update_engine/common/error.h"
 
 namespace chromeos_update_engine {
 
@@ -37,7 +36,8 @@
   virtual void OnCleanupProgressUpdate(double progress) = 0;
   virtual void OnCleanupComplete(int32_t error_code) = 0;
   // Call RegisterForDeathNotifications on the internal binder object.
-  virtual void RegisterForDeathNotifications(base::Closure unbind) = 0;
+  virtual void RegisterForDeathNotifications(
+      const std::function<void()>& unbind) = 0;
 };
 
 // This class defines the interface exposed by the Android version of the
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 2e0232b..0c834ad 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -1262,10 +1262,9 @@
   if (callback) {
     auto callback_ptr = callback.get();
     cleanup_previous_update_callbacks_.emplace_back(std::move(callback));
-    callback_ptr->RegisterForDeathNotifications(
-        base::Bind(&UpdateAttempterAndroid::RemoveCleanupPreviousUpdateCallback,
-                   base::Unretained(this),
-                   base::Unretained(callback_ptr)));
+    callback_ptr->RegisterForDeathNotifications([this, callback_ptr]() {
+      RemoveCleanupPreviousUpdateCallback(callback_ptr);
+    });
   }
   ScheduleCleanupPreviousUpdate();
 }
diff --git a/aosp/update_engine_client_android.cc b/aosp/update_engine_client_android.cc
index c00e9f5..81736a7 100644
--- a/aosp/update_engine_client_android.cc
+++ b/aosp/update_engine_client_android.cc
@@ -117,8 +117,7 @@
   android::BinderWrapper::Create();
   android::BinderWrapper::Get()->RegisterForDeathNotifications(
       android::os::IUpdateEngine::asBinder(service_),
-      base::Bind(&UpdateEngineClientAndroid::UpdateEngineServiceDied,
-                 base::Unretained(this)));
+      [this]() { UpdateEngineServiceDied(); });
 }
 
 int UpdateEngineClientAndroid::OnInit() {
@@ -207,7 +206,7 @@
   if (FLAGS_follow) {
     // Register a callback object with the service.
     callback_ = new UECallback(this);
-    bool bound;
+    bool bound = false;
     if (!service_->bind(callback_, &bound).isOk() || !bound) {
       LOG(ERROR) << "Failed to bind() the UpdateEngine daemon.";
       return 1;
diff --git a/payload_generator/extent_utils_unittest.cc b/payload_generator/extent_utils_unittest.cc
index 5467aa5..2046bf5 100644
--- a/payload_generator/extent_utils_unittest.cc
+++ b/payload_generator/extent_utils_unittest.cc
@@ -21,7 +21,6 @@
 
 #include <gtest/gtest.h>
 
-#include "update_engine/common/test_utils.h"
 #include "update_engine/payload_consumer/payload_constants.h"
 #include "update_engine/payload_generator/extent_ranges.h"