Convert //components/[a-e]* from scoped_ptr to std::unique_ptr

BUG=554298
[email protected]
[email protected]

Review URL: https://codereview.chromium.org/1921973002

Cr-Commit-Position: refs/heads/master@{#389675}
diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
index 775e780..440def1e 100644
--- a/components/component_updater/component_updater_service.cc
+++ b/components/component_updater/component_updater_service.cc
@@ -17,7 +17,7 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
@@ -389,11 +389,11 @@
 // The component update factory. Using the component updater as a singleton
 // is the job of the browser process.
 // TODO(sorin): consider making this a singleton.
-scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
+std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
     const scoped_refptr<Configurator>& config) {
   DCHECK(config);
   auto update_client = update_client::UpdateClientFactory(config);
-  return scoped_ptr<ComponentUpdateService>(
+  return base::WrapUnique(
       new CrxUpdateService(config, std::move(update_client)));
 }
 
diff --git a/components/component_updater/component_updater_service.h b/components/component_updater/component_updater_service.h
index c7e59be5..27daa9ec 100644
--- a/components/component_updater/component_updater_service.h
+++ b/components/component_updater/component_updater_service.h
@@ -7,12 +7,12 @@
 
 #include <stdint.h>
 
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback_forward.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/version.h"
 #include "components/update_client/update_client.h"
 #include "url/gurl.h"
@@ -151,7 +151,7 @@
 };
 
 // Creates the component updater.
-scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
+std::unique_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
     const scoped_refptr<Configurator>& config);
 
 }  // namespace component_updater
diff --git a/components/component_updater/component_updater_service_internal.h b/components/component_updater/component_updater_service_internal.h
index 3e262c0..e20a315 100644
--- a/components/component_updater/component_updater_service_internal.h
+++ b/components/component_updater/component_updater_service_internal.h
@@ -11,7 +11,6 @@
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/sequenced_task_runner.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread_checker.h"
diff --git a/components/component_updater/component_updater_service_unittest.cc b/components/component_updater/component_updater_service_unittest.cc
index 83d5874e..fe29269 100644
--- a/components/component_updater/component_updater_service_unittest.cc
+++ b/components/component_updater/component_updater_service_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "components/component_updater/component_updater_service.h"
+
 #include <limits>
 #include <string>
 #include <vector>
@@ -11,20 +13,18 @@
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/macros.h"
+#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/test/histogram_tester.h"
 #include "base/test/sequenced_worker_pool_owner.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/values.h"
-#include "components/component_updater/component_updater_service.h"
 #include "components/component_updater/component_updater_service_internal.h"
 #include "components/update_client/test_configurator.h"
 #include "components/update_client/test_installer.h"
 #include "components/update_client/update_client.h"
-
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -116,11 +116,11 @@
   base::RunLoop runloop_;
   base::Closure quit_closure_;
 
-  scoped_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
+  std::unique_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
 
   scoped_refptr<TestConfigurator> config_;
   scoped_refptr<MockUpdateClient> update_client_;
-  scoped_ptr<ComponentUpdateService> component_updater_;
+  std::unique_ptr<ComponentUpdateService> component_updater_;
 
   DISALLOW_COPY_AND_ASSIGN(ComponentUpdaterTest);
 };
@@ -153,11 +153,10 @@
   return cus->GetOnDemandUpdater().OnDemandUpdate(id);
 }
 
-scoped_ptr<ComponentUpdateService> TestComponentUpdateServiceFactory(
+std::unique_ptr<ComponentUpdateService> TestComponentUpdateServiceFactory(
     const scoped_refptr<Configurator>& config) {
   DCHECK(config);
-  return scoped_ptr<ComponentUpdateService>(
-      new CrxUpdateService(config, new MockUpdateClient()));
+  return base::WrapUnique(new CrxUpdateService(config, new MockUpdateClient()));
 }
 
 ComponentUpdaterTest::ComponentUpdaterTest()
diff --git a/components/component_updater/default_component_installer.cc b/components/component_updater/default_component_installer.cc
index cb40ea2..1a7a317 100644
--- a/components/component_updater/default_component_installer.cc
+++ b/components/component_updater/default_component_installer.cc
@@ -38,7 +38,7 @@
 }
 
 DefaultComponentInstaller::DefaultComponentInstaller(
-    scoped_ptr<ComponentInstallerTraits> installer_traits)
+    std::unique_ptr<ComponentInstallerTraits> installer_traits)
     : current_version_(kNullVersion),
       main_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
   installer_traits_ = std::move(installer_traits);
