update_engine: Replace scoped_ptr with std::unique_ptr.

BUG=None
TEST=`FEATURES=test emerge-$BOARD update_engine`
TEST=`USE='clang asan' FEATURES=test emerge-$BOARD update_engine`

Change-Id: I55a2f7f53675faaac20ba25f72ed52cf938d7744
Reviewed-on: https://chromium-review.googlesource.com/224189
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/update_manager/boxed_value.h b/update_manager/boxed_value.h
index 1ad9946..200464f 100644
--- a/update_manager/boxed_value.h
+++ b/update_manager/boxed_value.h
@@ -5,6 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_BOXED_VALUE_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_BOXED_VALUE_H_
 
+#include <memory>
 #include <string>
 
 #include <base/macros.h>
@@ -12,10 +13,10 @@
 namespace chromeos_update_manager {
 
 // BoxedValue is a class to hold pointers of a given type that deletes them when
-// the instance goes out of scope, as scoped_ptr<T> does. The main difference
-// with it is that the type T is not part of the class, i.e., this isn't a
-// parametric class. The class has a parametric constructor that accepts a
-// const T* which will define the type of the object passed on delete.
+// the instance goes out of scope, as std::unique_ptr<T> does. The main
+// difference with it is that the type T is not part of the class, i.e., this
+// isn't a parametric class. The class has a parametric constructor that accepts
+// a const T* which will define the type of the object passed on delete.
 //
 // It is safe to use this class in linked containers such as std::list and
 // std::map but the object can't be copied. This means that you need to
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index 6c1848f..1673609 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -5,6 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_DEFAULT_POLICY_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_DEFAULT_POLICY_H_
 
+#include <memory>
 #include <string>
 
 #include <base/time/time.h>
@@ -74,7 +75,7 @@
   chromeos_update_engine::ClockInterface* clock_;
 
   // An auxiliary state object.
-  scoped_ptr<DefaultPolicyState> aux_state_;
+  std::unique_ptr<DefaultPolicyState> aux_state_;
 
   DISALLOW_COPY_AND_ASSIGN(DefaultPolicy);
 };
diff --git a/update_manager/evaluation_context.cc b/update_manager/evaluation_context.cc
index e334560..9ab6771 100644
--- a/update_manager/evaluation_context.cc
+++ b/update_manager/evaluation_context.cc
@@ -5,6 +5,7 @@
 #include "update_engine/update_manager/evaluation_context.h"
 
 #include <algorithm>
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
@@ -20,6 +21,7 @@
 using base::TimeDelta;
 using chromeos_update_engine::ClockInterface;
 using std::string;
+using std::unique_ptr;
 
 namespace {
 
@@ -52,11 +54,11 @@
     ClockInterface* clock,
     TimeDelta evaluation_timeout,
     TimeDelta expiration_timeout,
-    scoped_ptr<Callback<void(EvaluationContext*)>> unregister_cb)
+    unique_ptr<Callback<void(EvaluationContext*)>> unregister_cb)
     : clock_(clock),
       evaluation_timeout_(evaluation_timeout),
       expiration_timeout_(expiration_timeout),
-      unregister_cb_(unregister_cb.Pass()),
+      unregister_cb_(std::move(unregister_cb)),
       weak_ptr_factory_(this) {
   ResetEvaluation();
   ResetExpiration();
@@ -68,7 +70,7 @@
     unregister_cb_->Run(this);
 }
 
