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/delta_performer.cc b/delta_performer.cc
index 63aed33..f2ed85f 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -9,12 +9,12 @@
 
 #include <algorithm>
 #include <cstring>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include <base/files/file_util.h>
 #include <base/format_macros.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <google/protobuf/repeated_field.h>
@@ -35,6 +35,7 @@
 using google::protobuf::RepeatedPtrField;
 using std::min;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 namespace chromeos_update_engine {
@@ -590,7 +591,7 @@
 
   DirectExtentWriter direct_writer;
   ZeroPadExtentWriter zero_pad_writer(&direct_writer);
-  scoped_ptr<BzipExtentWriter> bzip_writer;
+  unique_ptr<BzipExtentWriter> bzip_writer;
 
   // Since bzip decompression is optional, we have a variable writer that will
   // point to one of the ExtentWriter objects above.
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index 44ecb64..dd0994e 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -10,7 +10,6 @@
 #include <vector>
 
 #include <base/files/file_util.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <google/protobuf/repeated_field.h>
diff --git a/download_action.h b/download_action.h
index e53ee34..8e3809a 100644
--- a/download_action.h
+++ b/download_action.h
@@ -9,9 +9,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <memory>
 #include <string>
 
-#include <base/memory/scoped_ptr.h>
 #include <curl/curl.h>
 
 #include "update_engine/action.h"
@@ -113,13 +113,13 @@
   SystemState* system_state_;
 
   // Pointer to the HttpFetcher that does the http work.
-  scoped_ptr<HttpFetcher> http_fetcher_;
+  std::unique_ptr<HttpFetcher> http_fetcher_;
 
   // The FileWriter that downloaded data should be written to. It will
   // either point to *decompressing_file_writer_ or *delta_performer_.
   FileWriter* writer_;
 
-  scoped_ptr<DeltaPerformer> delta_performer_;
+  std::unique_ptr<DeltaPerformer> delta_performer_;
 
   // Used by TransferTerminated to figure if this action terminated itself or
   // was terminated by the action processor.
diff --git a/download_action_unittest.cc b/download_action_unittest.cc
index c3eb9de..0bdeacf 100644
--- a/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -6,6 +6,7 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
@@ -27,6 +28,7 @@
 namespace chromeos_update_engine {
 
 using std::string;
+using std::unique_ptr;
 using std::vector;
 using testing::_;
 using testing::AtLeast;
@@ -515,13 +517,13 @@
   }
 
   // The DownloadAction instance under test.
-  scoped_ptr<DownloadAction> download_action_;
+  unique_ptr<DownloadAction> download_action_;
 
   // The HttpFetcher used in the test.
   MockHttpFetcher* http_fetcher_;
 
   // The P2PManager used in the test.
-  scoped_ptr<P2PManager> p2p_manager_;
+  unique_ptr<P2PManager> p2p_manager_;
 
   // The ActionProcessor used for running the actions.
   ActionProcessor processor_;
diff --git a/http_fetcher_unittest.cc b/http_fetcher_unittest.cc
index 531986f..0e67ce9 100644
--- a/http_fetcher_unittest.cc
+++ b/http_fetcher_unittest.cc
@@ -7,12 +7,12 @@
 #include <sys/socket.h>
 #include <unistd.h>
 
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <base/time/time.h>
@@ -31,6 +31,7 @@
 using std::make_pair;
 using std::pair;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 using base::TimeDelta;
@@ -421,10 +422,10 @@
   {
     HttpFetcherTestDelegate delegate;
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
     fetcher->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     StartTransferArgs start_xfer_args = {
@@ -441,10 +442,10 @@
   {
     HttpFetcherTestDelegate delegate;
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
     fetcher->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     StartTransferArgs start_xfer_args = {
@@ -469,10 +470,10 @@
     // Delegate should expect an error response.
     delegate.is_expect_error_ = true;
 
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
     fetcher->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     StartTransferArgs start_xfer_args = {
@@ -533,13 +534,13 @@
   GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE);
   {
     PausingHttpFetcherTestDelegate delegate;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
     delegate.paused_ = false;
     delegate.loop_ = loop;
     delegate.fetcher_ = fetcher.get();
     fetcher->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     guint callback_id = g_timeout_add(kHttpResponseInternalServerError,
@@ -580,7 +581,7 @@
   }
   bool once_;
   bool callback_once_;
-  scoped_ptr<HttpFetcher> fetcher_;
+  unique_ptr<HttpFetcher> fetcher_;
   GMainLoop* loop_;
 };
 
@@ -607,7 +608,7 @@
     delegate.loop_ = loop;
     delegate.fetcher_->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     this->test_.IgnoreServerAborting(server.get());
     ASSERT_TRUE(server->started_);
 
@@ -653,10 +654,10 @@
   {
     FlakyHttpFetcherTestDelegate delegate;
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
     fetcher->set_delegate(&delegate);
 
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     StartTransferArgs start_xfer_args = {
@@ -731,7 +732,7 @@
   {
     FailureHttpFetcherTestDelegate delegate(nullptr);
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
     fetcher->set_delegate(&delegate);
 
     StartTransferArgs start_xfer_args = {
@@ -762,7 +763,7 @@
     // Handles destruction and claims ownership.
     FailureHttpFetcherTestDelegate delegate(server);
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
+    unique_ptr<HttpFetcher> fetcher(this->test_.NewSmallFetcher());
     fetcher->set_delegate(&delegate);
 
     StartTransferArgs start_xfer_args = {
@@ -822,7 +823,7 @@
   {
     RedirectHttpFetcherTestDelegate delegate(expected_successful);
     delegate.loop_ = loop;
-    scoped_ptr<HttpFetcher> fetcher(http_fetcher);
+    unique_ptr<HttpFetcher> fetcher(http_fetcher);
     fetcher->set_delegate(&delegate);
 
     StartTransferArgs start_xfer_args =
@@ -847,7 +848,7 @@
   if (this->test_.IsMock())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   for (size_t c = 0; c < arraysize(kRedirectCodes); ++c) {
@@ -862,7 +863,7 @@
   if (this->test_.IsMock())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   string url;
@@ -878,7 +879,7 @@
   if (this->test_.IsMock())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   string url;
@@ -916,7 +917,7 @@
     ADD_FAILURE();
   }
 
-  scoped_ptr<HttpFetcher> fetcher_;
+  unique_ptr<HttpFetcher> fetcher_;
   int expected_response_code_;
   string data;
   GMainLoop* loop_;
@@ -971,7 +972,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -989,7 +990,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -1006,7 +1007,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -1024,7 +1025,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -1050,7 +1051,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -1072,7 +1073,7 @@
   if (!this->test_.IsMulti())
     return;
 
-  scoped_ptr<HttpServer> server(this->test_.CreateServer());
+  unique_ptr<HttpServer> server(this->test_.CreateServer());
   ASSERT_TRUE(server->started_);
 
   vector<pair<off_t, off_t>> ranges;
@@ -1114,7 +1115,7 @@
     return;
 
   for (int i = 0; i < 2; i++) {
-    scoped_ptr<HttpServer> server(this->test_.CreateServer());
+    unique_ptr<HttpServer> server(this->test_.CreateServer());
     ASSERT_TRUE(server->started_);
 
     GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE);
@@ -1123,7 +1124,7 @@
       delegate.loop_ = loop;
 
       bool is_allowed = (i != 0);
-      scoped_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
+      unique_ptr<HttpFetcher> fetcher(this->test_.NewLargeFetcher());
 
       bool is_official_build = (i == 1);
       LOG(INFO) << "is_update_allowed_over_connection: " << is_allowed;
diff --git a/multi_range_http_fetcher.h b/multi_range_http_fetcher.h
index 5b167b2..ae25f45 100644
--- a/multi_range_http_fetcher.h
+++ b/multi_range_http_fetcher.h
@@ -6,12 +6,11 @@
 #define UPDATE_ENGINE_MULTI_RANGE_HTTP_FETCHER_H_
 
 #include <deque>
+#include <memory>
 #include <string>
 #include <utility>
 #include <vector>
 
-#include <base/memory/scoped_ptr.h>
-
 #include "update_engine/http_fetcher.h"
 
 // This class is a simple wrapper around an HttpFetcher. The client
@@ -139,7 +138,7 @@
 
   void Reset();
 
-  scoped_ptr<HttpFetcher> base_fetcher_;
+  std::unique_ptr<HttpFetcher> base_fetcher_;
 
   // If true, do not send any more data or TransferComplete to the delegate.
   bool base_fetcher_active_;
diff --git a/omaha_request_action.h b/omaha_request_action.h
index a4d9fdf..4501a84 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -9,10 +9,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
-#include <base/memory/scoped_ptr.h>
 #include <curl/curl.h>
 
 #include "update_engine/action.h"
@@ -265,10 +265,10 @@
   OmahaRequestParams* params_;
 
   // Pointer to the OmahaEvent info. This is an UpdateCheck request if null.
-  scoped_ptr<OmahaEvent> event_;
+  std::unique_ptr<OmahaEvent> event_;
 
   // pointer to the HttpFetcher that does the http work
-  scoped_ptr<HttpFetcher> http_fetcher_;
+  std::unique_ptr<HttpFetcher> http_fetcher_;
 
   // If true, only include the <ping> element in the request.
   bool ping_only_;
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 2ec827a..b1383e2 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -25,6 +25,7 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 #include <utility>
 #include <vector>
 
@@ -42,6 +43,7 @@
 using std::map;
 using std::pair;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 namespace chromeos_update_engine {
@@ -139,7 +141,7 @@
   const policy::DevicePolicy* device_policy_;
 
   // Configuration object.
-  scoped_ptr<Configuration> configuration_;
+  unique_ptr<Configuration> configuration_;
 
   // Object for persisted state.
   PrefsInterface* prefs_;
@@ -235,7 +237,7 @@
   gint exit_status = 0;
 
   vector<string> args = configuration_->GetInitctlArgs(should_be_running);
-  scoped_ptr<gchar*, GLibStrvFreeDeleter> argv(
+  unique_ptr<gchar*, GLibStrvFreeDeleter> argv(
       utils::StringVectorToGStrv(args));
   if (!g_spawn_sync(nullptr,  // working_directory
                     argv.get(),
@@ -250,7 +252,7 @@
                << ": " << utils::GetAndFreeGError(&error);
     return false;
   }
-  scoped_ptr<gchar, GLibFreeDeleter> standard_error_deleter(standard_error);
+  unique_ptr<gchar, GLibFreeDeleter> standard_error_deleter(standard_error);
 
   if (!WIFEXITED(exit_status)) {
     LOG(ERROR) << "Error spawning '" << utils::StringVectorToString(args)
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index 59ab152..fb582f9 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -10,6 +10,8 @@
 #include <unistd.h>
 #include <attr/xattr.h>  // NOLINT - requires typed defined in unistd.h
 
+#include <memory>
+
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
@@ -26,6 +28,7 @@
 #include "update_engine/utils.h"
 
 using std::string;
+using std::unique_ptr;
 using std::vector;
 using base::TimeDelta;
 
@@ -59,7 +62,7 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
   EXPECT_FALSE(manager->IsP2PEnabled());
 
@@ -75,7 +78,7 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
   EXPECT_FALSE(manager->IsP2PEnabled());
   prefs.SetBoolean(kPrefsP2PEnabled, true);
@@ -95,9 +98,9 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
-  scoped_ptr<policy::MockDevicePolicy> device_policy(
+  unique_ptr<policy::MockDevicePolicy> device_policy(
       new policy::MockDevicePolicy());
   EXPECT_CALL(*device_policy, GetAuP2PEnabled(testing::_)).WillRepeatedly(
       DoAll(testing::SetArgumentPointee<0>(true),
@@ -121,9 +124,9 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
-  scoped_ptr<policy::MockDevicePolicy> device_policy(
+  unique_ptr<policy::MockDevicePolicy> device_policy(
       new policy::MockDevicePolicy());
   EXPECT_CALL(*device_policy, GetAuP2PEnabled(testing::_)).WillRepeatedly(
       DoAll(testing::SetArgumentPointee<0>(false),
@@ -150,9 +153,9 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
-  scoped_ptr<policy::MockDevicePolicy> device_policy(
+  unique_ptr<policy::MockDevicePolicy> device_policy(
       new policy::MockDevicePolicy());
   // We return an empty owner as this is an enterprise.
   EXPECT_CALL(*device_policy, GetOwner(testing::_)).WillRepeatedly(
@@ -175,9 +178,9 @@
                                        &temp_dir));
   prefs.Init(base::FilePath(temp_dir));
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        &prefs, "cros_au", 3));
-  scoped_ptr<policy::MockDevicePolicy> device_policy(
+  unique_ptr<policy::MockDevicePolicy> device_policy(
       new policy::MockDevicePolicy());
   // We return an empty owner as this is an enterprise.
   EXPECT_CALL(*device_policy, GetOwner(testing::_)).WillRepeatedly(
@@ -195,7 +198,7 @@
 
 // Check that we keep the $N newest files with the .$EXT.p2p extension.
 TEST_F(P2PManagerTest, Housekeeping) {
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
   EXPECT_EQ(manager->CountSharedFiles(), 0);
 
@@ -350,7 +353,7 @@
     return;
   }
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
   EXPECT_TRUE(manager->FileShare("foo", 10 * 1000 * 1000));
   EXPECT_EQ(manager->FileGetPath("foo"),
@@ -373,7 +376,7 @@
     return;
   }
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
   // First, check that it's not visible.
   manager->FileShare("foo", 10*1000*1000);
@@ -400,7 +403,7 @@
     return;
   }
 
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
   bool visible;
 
@@ -441,7 +444,7 @@
 // will have to do. E.g. we essentially simulate the various
 // behaviours of initctl(8) that we rely on.
 TEST_F(P2PManagerTest, StartP2P) {
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
 
   // Check that we can start the service
@@ -459,7 +462,7 @@
 
 // Same comment as for StartP2P
 TEST_F(P2PManagerTest, StopP2P) {
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
 
   // Check that we can start the service
@@ -485,7 +488,7 @@
 // Like StartP2P, we're mocking the different results that p2p-client
 // can return. It's not pretty but it works.
 TEST_F(P2PManagerTest, LookupURL) {
-  scoped_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
+  unique_ptr<P2PManager> manager(P2PManager::Construct(test_conf_,
                                                        nullptr, "cros_au", 3));
   GMainLoop *loop = g_main_loop_new(nullptr, FALSE);
 
diff --git a/payload_generator/delta_diff_generator.cc b/payload_generator/delta_diff_generator.cc
index f960377..60755db 100644
--- a/payload_generator/delta_diff_generator.cc
+++ b/payload_generator/delta_diff_generator.cc
@@ -12,6 +12,7 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 #include <set>
 #include <string>
 #include <utility>
@@ -20,7 +21,6 @@
 #include <base/files/file_util.h>
 #include <base/files/file_path.h>
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/strings/string_number_conversions.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
@@ -53,6 +53,7 @@
 using std::pair;
 using std::set;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 namespace {
@@ -1603,7 +1604,7 @@
 
   const string kTempFileTemplate("CrAU_temp_data.XXXXXX");
   string temp_file_path;
-  scoped_ptr<ScopedPathUnlinker> temp_file_unlinker;
+  unique_ptr<ScopedPathUnlinker> temp_file_unlinker;
   off_t data_file_size = 0;
 
   LOG(INFO) << "Reading files...";
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index 1393a6f..9dd493d 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -8,6 +8,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -21,6 +22,7 @@
 #include "update_engine/utils.h"
 
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 namespace chromeos_update_engine {
@@ -157,7 +159,7 @@
   // get a loop device we can use for the install device
   string dev = "/dev/null";
 
-  scoped_ptr<ScopedLoopbackDeviceBinder> loop_releaser;
+  unique_ptr<ScopedLoopbackDeviceBinder> loop_releaser;
   if (do_losetup) {
     loop_releaser.reset(new ScopedLoopbackDeviceBinder(cwd + "/image.dat",
                                                        &dev));
diff --git a/real_system_state.h b/real_system_state.h
index 47c71ae..7e0c16d 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -7,6 +7,8 @@
 
 #include "update_engine/system_state.h"
 
+#include <memory>
+
 #include <metrics/metrics_library.h>
 #include <policy/device_policy.h>
 
@@ -117,9 +119,9 @@
   // Common parameters for all Omaha requests.
   OmahaRequestParams request_params_;
 
-  scoped_ptr<P2PManager> p2p_manager_;
+  std::unique_ptr<P2PManager> p2p_manager_;
 
-  scoped_ptr<chromeos_update_manager::UpdateManager> update_manager_;
+  std::unique_ptr<chromeos_update_manager::UpdateManager> update_manager_;
 
   policy::PolicyProvider policy_provider_;
 
diff --git a/subprocess.cc b/subprocess.cc
index 76be10c..253ba17 100644
--- a/subprocess.cc
+++ b/subprocess.cc
@@ -8,11 +8,11 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include <base/logging.h>
-#include <base/memory/scoped_ptr.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 
@@ -20,6 +20,7 @@
 
 using std::shared_ptr;
 using std::string;
+using std::unique_ptr;
 using std::vector;
 
 namespace chromeos_update_engine {
@@ -127,7 +128,7 @@
                           ExecCallback callback,
                           void* p) {
   GPid child_pid;
-  scoped_ptr<char*[]> argv(new char*[cmd.size() + 1]);
+  unique_ptr<char*[]> argv(new char*[cmd.size() + 1]);
   for (unsigned int i = 0; i < cmd.size(); i++) {
     argv[i] = strdup(cmd[i].c_str());
     if (!argv[i]) {
@@ -196,7 +197,7 @@
     *stdout = "";
   }
   GError* err = nullptr;
-  scoped_ptr<char*[]> argv(new char*[cmd.size() + 1]);
+  unique_ptr<char*[]> argv(new char*[cmd.size() + 1]);
   for (unsigned int i = 0; i < cmd.size(); i++) {
     argv[i] = strdup(cmd[i].c_str());
     if (!argv[i]) {
diff --git a/test_utils.h b/test_utils.h
index 37d552f..cf6cb96 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -9,12 +9,12 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <memory>
 #include <set>
 #include <string>
 #include <vector>
 
 #include <base/callback.h>
-#include <base/memory/scoped_ptr.h>
 #include <glib-object.h>
 #include <gtest/gtest.h>
 
@@ -186,7 +186,7 @@
   const std::string& GetPath() { return path_; }
  private:
   std::string path_;
-  scoped_ptr<ScopedPathUnlinker> unlinker_;
+  std::unique_ptr<ScopedPathUnlinker> unlinker_;
 };
 
 // Useful actions for test
@@ -270,9 +270,9 @@
   //   ScopedFilesystemUnmounter (the file system must be unmounted first)
   //   ScopedLoopbackDeviceBinder (then the loop device can be deleted)
   //   ScopedDirRemover (then the mount point can be deleted)
-  scoped_ptr<ScopedDirRemover> dir_remover_;
-  scoped_ptr<ScopedLoopbackDeviceBinder> loop_binder_;
-  scoped_ptr<ScopedFilesystemUnmounter> unmounter_;
+  std::unique_ptr<ScopedDirRemover> dir_remover_;
+  std::unique_ptr<ScopedLoopbackDeviceBinder> loop_binder_;
+  std::unique_ptr<ScopedFilesystemUnmounter> unmounter_;
 };
 
 // Runs the default GLib main loop for at most |timeout_msec| or until the
diff --git a/update_attempter.h b/update_attempter.h
index 82663e8..7732c08 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -397,7 +397,7 @@
   base::TimeTicks last_notify_time_;
 
   std::vector<std::shared_ptr<AbstractAction>> actions_;
-  scoped_ptr<ActionProcessor> processor_;
+  std::unique_ptr<ActionProcessor> processor_;
 
   // External state of the system outside the update_engine process
   // carved out separately to mock out easily in unit tests.
@@ -422,7 +422,7 @@
   PrefsInterface* prefs_ = nullptr;
 
   // Pending error event, if any.
-  scoped_ptr<OmahaEvent> error_event_;
+  std::unique_ptr<OmahaEvent> error_event_;
 
   // If we should request a reboot even tho we failed the update
   bool fake_update_success_ = false;
@@ -480,7 +480,7 @@
   bool start_action_processor_ = false;
 
   // Used for fetching information about the device policy.
-  scoped_ptr<policy::PolicyProvider> policy_provider_;
+  std::unique_ptr<policy::PolicyProvider> policy_provider_;
 
   // The current scatter factor as found in the policy setting.
   base::TimeDelta scatter_factor_;
@@ -504,7 +504,7 @@
   // cleared by an update attempt (false). The second argument indicates whether
   // this is an interactive update, and its value is significant iff the first
   // argument is true.
-  scoped_ptr<base::Callback<void(bool, bool)>>  // NOLINT(readability/function)
+  std::unique_ptr<base::Callback<void(bool, bool)>>
       forced_update_pending_callback_;
 
   // The |app_version| and |omaha_url| parameters received during the latest
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 5286169..0bfc31d 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -4,6 +4,8 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include <base/files/file_util.h>
 #include <gtest/gtest.h>
 #include <policy/libpolicy.h>
@@ -29,6 +31,7 @@
 using base::Time;
 using base::TimeDelta;
 using std::string;
+using std::unique_ptr;
 using testing::_;
 using testing::DoAll;
 using testing::InSequence;
@@ -178,7 +181,7 @@
 };
 
 TEST_F(UpdateAttempterTest, ActionCompletedDownloadTest) {
-  scoped_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, nullptr));
+  unique_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, nullptr));
   fetcher->FailTransfer(503);  // Sets the HTTP response code.
   DownloadAction action(prefs_, nullptr, fetcher.release());
   EXPECT_CALL(*prefs_, GetInt64(kPrefsDeltaUpdateFailures, _)).Times(0);
@@ -199,7 +202,7 @@
 }
 
 TEST_F(UpdateAttempterTest, ActionCompletedOmahaRequestTest) {
-  scoped_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, nullptr));
+  unique_ptr<MockHttpFetcher> fetcher(new MockHttpFetcher("", 0, nullptr));
   fetcher->FailTransfer(500);  // Sets the HTTP response code.
   OmahaRequestAction action(&fake_system_state_, nullptr,
                             fetcher.release(), false);
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
diff --git a/utils.h b/utils.h
index 5cd6595..647f52c 100644
--- a/utils.h
+++ b/utils.h
@@ -10,6 +10,7 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 #include <set>
 #include <string>
 #include <vector>
@@ -580,7 +581,7 @@
 };
 
 // A base::FreeDeleter that frees memory using g_free(). Useful when
-// integrating with GLib since it can be used with scoped_ptr to
+// integrating with GLib since it can be used with std::unique_ptr to
 // automatically free memory when going out of scope.
 struct GLibFreeDeleter : public base::FreeDeleter {
   inline void operator()(void *ptr) const {
@@ -589,7 +590,7 @@
 };
 
 // A base::FreeDeleter that frees memory using g_strfreev(). Useful
-// when integrating with GLib since it can be used with scoped_ptr to
+// when integrating with GLib since it can be used with std::unique_ptr to
 // automatically free memory when going out of scope.
 struct GLibStrvFreeDeleter : public base::FreeDeleter {
   inline void operator()(void *ptr) const {