@@ -117,10 +117,10 @@
     return false;
   }
   current_version_ = version;
-  // TODO(ddorwin): Change the parameter to scoped_ptr<base::DictionaryValue>
+  // TODO(ddorwin): Change parameter to std::unique_ptr<base::DictionaryValue>
   // so we can avoid this DeepCopy.
   current_manifest_.reset(manifest.DeepCopy());
-  scoped_ptr<base::DictionaryValue> manifest_copy(
+  std::unique_ptr<base::DictionaryValue> manifest_copy(
       current_manifest_->DeepCopy());
   main_task_runner_->PostTask(
       FROM_HERE,
@@ -162,7 +162,7 @@
 
   base::FilePath latest_path;
   base::Version latest_version(kNullVersion);
-  scoped_ptr<base::DictionaryValue> latest_manifest;
+  std::unique_ptr<base::DictionaryValue> latest_manifest;
 
   std::vector<base::FilePath> older_paths;
   base::FileEnumerator file_enumerator(
@@ -184,7 +184,7 @@
       continue;
     }
 
-    scoped_ptr<base::DictionaryValue> manifest =
+    std::unique_ptr<base::DictionaryValue> manifest =
         update_client::ReadManifest(path);
     if (!manifest || !installer_traits_->VerifyInstallation(*manifest, path)) {
       PLOG(ERROR) << "Failed to read manifest or verify installation for "
@@ -279,13 +279,13 @@
   if (!current_manifest_)
     return;
 
-  scoped_ptr<base::DictionaryValue> manifest_copy(
+  std::unique_ptr<base::DictionaryValue> manifest_copy(
       current_manifest_->DeepCopy());
   ComponentReady(std::move(manifest_copy));
 }
 
 void DefaultComponentInstaller::ComponentReady(
-    scoped_ptr<base::DictionaryValue> manifest) {
+    std::unique_ptr<base::DictionaryValue> manifest) {
   VLOG(1) << "Component ready, version " << current_version_.GetString()
           << " in " << GetInstallDirectory().value();
   installer_traits_->ComponentReady(current_version_, GetInstallDirectory(),
diff --git a/components/component_updater/default_component_installer.h b/components/component_updater/default_component_installer.h
index f445fe6..ff337df 100644
--- a/components/component_updater/default_component_installer.h
+++ b/components/component_updater/default_component_installer.h
@@ -6,13 +6,14 @@
 #define COMPONENTS_COMPONENT_UPDATER_DEFAULT_COMPONENT_INSTALLER_H_
 
 #include <stdint.h>
+
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "base/values.h"
 #include "base/version.h"
@@ -70,9 +71,10 @@
   // |version| is the version of the component.
   // |install_dir| is the path to the install directory for this version.
   // |manifest| is the manifest for this version of the component.
-  virtual void ComponentReady(const base::Version& version,
-                              const base::FilePath& install_dir,
-                              scoped_ptr<base::DictionaryValue> manifest) = 0;
+  virtual void ComponentReady(
+      const base::Version& version,
+      const base::FilePath& install_dir,
+      std::unique_ptr<base::DictionaryValue> manifest) = 0;
 
   // Returns the directory that the installer will place versioned installs of
   // the component into.
@@ -97,7 +99,7 @@
 class DefaultComponentInstaller : public update_client::CrxInstaller {
  public:
   DefaultComponentInstaller(
-      scoped_ptr<ComponentInstallerTraits> installer_traits);
+      std::unique_ptr<ComponentInstallerTraits> installer_traits);
 
   // Registers the component for update checks and installs.
   // The passed |callback| will be called once the initial check for installed
@@ -122,13 +124,13 @@
   void StartRegistration(ComponentUpdateService* cus);
   void FinishRegistration(ComponentUpdateService* cus,
                           const base::Closure& callback);
-  void ComponentReady(scoped_ptr<base::DictionaryValue> manifest);
+  void ComponentReady(std::unique_ptr<base::DictionaryValue> manifest);
   void UninstallOnTaskRunner();
 
   base::Version current_version_;
   std::string current_fingerprint_;
-  scoped_ptr<base::DictionaryValue> current_manifest_;
-  scoped_ptr<ComponentInstallerTraits> installer_traits_;
+  std::unique_ptr<base::DictionaryValue> current_manifest_;
+  std::unique_ptr<ComponentInstallerTraits> installer_traits_;
   scoped_refptr<base::SequencedTaskRunner> task_runner_;
 
   // Used to post responses back to the main thread. Initialized on the main