Commit d4c2a8f3 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] Make ExternalInstallInfo less pointer-y

Remove the std::unique_ptr<> members from ExternalInstallInfoFile and
ExternalInstallInfoUpdateUrl. These were used to hold the version and
url members, but each of these will never be null and are cheaply 
copyable (or, in the case of GURL, movable), so have no reason to
be pointers.

Bug: 770007
Change-Id: I4b9c3ef8c9888a2d460ab082a9fa3339423a5ee6
Reviewed-on: https://chromium-review.googlesource.com/691045
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505398}
parent 979d466d
...@@ -392,7 +392,7 @@ class TestExternalProvider : public ExternalProviderInterface { ...@@ -392,7 +392,7 @@ class TestExternalProvider : public ExternalProviderInterface {
visitor_->OnExternalExtensionUpdateUrlFound( visitor_->OnExternalExtensionUpdateUrlFound(
ExternalInstallInfoUpdateUrl( ExternalInstallInfoUpdateUrl(
extension_id_, std::string() /* install_parameter */, extension_id_, std::string() /* install_parameter */,
base::MakeUnique<GURL>(extension_urls::GetWebstoreUpdateUrl()), extension_urls::GetWebstoreUpdateUrl(),
Manifest::EXTERNAL_POLICY_DOWNLOAD, 0 /* creation_flags */, Manifest::EXTERNAL_POLICY_DOWNLOAD, 0 /* creation_flags */,
true /* mark_acknowledged */), true /* mark_acknowledged */),
true /* is_initial_load */); true /* is_initial_load */);
......
...@@ -236,7 +236,7 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound( ...@@ -236,7 +236,7 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound(
// install source. In this case, signal that this extension will not be // install source. In this case, signal that this extension will not be
// installed by returning false. // installed by returning false.
if (!pending_extension_manager()->AddFromExternalUpdateUrl( if (!pending_extension_manager()->AddFromExternalUpdateUrl(
info.extension_id, info.install_parameter, *info.update_url, info.extension_id, info.install_parameter, info.update_url,
info.download_location, info.creation_flags, info.download_location, info.creation_flags,
info.mark_acknowledged)) { info.mark_acknowledged)) {
return false; return false;
...@@ -2058,9 +2058,7 @@ bool ExtensionService::OnExternalExtensionFileFound( ...@@ -2058,9 +2058,7 @@ bool ExtensionService::OnExternalExtensionFileFound(
Manifest::IsExternalLocation(existing->location())); Manifest::IsExternalLocation(existing->location()));
if (!is_default_apps_migration) { if (!is_default_apps_migration) {
DCHECK(info.version.get()); switch (existing->version()->CompareTo(info.version)) {
switch (existing->version()->CompareTo(*info.version)) {
case -1: // existing version is older, we should upgrade case -1: // existing version is older, we should upgrade
break; break;
case 0: // existing version is same, do nothing case 0: // existing version is same, do nothing
...@@ -2070,7 +2068,7 @@ bool ExtensionService::OnExternalExtensionFileFound( ...@@ -2070,7 +2068,7 @@ bool ExtensionService::OnExternalExtensionFileFound(
<< info.extension_id << info.extension_id
<< "that is older than current version. Current version " << "that is older than current version. Current version "
<< "is: " << existing->VersionString() << ". New " << "is: " << existing->VersionString() << ". New "
<< "version is: " << info.version->GetString() << "version is: " << info.version.GetString()
<< ". Keeping current version."; << ". Keeping current version.";
return false; return false;
} }
...@@ -2079,7 +2077,7 @@ bool ExtensionService::OnExternalExtensionFileFound( ...@@ -2079,7 +2077,7 @@ bool ExtensionService::OnExternalExtensionFileFound(
// If the extension is already pending, don't start an install. // If the extension is already pending, don't start an install.
if (!pending_extension_manager()->AddFromExternalFile( if (!pending_extension_manager()->AddFromExternalFile(
info.extension_id, info.crx_location, *info.version, info.extension_id, info.crx_location, info.version,
info.creation_flags, info.mark_acknowledged)) { info.creation_flags, info.mark_acknowledged)) {
return false; return false;
} }
...@@ -2088,7 +2086,7 @@ bool ExtensionService::OnExternalExtensionFileFound( ...@@ -2088,7 +2086,7 @@ bool ExtensionService::OnExternalExtensionFileFound(
scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this)); scoped_refptr<CrxInstaller> installer(CrxInstaller::CreateSilent(this));
installer->set_install_source(info.crx_location); installer->set_install_source(info.crx_location);
installer->set_expected_id(info.extension_id); installer->set_expected_id(info.extension_id);
installer->set_expected_version(*info.version, installer->set_expected_version(info.version,
true /* fail_install_if_unexpected */); true /* fail_install_if_unexpected */);
installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE); installer->set_install_cause(extension_misc::INSTALL_CAUSE_EXTERNAL_FILE);
installer->set_install_immediately(info.install_immediately); installer->set_install_immediately(info.install_immediately);
......
...@@ -277,8 +277,8 @@ std::unique_ptr<ExternalInstallInfoFile> CreateExternalExtension( ...@@ -277,8 +277,8 @@ std::unique_ptr<ExternalInstallInfoFile> CreateExternalExtension(
Manifest::Location location, Manifest::Location location,
Extension::InitFromValueFlags flags) { Extension::InitFromValueFlags flags) {
return base::MakeUnique<ExternalInstallInfoFile>( return base::MakeUnique<ExternalInstallInfoFile>(
extension_id, base::MakeUnique<base::Version>(version_str), path, extension_id, base::Version(version_str), path, location, flags, false,
location, flags, false, false); false);
} }
// Helper function to persist the passed directories and file paths in // Helper function to persist the passed directories and file paths in
...@@ -422,13 +422,13 @@ class MockProviderVisitor ...@@ -422,13 +422,13 @@ class MockProviderVisitor
base::FilePath crx_path; base::FilePath crx_path;
EXPECT_TRUE(provider_->GetExtensionDetails(info.extension_id, NULL, &v1)); EXPECT_TRUE(provider_->GetExtensionDetails(info.extension_id, NULL, &v1));
EXPECT_STREQ(info.version->GetString().c_str(), v1->GetString().c_str()); EXPECT_EQ(info.version.GetString(), v1->GetString());
std::unique_ptr<base::Version> v2; std::unique_ptr<base::Version> v2;
EXPECT_TRUE( EXPECT_TRUE(
provider_->GetExtensionDetails(info.extension_id, &location, &v2)); provider_->GetExtensionDetails(info.extension_id, &location, &v2));
EXPECT_STREQ(info.version->GetString().c_str(), v1->GetString().c_str()); EXPECT_EQ(info.version.GetString(), v1->GetString());
EXPECT_STREQ(info.version->GetString().c_str(), v2->GetString().c_str()); EXPECT_EQ(info.version.GetString(), v2->GetString());
EXPECT_EQ(crx_location_, location); EXPECT_EQ(crx_location_, location);
// Remove it so we won't count it ever again. // Remove it so we won't count it ever again.
...@@ -4487,12 +4487,12 @@ TEST_F(ExtensionServiceTest, MAYBE_UpdatingPendingExternalExtensionWithFlags) { ...@@ -4487,12 +4487,12 @@ TEST_F(ExtensionServiceTest, MAYBE_UpdatingPendingExternalExtensionWithFlags) {
base::FilePath path = data_dir().AppendASCII("good.crx"); base::FilePath path = data_dir().AppendASCII("good.crx");
// Register and install an external extension. // Register and install an external extension.
std::unique_ptr<base::Version> version(new base::Version("1.0.0.0")); base::Version version("1.0.0.0");
content::WindowedNotificationObserver observer( content::WindowedNotificationObserver observer(
extensions::NOTIFICATION_CRX_INSTALLER_DONE, extensions::NOTIFICATION_CRX_INSTALLER_DONE,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
good_crx, std::move(version), path, Manifest::EXTERNAL_PREF, good_crx, version, path, Manifest::EXTERNAL_PREF,
Extension::FROM_BOOKMARK, false /* mark_acknowledged */, Extension::FROM_BOOKMARK, false /* mark_acknowledged */,
false /* install_immediately */)); false /* install_immediately */));
ASSERT_TRUE(service()->OnExternalExtensionFileFound(*info)); ASSERT_TRUE(service()->OnExternalExtensionFileFound(*info));
...@@ -5988,7 +5988,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) { ...@@ -5988,7 +5988,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) {
EXPECT_FALSE(pending->IsIdPending(kGoodId)); EXPECT_FALSE(pending->IsIdPending(kGoodId));
// Skip install when the location is the same. // Skip install when the location is the same.
std::unique_ptr<GURL> good_update_url(new GURL(kGoodUpdateURL)); GURL good_update_url(kGoodUpdateURL);
std::unique_ptr<ExternalInstallInfoUpdateUrl> info( std::unique_ptr<ExternalInstallInfoUpdateUrl> info(
new ExternalInstallInfoUpdateUrl( new ExternalInstallInfoUpdateUrl(
kGoodId, std::string(), std::move(good_update_url), kGoodId, std::string(), std::move(good_update_url),
...@@ -6051,12 +6051,9 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { ...@@ -6051,12 +6051,9 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
service()->pending_extension_manager(); service()->pending_extension_manager();
EXPECT_FALSE(pending->IsIdPending(kGoodId)); EXPECT_FALSE(pending->IsIdPending(kGoodId));
std::unique_ptr<base::Version> older_version_ptr(
new base::Version(older_version));
std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
kGoodId, std::move(older_version_ptr), kInvalidPathToCrx, kGoodId, older_version, kInvalidPathToCrx, Manifest::INTERNAL,
Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged, kCreationFlags, kDontMarkAcknowledged, kDontInstallImmediately));
kDontInstallImmediately));
{ {
// Simulate an external source adding the extension as INTERNAL. // Simulate an external source adding the extension as INTERNAL.
content::WindowedNotificationObserver observer( content::WindowedNotificationObserver observer(
...@@ -6133,29 +6130,29 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { ...@@ -6133,29 +6130,29 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) {
// older, or the same, and succeed if the version is newer. // older, or the same, and succeed if the version is newer.
// Older than the installed version... // Older than the installed version...
info->version.reset(new base::Version(older_version)); info->version = older_version;
EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
EXPECT_FALSE(pending->IsIdPending(kGoodId)); EXPECT_FALSE(pending->IsIdPending(kGoodId));
// Same version as the installed version... // Same version as the installed version...
info->version.reset(new base::Version(ext->VersionString())); info->version = *ext->version();
EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
EXPECT_FALSE(pending->IsIdPending(kGoodId)); EXPECT_FALSE(pending->IsIdPending(kGoodId));
// Newer than the installed version... // Newer than the installed version...
info->version.reset(new base::Version(newer_version)); info->version = newer_version;
EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
EXPECT_TRUE(pending->IsIdPending(kGoodId)); EXPECT_TRUE(pending->IsIdPending(kGoodId));
// An external install for a higher priority install source should succeed // An external install for a higher priority install source should succeed
// if the version is greater. |older_version| is not... // if the version is greater. |older_version| is not...
info->version.reset(new base::Version(older_version)); info->version = older_version;
info->crx_location = Manifest::EXTERNAL_PREF; info->crx_location = Manifest::EXTERNAL_PREF;
EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
EXPECT_TRUE(pending->IsIdPending(kGoodId)); EXPECT_TRUE(pending->IsIdPending(kGoodId));
// |newer_version| is newer. // |newer_version| is newer.
info->version.reset(new base::Version(newer_version)); info->version = newer_version;
EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
EXPECT_TRUE(pending->IsIdPending(kGoodId)); EXPECT_TRUE(pending->IsIdPending(kGoodId));
...@@ -6189,9 +6186,8 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { ...@@ -6189,9 +6186,8 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) {
// An external provider starts installing from a local crx. // An external provider starts installing from a local crx.
std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
kGoodId, base::MakeUnique<base::Version>(kVersion123), kGoodId, kVersion123, kInvalidPathToCrx, Manifest::EXTERNAL_PREF,
kInvalidPathToCrx, Manifest::EXTERNAL_PREF, kCreationFlags, kCreationFlags, kDontMarkAcknowledged, kDontInstallImmediately));
kDontMarkAcknowledged, kDontInstallImmediately));
EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
const extensions::PendingExtensionInfo* pending_info; const extensions::PendingExtensionInfo* pending_info;
...@@ -6200,14 +6196,14 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { ...@@ -6200,14 +6196,14 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) {
EXPECT_EQ(pending_info->version(), kVersion123); EXPECT_EQ(pending_info->version(), kVersion123);
// Adding a newer version overrides the currently pending version. // Adding a newer version overrides the currently pending version.
info->version.reset(new base::Version(kVersion124)); info->version = kVersion124;
EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info)); EXPECT_TRUE(service()->OnExternalExtensionFileFound(*info));
EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
EXPECT_TRUE(pending_info->version().IsValid()); EXPECT_TRUE(pending_info->version().IsValid());
EXPECT_EQ(pending_info->version(), kVersion124); EXPECT_EQ(pending_info->version(), kVersion124);
// Adding an older version fails. // Adding an older version fails.
info->version.reset(new base::Version(kVersion123)); info->version = kVersion123;
EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info)); EXPECT_FALSE(service()->OnExternalExtensionFileFound(*info));
EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
EXPECT_TRUE(pending_info->version().IsValid()); EXPECT_TRUE(pending_info->version().IsValid());
...@@ -6222,10 +6218,9 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { ...@@ -6222,10 +6218,9 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) {
EXPECT_EQ(pending_info->version(), kVersion124); EXPECT_EQ(pending_info->version(), kVersion124);
// Adding the latest version from the webstore overrides a specific version. // Adding the latest version from the webstore overrides a specific version.
GURL kUpdateUrl("http://example.com/update");
std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info( std::unique_ptr<ExternalInstallInfoUpdateUrl> update_info(
new ExternalInstallInfoUpdateUrl( new ExternalInstallInfoUpdateUrl(
kGoodId, std::string(), base::MakeUnique<GURL>(kUpdateUrl), kGoodId, std::string(), GURL("http://example.com/update"),
Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false)); Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false));
EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true)); EXPECT_TRUE(service()->OnExternalExtensionUpdateUrlFound(*update_info, true));
EXPECT_TRUE((pending_info = pending->GetById(kGoodId))); EXPECT_TRUE((pending_info = pending->GetById(kGoodId)));
...@@ -6280,9 +6275,8 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { ...@@ -6280,9 +6275,8 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
// Fake an external file from external_extensions.json. // Fake an external file from external_extensions.json.
bool AddPendingExternalPrefFileInstall() { bool AddPendingExternalPrefFileInstall() {
std::unique_ptr<base::Version> version(new base::Version("1.0.0.0"));
std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile( std::unique_ptr<ExternalInstallInfoFile> info(new ExternalInstallInfoFile(
crx_id_, std::move(version), crx_path_, Manifest::EXTERNAL_PREF, crx_id_, base::Version("1.0.0.0"), crx_path_, Manifest::EXTERNAL_PREF,
Extension::NO_FLAGS, false, false)); Extension::NO_FLAGS, false, false));
return service()->OnExternalExtensionFileFound(*info); return service()->OnExternalExtensionFileFound(*info);
} }
...@@ -6300,11 +6294,10 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { ...@@ -6300,11 +6294,10 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest {
// Fake a policy install. // Fake a policy install.
bool AddPendingPolicyInstall() { bool AddPendingPolicyInstall() {
// Get path to the CRX with id |kGoodId|. // Get path to the CRX with id |kGoodId|.
std::unique_ptr<GURL> empty_url(new GURL());
std::unique_ptr<ExternalInstallInfoUpdateUrl> info( std::unique_ptr<ExternalInstallInfoUpdateUrl> info(
new ExternalInstallInfoUpdateUrl( new ExternalInstallInfoUpdateUrl(crx_id_, std::string(), GURL(),
crx_id_, std::string(), std::move(empty_url), Manifest::EXTERNAL_POLICY_DOWNLOAD,
Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS, false)); Extension::NO_FLAGS, false));
return service()->OnExternalExtensionUpdateUrlFound(*info, true); return service()->OnExternalExtensionUpdateUrlFound(*info, true);
} }
......
...@@ -384,9 +384,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs( ...@@ -384,9 +384,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs(
path = base_path.Append(external_crx); path = base_path.Append(external_crx);
} }
std::unique_ptr<base::Version> version( base::Version version(external_version);
new base::Version(external_version)); if (!version.IsValid()) {
if (!version->IsValid()) {
LOG(WARNING) << "Malformed extension dictionary for extension: " LOG(WARNING) << "Malformed extension dictionary for extension: "
<< extension_id.c_str() << ". Invalid version string \"" << extension_id.c_str() << ". Invalid version string \""
<< external_version << "\"."; << external_version << "\".";
...@@ -394,8 +393,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs( ...@@ -394,8 +393,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs(
} }
external_file_extensions->push_back( external_file_extensions->push_back(
base::MakeUnique<ExternalInstallInfoFile>( base::MakeUnique<ExternalInstallInfoFile>(
extension_id, std::move(version), path, crx_location_, extension_id, version, path, crx_location_, creation_flags,
creation_flags, auto_acknowledge_, install_immediately_)); auto_acknowledge_, install_immediately_));
} else { // if (has_external_update_url) } else { // if (has_external_update_url)
CHECK(has_external_update_url); // Checking of keys above ensures this. CHECK(has_external_update_url); // Checking of keys above ensures this.
if (download_location_ == Manifest::INVALID_LOCATION) { if (download_location_ == Manifest::INVALID_LOCATION) {
...@@ -403,8 +402,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs( ...@@ -403,8 +402,8 @@ void ExternalProviderImpl::RetrieveExtensionsFromPrefs(
<< "extensions from update URLs."; << "extensions from update URLs.";
continue; continue;
} }
std::unique_ptr<GURL> update_url(new GURL(external_update_url)); GURL update_url(external_update_url);
if (!update_url->is_valid()) { if (!update_url.is_valid()) {
LOG(WARNING) << "Malformed extension dictionary for extension: " LOG(WARNING) << "Malformed extension dictionary for extension: "
<< extension_id.c_str() << ". Key " << kExternalUpdateUrl << extension_id.c_str() << ". Key " << kExternalUpdateUrl
<< " has value \"" << external_update_url << " has value \"" << external_update_url
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
#include "extensions/browser/external_install_info.h" #include "extensions/browser/external_install_info.h"
#include "base/version.h"
#include "url/gurl.h"
namespace extensions { namespace extensions {
ExternalInstallInfo::ExternalInstallInfo(const std::string& extension_id, ExternalInstallInfo::ExternalInstallInfo(const std::string& extension_id,
...@@ -18,14 +15,14 @@ ExternalInstallInfo::ExternalInstallInfo(const std::string& extension_id, ...@@ -18,14 +15,14 @@ ExternalInstallInfo::ExternalInstallInfo(const std::string& extension_id,
ExternalInstallInfoFile::ExternalInstallInfoFile( ExternalInstallInfoFile::ExternalInstallInfoFile(
const std::string& extension_id, const std::string& extension_id,
std::unique_ptr<base::Version> version, const base::Version& version,
const base::FilePath& path, const base::FilePath& path,
Manifest::Location crx_location, Manifest::Location crx_location,
int creation_flags, int creation_flags,
bool mark_acknowledged, bool mark_acknowledged,
bool install_immediately) bool install_immediately)
: ExternalInstallInfo(extension_id, creation_flags, mark_acknowledged), : ExternalInstallInfo(extension_id, creation_flags, mark_acknowledged),
version(std::move(version)), version(version),
path(path), path(path),
crx_location(crx_location), crx_location(crx_location),
install_immediately(install_immediately) {} install_immediately(install_immediately) {}
...@@ -35,7 +32,7 @@ ExternalInstallInfoFile::~ExternalInstallInfoFile() {} ...@@ -35,7 +32,7 @@ ExternalInstallInfoFile::~ExternalInstallInfoFile() {}
ExternalInstallInfoUpdateUrl::ExternalInstallInfoUpdateUrl( ExternalInstallInfoUpdateUrl::ExternalInstallInfoUpdateUrl(
const std::string& extension_id, const std::string& extension_id,
const std::string& install_parameter, const std::string& install_parameter,
std::unique_ptr<GURL> update_url, GURL update_url,
Manifest::Location download_location, Manifest::Location download_location,
int creation_flags, int creation_flags,
bool mark_acknowledged) bool mark_acknowledged)
......
...@@ -6,13 +6,9 @@ ...@@ -6,13 +6,9 @@
#define EXTENSIONS_BROWSER_EXTERNAL_INSTALL_INFO_H_ #define EXTENSIONS_BROWSER_EXTERNAL_INSTALL_INFO_H_
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/version.h"
#include "extensions/common/manifest.h" #include "extensions/common/manifest.h"
#include "url/gurl.h"
class GURL;
namespace base {
class Version;
}
namespace extensions { namespace extensions {
...@@ -34,7 +30,7 @@ struct ExternalInstallInfo { ...@@ -34,7 +30,7 @@ struct ExternalInstallInfo {
struct ExternalInstallInfoFile : public ExternalInstallInfo { struct ExternalInstallInfoFile : public ExternalInstallInfo {
ExternalInstallInfoFile(const std::string& extension_id, ExternalInstallInfoFile(const std::string& extension_id,
std::unique_ptr<base::Version> version, const base::Version& version,
const base::FilePath& path, const base::FilePath& path,
Manifest::Location crx_location, Manifest::Location crx_location,
int creation_flags, int creation_flags,
...@@ -42,7 +38,7 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo { ...@@ -42,7 +38,7 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo {
bool install_immediately); bool install_immediately);
~ExternalInstallInfoFile() override; ~ExternalInstallInfoFile() override;
std::unique_ptr<base::Version> version; base::Version version;
base::FilePath path; base::FilePath path;
Manifest::Location crx_location; Manifest::Location crx_location;
bool install_immediately; bool install_immediately;
...@@ -51,14 +47,14 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo { ...@@ -51,14 +47,14 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo {
struct ExternalInstallInfoUpdateUrl : public ExternalInstallInfo { struct ExternalInstallInfoUpdateUrl : public ExternalInstallInfo {
ExternalInstallInfoUpdateUrl(const std::string& extension_id, ExternalInstallInfoUpdateUrl(const std::string& extension_id,
const std::string& install_parameter, const std::string& install_parameter,
std::unique_ptr<GURL> update_url, GURL update_url,
Manifest::Location download_location, Manifest::Location download_location,
int creation_flags, int creation_flags,
bool mark_acknowledged); bool mark_acknowledged);
~ExternalInstallInfoUpdateUrl() override; ~ExternalInstallInfoUpdateUrl() override;
std::string install_parameter; std::string install_parameter;
std::unique_ptr<GURL> update_url; GURL update_url;
Manifest::Location download_location; Manifest::Location download_location;
}; };
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include "extensions/browser/mock_external_provider.h" #include "extensions/browser/mock_external_provider.h"
#include "base/memory/ptr_util.h" #include <memory>
#include "base/version.h" #include "base/version.h"
#include "extensions/browser/external_install_info.h" #include "extensions/browser/external_install_info.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -20,10 +21,9 @@ MockExternalProvider::~MockExternalProvider() {} ...@@ -20,10 +21,9 @@ MockExternalProvider::~MockExternalProvider() {}
void MockExternalProvider::UpdateOrAddExtension(const ExtensionId& id, void MockExternalProvider::UpdateOrAddExtension(const ExtensionId& id,
const std::string& version_str, const std::string& version_str,
const base::FilePath& path) { const base::FilePath& path) {
auto version = std::make_unique<base::Version>(version_str);
auto info = std::make_unique<ExternalInstallInfoFile>( auto info = std::make_unique<ExternalInstallInfoFile>(
id, std::move(version), path, location_, Extension::NO_FLAGS, false, id, base::Version(version_str), path, location_, Extension::NO_FLAGS,
false); false, false);
extension_map_[id] = std::move(info); extension_map_[id] = std::move(info);
} }
...@@ -57,7 +57,7 @@ bool MockExternalProvider::GetExtensionDetails( ...@@ -57,7 +57,7 @@ bool MockExternalProvider::GetExtensionDetails(
return false; return false;
if (version) if (version)
version->reset(new base::Version(it->second->version->GetString())); version->reset(new base::Version(it->second->version));
if (location) if (location)
*location = location_; *location = location_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment