Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5421)

Unified Diff: chrome/installer/util/installer_state.cc

Issue 1878313003: Convert //chrome/installer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert decompress.cc in mini_installer. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/util/installer_state.h ('k') | chrome/installer/util/installer_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/installer_state.cc
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc
index 7f4d847108f4427da17b8ff592aca5cdeb4f7d32..56b701d0c980140c025b8bda1de1a50cf7fceb3d 100644
--- a/chrome/installer/util/installer_state.cc
+++ b/chrome/installer/util/installer_state.cc
@@ -8,6 +8,7 @@
#include <algorithm>
#include <functional>
+#include <memory>
#include <utility>
#include "base/command_line.h"
@@ -16,7 +17,6 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
@@ -265,7 +265,7 @@ bool InstallerState::CanAddProduct(const Product& product,
// returns a pointer to the product (ownership is held by this object).
Product* InstallerState::AddProductInDirectory(
const base::FilePath* product_dir,
- scoped_ptr<Product>* product) {
+ std::unique_ptr<Product>* product) {
DCHECK(product != NULL);
DCHECK(product->get() != NULL);
const Product& the_product = *product->get();
@@ -292,7 +292,7 @@ Product* InstallerState::AddProductInDirectory(
return products_[products_.size() - 1];
}
-Product* InstallerState::AddProduct(scoped_ptr<Product>* product) {
+Product* InstallerState::AddProduct(std::unique_ptr<Product>* product) {
return AddProductInDirectory(NULL, product);
}
@@ -305,9 +305,8 @@ Product* InstallerState::AddProductFromPreferences(
BrowserDistribution::Type distribution_type,
const MasterPreferences& prefs,
const InstallationState& machine_state) {
- scoped_ptr<Product> product_ptr(
- new Product(BrowserDistribution::GetSpecificDistribution(
- distribution_type)));
+ std::unique_ptr<Product> product_ptr(new Product(
+ BrowserDistribution::GetSpecificDistribution(distribution_type)));
product_ptr->InitializeFromPreferences(prefs);
Product* product = AddProductInDirectory(NULL, &product_ptr);
@@ -325,7 +324,7 @@ Product* InstallerState::AddProductFromPreferences(
Product* InstallerState::AddProductFromState(
BrowserDistribution::Type type,
const ProductState& state) {
- scoped_ptr<Product> product_ptr(
+ std::unique_ptr<Product> product_ptr(
new Product(BrowserDistribution::GetSpecificDistribution(type)));
product_ptr->InitializeFromUninstallCommand(state.uninstall_command());
@@ -374,7 +373,7 @@ const Product* InstallerState::FindProduct(
Version* InstallerState::GetCurrentVersion(
const InstallationState& machine_state) const {
DCHECK(!products_.empty());
- scoped_ptr<Version> current_version;
+ std::unique_ptr<Version> current_version;
// If we're doing a multi-install, the current version may be either an
// existing multi or an existing single product that is being migrated
// in place (i.e., Chrome). In the latter case, there is no existing
@@ -500,7 +499,7 @@ bool InstallerState::AnyExistsAndIsInUse(const InstallationState& machine_state,
// Check only for the current version (i.e., the version we are upgrading
// _from_). Later versions from pending in-use updates need not be checked
// since the current version is guaranteed to be in use if any such are.
- scoped_ptr<Version> current_version(GetCurrentVersion(machine_state));
+ std::unique_ptr<Version> current_version(GetCurrentVersion(machine_state));
if (!current_version)
return false;
base::FilePath directory(
@@ -526,7 +525,7 @@ void InstallerState::GetExistingExeVersions(
for (size_t i = 0; i < arraysize(kChromeFilenames); ++i) {
base::FilePath chrome_exe(target_path().Append(kChromeFilenames[i]));
- scoped_ptr<FileVersionInfo> file_version_info(
+ std::unique_ptr<FileVersionInfo> file_version_info(
FileVersionInfo::CreateFileVersionInfo(chrome_exe));
if (file_version_info) {
base::string16 version_string = file_version_info->file_version();
@@ -541,7 +540,7 @@ void InstallerState::RemoveOldVersionDirectories(
Version* existing_version,
const base::FilePath& temp_path) const {
Version version;
- scoped_ptr<WorkItem> item;
+ std::unique_ptr<WorkItem> item;
std::set<std::string> existing_version_strings;
existing_version_strings.insert(new_version.GetString());
@@ -672,7 +671,7 @@ void InstallerState::WriteInstallerResult(
int string_resource_id,
const std::wstring* const launch_cmd) const {
// Use a no-rollback list since this is a best-effort deal.
- scoped_ptr<WorkItemList> install_list(
+ std::unique_ptr<WorkItemList> install_list(
WorkItem::CreateNoRollbackWorkItemList());
const bool system_install = this->system_install();
// Write the value for all products upon which we're operating.
« no previous file with comments | « chrome/installer/util/installer_state.h ('k') | chrome/installer/util/installer_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698