-scoped_ptr<Closure> EvaluationContext::RemoveObserversAndTimeout() {
+unique_ptr<Closure> EvaluationContext::RemoveObserversAndTimeout() {
   for (auto& it : value_cache_) {
     if (it.first->GetMode() == kVariableModeAsync)
       it.first->RemoveObserver(this);
@@ -76,7 +78,7 @@
   CancelMainLoopEvent(timeout_event_);
   timeout_event_ = kEventIdNull;
 
-  return scoped_ptr<Closure>(callback_.release());
+  return unique_ptr<Closure>(callback_.release());
 }
 
 TimeDelta EvaluationContext::RemainingTime(Time monotonic_deadline) const {
@@ -106,7 +108,7 @@
 
 void EvaluationContext::OnValueChangedOrTimeout() {
   // Copy the callback handle locally, allowing it to be reassigned.
-  scoped_ptr<Closure> callback = RemoveObserversAndTimeout();
+  unique_ptr<Closure> callback = RemoveObserversAndTimeout();
 
   if (callback.get())
     callback->Run();
diff --git a/update_manager/evaluation_context.h b/update_manager/evaluation_context.h
index a6d8f70..e7fba00 100644
--- a/update_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -6,12 +6,12 @@
 #define UPDATE_ENGINE_UPDATE_MANAGER_EVALUATION_CONTEXT_H_
 
 #include <map>
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
 #include <base/callback.h>
 #include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/memory/weak_ptr.h>
 #include <base/time/time.h>
 
@@ -57,12 +57,12 @@
       chromeos_update_engine::ClockInterface* clock,
       base::TimeDelta evaluation_timeout,
       base::TimeDelta expiration_timeout,
-      scoped_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb);
+      std::unique_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb);
   EvaluationContext(chromeos_update_engine::ClockInterface* clock,
                     base::TimeDelta evaluation_timeout)
       : EvaluationContext(
           clock, evaluation_timeout, base::TimeDelta::Max(),
-          scoped_ptr<base::Callback<void(EvaluationContext*)>>()) {}
+          std::unique_ptr<base::Callback<void(EvaluationContext*)>>()) {}
   ~EvaluationContext();
 
   // Returns a pointer to the value returned by the passed variable |var|. The
@@ -113,7 +113,7 @@
   // Removes all the Observers callbacks and timeout events scheduled by
   // RunOnValueChangeOrTimeout(). Also releases and returns the closure
   // associated with these events. This method is idempotent.
-  scoped_ptr<base::Closure> RemoveObserversAndTimeout();
+  std::unique_ptr<base::Closure> RemoveObserversAndTimeout();
 
  private:
   friend class UmEvaluationContextTest;
@@ -147,7 +147,7 @@
   // timeout, or notifying about the evaluation context expiration. It is up to
   // the caller to determine whether or not expiration occurred via
   // is_expired().
-  scoped_ptr<base::Closure> callback_;
+  std::unique_ptr<base::Closure> callback_;
 
   // The EventId returned by the event loop identifying the timeout callback.
   // Used for canceling the timeout callback.
@@ -193,7 +193,7 @@
   base::Time expiration_monotonic_deadline_;
 
   // A callback for unregistering the context upon destruction.
-  scoped_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb_;
+  std::unique_ptr<base::Callback<void(EvaluationContext*)>> unregister_cb_;
 
   base::WeakPtrFactory<EvaluationContext> weak_ptr_factory_;
 
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index e59b160..014d10c 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
@@ -23,6 +24,7 @@
 using chromeos_update_engine::RunGMainLoopMaxIterations;
 using chromeos_update_engine::RunGMainLoopUntil;
 using std::string;
+using std::unique_ptr;
 using testing::Return;
 using testing::StrictMock;
 using testing::_;
@@ -75,7 +77,7 @@
     fake_clock_.SetWallclockTime(Time::FromTimeT(1141262625));
     eval_ctx_ = new EvaluationContext(
         &fake_clock_, default_timeout_, default_timeout_,
-        scoped_ptr<base::Callback<void(EvaluationContext*)>>(nullptr));
+        unique_ptr<base::Callback<void(EvaluationContext*)>>(nullptr));
   }
 
   virtual void TearDown() {
diff --git a/update_manager/fake_variable.h b/update_manager/fake_variable.h
index 2dae3db..9459fac 100644
--- a/update_manager/fake_variable.h
+++ b/update_manager/fake_variable.h
@@ -5,10 +5,9 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_VARIABLE_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_VARIABLE_H_
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
-
 #include "update_engine/update_manager/variable.h"
 
 namespace chromeos_update_manager {
@@ -53,7 +52,7 @@
 
  private:
   // The pointer returned by GetValue().
-  scoped_ptr<const T> ptr_;
+  std::unique_ptr<const T> ptr_;
 
   DISALLOW_COPY_AND_ASSIGN(FakeVariable);
 };
diff --git a/update_manager/generic_variables_unittest.cc b/update_manager/generic_variables_unittest.cc
index 634acce..f0ea60c 100644
--- a/update_manager/generic_variables_unittest.cc
+++ b/update_manager/generic_variables_unittest.cc
@@ -4,8 +4,9 @@
 
 #include "update_engine/update_manager/generic_variables.h"
 
+#include <memory>
+
 #include <base/callback.h>
-#include <base/memory/scoped_ptr.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/test_utils.h"
@@ -13,6 +14,7 @@
 
 using base::TimeDelta;
 using chromeos_update_engine::RunGMainLoopMaxIterations;
+using std::unique_ptr;
 
 namespace chromeos_update_manager {
 
@@ -25,7 +27,7 @@
   PollCopyVariable<int> var("var", source);
 
   // Generate and validate a copy.
-  scoped_ptr<const int> copy_1(var.GetValue(
+  unique_ptr<const int> copy_1(var.GetValue(
           UmTestUtils::DefaultTimeout(), nullptr));
   ASSERT_NE(nullptr, copy_1.get());
   EXPECT_EQ(5, *copy_1);
@@ -75,7 +77,7 @@
   ASSERT_FALSE(source.copied_);
 
   PollCopyVariable<CopyConstructorTestClass> var("var", source);
-  scoped_ptr<const CopyConstructorTestClass> copy(
+  unique_ptr<const CopyConstructorTestClass> copy(
       var.GetValue(UmTestUtils::DefaultTimeout(), nullptr));
   ASSERT_NE(nullptr, copy.get());
   EXPECT_TRUE(copy->copied_);
@@ -114,7 +116,7 @@
       test_func, &test_obj);
   CallCopyVariable<CopyConstructorTestClass> var("var", cb);
 
-  scoped_ptr<const CopyConstructorTestClass> copy(
+  unique_ptr<const CopyConstructorTestClass> copy(
       var.GetValue(UmTestUtils::DefaultTimeout(), nullptr));
   EXPECT_EQ(6, test_obj.val_);  // Check that the function was called.
   ASSERT_NE(nullptr, copy.get());
diff --git a/update_manager/real_config_provider.h b/update_manager/real_config_provider.h
index cc87c40..82c9284 100644
--- a/update_manager/real_config_provider.h
+++ b/update_manager/real_config_provider.h
@@ -5,10 +5,9 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_CONFIG_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_CONFIG_PROVIDER_H_
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
-
 #include "update_engine/hardware_interface.h"
 #include "update_engine/update_manager/config_provider.h"
 #include "update_engine/update_manager/generic_variables.h"
@@ -39,7 +38,7 @@
     root_prefix_ = prefix;
   }
 
-  scoped_ptr<ConstCopyVariable<bool>> var_is_oobe_enabled_;
+  std::unique_ptr<ConstCopyVariable<bool>> var_is_oobe_enabled_;
 
   chromeos_update_engine::HardwareInterface* hardware_;
 
diff --git a/update_manager/real_config_provider_unittest.cc b/update_manager/real_config_provider_unittest.cc
index ab47d03..6e8d301 100644
--- a/update_manager/real_config_provider_unittest.cc
+++ b/update_manager/real_config_provider_unittest.cc
@@ -4,9 +4,10 @@
 
 #include "update_engine/update_manager/real_config_provider.h"
 
+#include <memory>
+
 #include <base/files/file_util.h>
 #include <base/files/scoped_temp_dir.h>
-#include <base/memory/scoped_ptr.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/constants.h"
@@ -17,6 +18,7 @@
 using base::TimeDelta;
 using chromeos_update_engine::WriteFileString;
 using std::string;
+using std::unique_ptr;
 
 namespace chromeos_update_manager {
 
@@ -43,7 +45,7 @@
     ASSERT_TRUE(WriteFileString(kFile.value(), config));
   }
 
-  scoped_ptr<RealConfigProvider> provider_;
+  unique_ptr<RealConfigProvider> provider_;
   chromeos_update_engine::FakeHardware fake_hardware_;
   TimeDelta default_timeout_ = TimeDelta::FromSeconds(1);
   base::ScopedTempDir root_dir_;
diff --git a/update_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
index 0f000a8..52b036b 100644
--- a/update_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "update_engine/update_manager/real_device_policy_provider.h"
 
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+
 #include <gtest/gtest.h>
 #include <policy/mock_device_policy.h>
 #include <policy/mock_libpolicy.h>
@@ -16,6 +17,7 @@
 using chromeos_update_engine::RunGMainLoopMaxIterations;
 using std::set;
 using std::string;
+using std::unique_ptr;
 using testing::AtLeast;
 using testing::DoAll;
 using testing::Mock;
@@ -60,7 +62,7 @@
 
   testing::NiceMock<policy::MockDevicePolicy> mock_device_policy_;
   testing::NiceMock<policy::MockPolicyProvider> mock_policy_provider_;
-  scoped_ptr<RealDevicePolicyProvider> provider_;
+  unique_ptr<RealDevicePolicyProvider> provider_;
 };
 
 TEST_F(UmRealDevicePolicyProviderTest, RefreshScheduledTest) {
diff --git a/update_manager/real_random_provider.h b/update_manager/real_random_provider.h
index 2e36d6f..d159933 100644
--- a/update_manager/real_random_provider.h
+++ b/update_manager/real_random_provider.h
@@ -5,7 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_RANDOM_PROVIDER_H_
 
-#include <base/memory/scoped_ptr.h>
+#include <memory>
 
 #include "update_engine/update_manager/random_provider.h"
 
@@ -23,7 +23,7 @@
 
  private:
   // The seed() scoped variable.
-  scoped_ptr<Variable<uint64_t>> var_seed_;
+  std::unique_ptr<Variable<uint64_t>> var_seed_;
 
   DISALLOW_COPY_AND_ASSIGN(RealRandomProvider);
 };
diff --git a/update_manager/real_random_provider_unittest.cc b/update_manager/real_random_provider_unittest.cc
index b7e48f2..d7b2d98 100644
--- a/update_manager/real_random_provider_unittest.cc
+++ b/update_manager/real_random_provider_unittest.cc
@@ -2,13 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/memory/scoped_ptr.h>
 #include <gtest/gtest.h>
 
+#include <memory>
+
 #include "update_engine/update_manager/real_random_provider.h"
 #include "update_engine/update_manager/umtest_utils.h"
 
 using base::TimeDelta;
+using std::unique_ptr;
 
 namespace chromeos_update_manager {
 
@@ -23,7 +25,7 @@
     provider_->var_seed();
   }
 
-  scoped_ptr<RealRandomProvider> provider_;
+  unique_ptr<RealRandomProvider> provider_;
 };
 
 TEST_F(UmRealRandomProviderTest, InitFinalize) {
@@ -33,7 +35,7 @@
 
 TEST_F(UmRealRandomProviderTest, GetRandomValues) {
   // Should not return the same random seed repeatedly.
-  scoped_ptr<const uint64_t> value(
+  unique_ptr<const uint64_t> value(
       provider_->var_seed()->GetValue(UmTestUtils::DefaultTimeout(), nullptr));
   ASSERT_NE(nullptr, value.get());
 
@@ -41,7 +43,7 @@
   // by design, once every 2^320 runs.
   bool is_same_value = true;
   for (int i = 0; i < 5; i++) {
-    scoped_ptr<const uint64_t> other_value(
+    unique_ptr<const uint64_t> other_value(
         provider_->var_seed()->GetValue(UmTestUtils::DefaultTimeout(),
                                         nullptr));
     ASSERT_NE(nullptr, other_value.get());
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 1cdc2a9..7c64d81 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
 #include <utility>
 
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 #include <chromeos/dbus/service_constants.h>
 #include <glib.h>
@@ -23,6 +23,7 @@
 using chromeos_update_engine::GValueNewString;
 using chromeos_update_engine::MockDBusWrapper;
 using std::pair;
+using std::unique_ptr;
 using testing::Eq;
 using testing::Mock;
 using testing::NiceMock;
@@ -294,7 +295,7 @@
 
   StrictMock<MockDBusWrapper> mock_dbus_;
   FakeClock fake_clock_;
-  scoped_ptr<RealShillProvider> provider_;
+  unique_ptr<RealShillProvider> provider_;
   void (*signal_handler_)(DBusGProxy*, const char*, GValue*, void*);
   void* signal_data_;
 };
diff --git a/update_manager/real_state.h b/update_manager/real_state.h
index 1e2d10e..824656f 100644
--- a/update_manager/real_state.h
+++ b/update_manager/real_state.h
@@ -5,7 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_STATE_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_STATE_H_
 
-#include <base/memory/scoped_ptr.h>
+#include <memory>
 
 #include "update_engine/update_manager/state.h"
 
@@ -56,13 +56,13 @@
 
  private:
   // Instances of the providers.
-  scoped_ptr<ConfigProvider> config_provider_;
-  scoped_ptr<DevicePolicyProvider> device_policy_provider_;
-  scoped_ptr<RandomProvider> random_provider_;
-  scoped_ptr<ShillProvider> shill_provider_;
-  scoped_ptr<SystemProvider> system_provider_;
-  scoped_ptr<TimeProvider> time_provider_;
-  scoped_ptr<UpdaterProvider> updater_provider_;
+  std::unique_ptr<ConfigProvider> config_provider_;
+  std::unique_ptr<DevicePolicyProvider> device_policy_provider_;
+  std::unique_ptr<RandomProvider> random_provider_;
+  std::unique_ptr<ShillProvider> shill_provider_;
+  std::unique_ptr<SystemProvider> system_provider_;
+  std::unique_ptr<TimeProvider> time_provider_;
+  std::unique_ptr<UpdaterProvider> updater_provider_;
 };
 
 }  // namespace chromeos_update_manager
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index c040855..9081d94 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -5,8 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_SYSTEM_PROVIDER_H_
 
-#include <base/memory/scoped_ptr.h>
-
+#include <memory>
 #include <string>
 
 #include "update_engine/hardware_interface.h"
@@ -41,10 +40,10 @@
   }
 
  private:
-  scoped_ptr<Variable<bool>> var_is_normal_boot_mode_;
-  scoped_ptr<Variable<bool>> var_is_official_build_;
-  scoped_ptr<Variable<bool>> var_is_oobe_complete_;
-  scoped_ptr<Variable<bool>> var_is_boot_device_removable_;
+  std::unique_ptr<Variable<bool>> var_is_normal_boot_mode_;
+  std::unique_ptr<Variable<bool>> var_is_official_build_;
+  std::unique_ptr<Variable<bool>> var_is_oobe_complete_;
+  std::unique_ptr<Variable<bool>> var_is_boot_device_removable_;
 
   chromeos_update_engine::HardwareInterface* hardware_;
 
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index f78d339..e370274 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -4,13 +4,16 @@
 
 #include "update_engine/update_manager/real_system_provider.h"
 
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+
 #include <base/time/time.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/fake_hardware.h"
 #include "update_engine/update_manager/umtest_utils.h"
 
+using std::unique_ptr;
+
 namespace chromeos_update_manager {
 
 class UmRealSystemProviderTest : public ::testing::Test {
@@ -21,7 +24,7 @@
   }
 
   chromeos_update_engine::FakeHardware fake_hardware_;
-  scoped_ptr<RealSystemProvider> provider_;
+  unique_ptr<RealSystemProvider> provider_;
 };
 
 TEST_F(UmRealSystemProviderTest, InitTest) {
diff --git a/update_manager/real_time_provider.h b/update_manager/real_time_provider.h
index ff5598e..63fc116 100644
--- a/update_manager/real_time_provider.h
+++ b/update_manager/real_time_provider.h
@@ -5,7 +5,8 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_TIME_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_TIME_PROVIDER_H_
 
-#include <base/memory/scoped_ptr.h>
+#include <memory>
+
 #include <base/time/time.h>
 
 #include "update_engine/clock_interface.h"
@@ -34,8 +35,8 @@
   // A clock abstraction (fakeable).
   chromeos_update_engine::ClockInterface* const clock_;
 
-  scoped_ptr<Variable<base::Time>> var_curr_date_;
-  scoped_ptr<Variable<int>> var_curr_hour_;
+  std::unique_ptr<Variable<base::Time>> var_curr_date_;
+  std::unique_ptr<Variable<int>> var_curr_hour_;
 
   DISALLOW_COPY_AND_ASSIGN(RealTimeProvider);
 };
diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
index ac47d39..da69e49 100644
--- a/update_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -2,8 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
+
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 #include <gtest/gtest.h>
 
@@ -14,6 +15,7 @@
 using base::Time;
 using base::TimeDelta;
 using chromeos_update_engine::FakeClock;
+using std::unique_ptr;
 
 namespace chromeos_update_manager {
 
@@ -41,7 +43,7 @@
   }
 
   FakeClock fake_clock_;
-  scoped_ptr<RealTimeProvider> provider_;
+  unique_ptr<RealTimeProvider> provider_;
 };
 
 TEST_F(UmRealTimeProviderTest, CurrDateValid) {
diff --git a/update_manager/real_updater_provider.h b/update_manager/real_updater_provider.h
index c61032e..7317417 100644
--- a/update_manager/real_updater_provider.h
+++ b/update_manager/real_updater_provider.h
@@ -5,10 +5,9 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_REAL_UPDATER_PROVIDER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_REAL_UPDATER_PROVIDER_H_
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
-
 #include "update_engine/system_state.h"
 #include "update_engine/update_manager/generic_variables.h"
 #include "update_engine/update_manager/updater_provider.h"
@@ -91,19 +90,19 @@
 
   // Variable implementations.
   ConstCopyVariable<base::Time> var_updater_started_time_;
-  scoped_ptr<Variable<base::Time>> var_last_checked_time_;
-  scoped_ptr<Variable<base::Time>> var_update_completed_time_;
-  scoped_ptr<Variable<double>> var_progress_;
-  scoped_ptr<Variable<Stage>> var_stage_;
-  scoped_ptr<Variable<std::string>> var_new_version_;
-  scoped_ptr<Variable<int64_t>> var_payload_size_;
-  scoped_ptr<Variable<std::string>> var_curr_channel_;
-  scoped_ptr<Variable<std::string>> var_new_channel_;
-  scoped_ptr<Variable<bool>> var_p2p_enabled_;
-  scoped_ptr<Variable<bool>> var_cellular_enabled_;
-  scoped_ptr<Variable<unsigned int>> var_consecutive_failed_update_checks_;
-  scoped_ptr<Variable<unsigned int>> var_server_dictated_poll_interval_;
-  scoped_ptr<Variable<UpdateRequestStatus>> var_forced_update_requested_;
+  std::unique_ptr<Variable<base::Time>> var_last_checked_time_;
+  std::unique_ptr<Variable<base::Time>> var_update_completed_time_;
+  std::unique_ptr<Variable<double>> var_progress_;
+  std::unique_ptr<Variable<Stage>> var_stage_;
+  std::unique_ptr<Variable<std::string>> var_new_version_;
+  std::unique_ptr<Variable<int64_t>> var_payload_size_;
+  std::unique_ptr<Variable<std::string>> var_curr_channel_;
+  std::unique_ptr<Variable<std::string>> var_new_channel_;
+  std::unique_ptr<Variable<bool>> var_p2p_enabled_;
+  std::unique_ptr<Variable<bool>> var_cellular_enabled_;
+  std::unique_ptr<Variable<unsigned int>> var_consecutive_failed_update_checks_;
+  std::unique_ptr<Variable<unsigned int>> var_server_dictated_poll_interval_;
+  std::unique_ptr<Variable<UpdateRequestStatus>> var_forced_update_requested_;
 
   DISALLOW_COPY_AND_ASSIGN(RealUpdaterProvider);
 };
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index 6d614da..ab0ee20 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -4,9 +4,9 @@
 
 #include "update_engine/update_manager/real_updater_provider.h"
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 #include <chromeos/dbus/service_constants.h>
 #include <gtest/gtest.h>
@@ -26,6 +26,7 @@
 using chromeos_update_engine::PrefsMock;
 using chromeos_update_engine::UpdateAttempterMock;
 using std::string;
+using std::unique_ptr;
 using testing::Return;
 using testing::SetArgPointee;
 using testing::StrEq;
@@ -108,7 +109,7 @@
 
   FakeSystemState fake_sys_state_;
   FakeClock* fake_clock_;  // Short for fake_sys_state_.fake_clock()
-  scoped_ptr<RealUpdaterProvider> provider_;
+  unique_ptr<RealUpdaterProvider> provider_;
 };
 
 TEST_F(UmRealUpdaterProviderTest, UpdaterStartedTimeIsWallclockTime) {
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index e9b576a..745f0f5 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -4,8 +4,9 @@
 
 #include "update_engine/update_manager/state_factory.h"
 
+#include <memory>
+
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 
 #include "update_engine/clock_interface.h"
 #include "update_engine/update_manager/real_config_provider.h"
@@ -17,23 +18,25 @@
 #include "update_engine/update_manager/real_time_provider.h"
 #include "update_engine/update_manager/real_updater_provider.h"
 
+using std::unique_ptr;
+
 namespace chromeos_update_manager {
 
 State* DefaultStateFactory(policy::PolicyProvider* policy_provider,
                            chromeos_update_engine::DBusWrapperInterface* dbus,
                            chromeos_update_engine::SystemState* system_state) {
   chromeos_update_engine::ClockInterface* const clock = system_state->clock();
-  scoped_ptr<RealConfigProvider> config_provider(
+  unique_ptr<RealConfigProvider> config_provider(
       new RealConfigProvider(system_state->hardware()));
-  scoped_ptr<RealDevicePolicyProvider> device_policy_provider(
+  unique_ptr<RealDevicePolicyProvider> device_policy_provider(
       new RealDevicePolicyProvider(policy_provider));
-  scoped_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
-  scoped_ptr<RealShillProvider> shill_provider(
+  unique_ptr<RealRandomProvider> random_provider(new RealRandomProvider());
+  unique_ptr<RealShillProvider> shill_provider(
       new RealShillProvider(dbus, clock));
-  scoped_ptr<RealSystemProvider> system_provider(
+  unique_ptr<RealSystemProvider> system_provider(
       new RealSystemProvider(system_state->hardware()));
-  scoped_ptr<RealTimeProvider> time_provider(new RealTimeProvider(clock));
-  scoped_ptr<RealUpdaterProvider> updater_provider(
+  unique_ptr<RealTimeProvider> time_provider(new RealTimeProvider(clock));
+  unique_ptr<RealUpdaterProvider> updater_provider(
       new RealUpdaterProvider(system_state));
 
   if (!(config_provider->Init() &&
diff --git a/update_manager/umtest_utils.h b/update_manager/umtest_utils.h
index 4e2de8e..c50a5a2 100644
--- a/update_manager/umtest_utils.h
+++ b/update_manager/umtest_utils.h
@@ -6,8 +6,8 @@
 #define UPDATE_ENGINE_UPDATE_MANAGER_UMTEST_UTILS_H_
 
 #include <iostream>  // NOLINT(readability/streams)
+#include <memory>
 
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 #include <gtest/gtest.h>
 
@@ -28,7 +28,8 @@
   template<typename T>
   static void ExpectVariableHasValue(const T& expected, Variable<T>* variable) {
     ASSERT_NE(nullptr, variable);
-    scoped_ptr<const T> value(variable->GetValue(DefaultTimeout(), nullptr));
+    std::unique_ptr<const T> value(
+        variable->GetValue(DefaultTimeout(), nullptr));
     ASSERT_NE(nullptr, value.get()) << "Variable: " << variable->GetName();
     EXPECT_EQ(expected, *value) << "Variable: " << variable->GetName();
   }
@@ -37,7 +38,8 @@
   template<typename T>
   static void ExpectVariableNotSet(Variable<T>* variable) {
     ASSERT_NE(nullptr, variable);
-    scoped_ptr<const T> value(variable->GetValue(DefaultTimeout(), nullptr));
+    std::unique_ptr<const T> value(
+        variable->GetValue(DefaultTimeout(), nullptr));
     EXPECT_EQ(nullptr, value.get()) << "Variable: " << variable->GetName();
   }
 
diff --git a/update_manager/update_manager-inl.h b/update_manager/update_manager-inl.h
index a9f051f..5e30031 100644
--- a/update_manager/update_manager-inl.h
+++ b/update_manager/update_manager-inl.h
@@ -5,6 +5,7 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_INL_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_INL_H_
 
+#include <memory>
 #include <string>
 
 #include <base/bind.h>
@@ -129,7 +130,7 @@
   scoped_refptr<EvaluationContext> ec =
       new EvaluationContext(
           clock_, evaluation_timeout_, expiration_timeout_,
-          scoped_ptr<base::Callback<void(EvaluationContext*)>>(
+          std::unique_ptr<base::Callback<void(EvaluationContext*)>>(
               new base::Callback<void(EvaluationContext*)>(
                   base::Bind(&UpdateManager::UnregisterEvalContext,
                              weak_ptr_factory_.GetWeakPtr()))));
diff --git a/update_manager/update_manager.h b/update_manager/update_manager.h
index 3355b60..cf7c6d5 100644
--- a/update_manager/update_manager.h
+++ b/update_manager/update_manager.h
@@ -5,12 +5,12 @@
 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_H_
 #define UPDATE_ENGINE_UPDATE_MANAGER_UPDATE_MANAGER_H_
 
+#include <memory>
 #include <set>
 #include <string>
 
 #include <base/callback.h>
 #include <base/memory/ref_counted.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 
 #include "update_engine/clock_interface.h"
@@ -127,14 +127,14 @@
 
   // The policy used by the UpdateManager. Note that since it is a const Policy,
   // policy implementations are not allowed to persist state on this class.
-  scoped_ptr<const Policy> policy_;
+  std::unique_ptr<const Policy> policy_;
 
   // A safe default value to the current policy. This policy is used whenever
   // a policy implementation fails with EvalStatus::kFailed.
   const DefaultPolicy default_policy_;
 
   // State Providers.
-  scoped_ptr<State> state_;
+  std::unique_ptr<State> state_;
 
   // Pointer to the mockable clock interface;
   chromeos_update_engine::ClockInterface* clock_;
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index 9e21716..b263fc8 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -5,13 +5,13 @@
 #include <unistd.h>
 
 #include <algorithm>
+#include <memory>
 #include <string>
 #include <tuple>
 #include <utility>
 #include <vector>
 
 #include <base/bind.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/time/time.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
@@ -33,6 +33,7 @@
 using std::pair;
 using std::string;
 using std::tuple;
+using std::unique_ptr;
 using std::vector;
 using testing::Return;
 using testing::StrictMock;
@@ -68,7 +69,7 @@
 
   FakeState* fake_state_;  // Owned by the umut_.
   FakeClock fake_clock_;
-  scoped_ptr<UpdateManager> umut_;
+  unique_ptr<UpdateManager> umut_;
 };
 
 // The FailingPolicy implements a single method and make it always fail. This