summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc2
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc2
-rw-r--r--chrome/browser/extensions/api/alarms/alarms_api.cc6
-rw-r--r--chrome/browser/extensions/api/alarms/alarms_api_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc7
-rw-r--r--chrome/browser/extensions/api/discovery/discovery_api_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/idle/idle_api_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/management/management_api.cc3
-rw-r--r--chrome/browser/extensions/api/socket/socket_api_unittest.cc2
-rw-r--r--chrome/browser/extensions/app_process_apitest.cc2
-rw-r--r--chrome/browser/extensions/extension_nacl_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_prefs.cc37
-rw-r--r--chrome/browser/extensions/extension_service.cc4
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc12
-rw-r--r--chrome/browser/extensions/extension_ui_unittest.cc8
-rw-r--r--chrome/browser/extensions/installed_loader.cc13
-rw-r--r--chrome/browser/extensions/permissions_updater.cc2
-rw-r--r--chrome/browser/extensions/requirements_checker_browsertest.cc2
-rw-r--r--chrome/browser/extensions/unpacked_installer.cc6
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc2
-rw-r--r--chrome/browser/performance_monitor/database_unittest.cc12
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc2
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc12
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc12
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc12
-rw-r--r--chrome/common/extensions/api/extension_api_unittest.cc3
-rw-r--r--chrome/common/extensions/extension.cc2
-rw-r--r--chrome/common/extensions/extension_builder.cc2
-rw-r--r--chrome/common/extensions/extension_builder.h2
-rw-r--r--chrome/common/extensions/extension_file_util_unittest.cc24
-rw-r--r--chrome/common/extensions/extension_l10n_util_unittest.cc12
-rw-r--r--chrome/common/extensions/extension_unittest.cc3
-rw-r--r--chrome/common/extensions/manifest.cc13
-rw-r--r--chrome/common/extensions/manifest.h11
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc4
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc2
-rw-r--r--chrome/renderer/extensions/dispatcher.cc2
37 files changed, 138 insertions, 110 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index bf80305..dd878b3 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -635,7 +635,7 @@ void ExtensionReadyNotificationObserver::Observe(
// Only track an internal or unpacked extension load.
extensions::Manifest::Location location = loaded_extension->location();
if (location != extensions::Manifest::INTERNAL &&
- location != extensions::Manifest::LOAD)
+ !extensions::Manifest::IsUnpackedLocation(location))
return;
extension_ = loaded_extension;
if (!DidExtensionViewsStopLoading(manager_))
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index b1af9f2..e083f34 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -3691,7 +3691,7 @@ void TestingAutomationProvider::GetExtensionsInfo(DictionaryValue* args,
location == Manifest::INTERNAL);
extension_value->SetBoolean("is_user_installed",
location == Manifest::INTERNAL ||
- location == Manifest::LOAD);
+ Manifest::IsUnpackedLocation(location));
extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id));
extension_value->SetBoolean("allowed_in_incognito",
service->IsIncognitoEnabled(id));
diff --git a/chrome/browser/extensions/api/alarms/alarms_api.cc b/chrome/browser/extensions/api/alarms/alarms_api.cc
index 351d1a1..343175d 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api.cc
+++ b/chrome/browser/extensions/api/alarms/alarms_api.cc
@@ -54,7 +54,7 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name,
if (create_info.delay_in_minutes.get()) {
if (*create_info.delay_in_minutes < kReleaseDelayMinimum) {
COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
- if (extension->location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(extension->location()))
warnings->push_back(ErrorUtils::FormatErrorMessage(
"Alarm delay is less than minimum of 1 minutes."
" In released .crx, alarm \"*\" will fire in approximately"
@@ -70,7 +70,7 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name,
if (create_info.period_in_minutes.get()) {
if (*create_info.period_in_minutes < kReleaseDelayMinimum) {
COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
- if (extension->location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(extension->location()))
warnings->push_back(ErrorUtils::FormatErrorMessage(
"Alarm period is less than minimum of 1 minutes."
" In released .crx, alarm \"*\" will fire approximately"
@@ -117,7 +117,7 @@ bool AlarmsCreateFunction::RunImpl() {
Alarm alarm(alarm_name,
params->alarm_info,
base::TimeDelta::FromMinutes(
- GetExtension()->location() == Manifest::LOAD ?
+ Manifest::IsUnpackedLocation(GetExtension()->location()) ?
kDevDelayMinimum : kReleaseDelayMinimum),
clock_->Now());
ExtensionSystem::Get(profile())->alarm_manager()->AddAlarm(
diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
index fdb9ffa..fb3d8ed 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
+++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc
@@ -58,7 +58,7 @@ class ExtensionAlarmsTest : public BrowserWithTestWindowTest {
alarm_manager_->set_delegate(alarm_delegate_);
extension_ = utils::CreateEmptyExtensionWithLocation(
- extensions::Manifest::LOAD);
+ extensions::Manifest::UNPACKED);
// Make sure there's a RenderViewHost for alarms to warn into.
AddTab(browser(), extension_->GetBackgroundURL());
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 4884845..bca5d32 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -157,7 +157,7 @@ scoped_ptr<developer::ItemInfo>
NOTREACHED();
}
- if (item.location() == Manifest::LOAD) {
+ if (extensions::Manifest::IsUnpackedLocation(item.location())) {
info->path.reset(
new std::string(UTF16ToUTF8(item.path().LossyDisplayName())));
}
@@ -165,8 +165,9 @@ scoped_ptr<developer::ItemInfo>
info->incognito_enabled = service->IsIncognitoEnabled(item.id());
info->wants_file_access = item.wants_file_access();
info->allow_file_access = service->AllowFileAccess(&item);
- info->allow_reload = (item.location() == Manifest::LOAD);
- info->is_unpacked = (item.location() == Manifest::LOAD);
+ info->allow_reload =
+ extensions::Manifest::IsUnpackedLocation(item.location());
+ info->is_unpacked = extensions::Manifest::IsUnpackedLocation(item.location());
info->terminated = service->terminated_extensions()->Contains(item.id());
info->allow_incognito = item.can_be_incognito_enabled();
diff --git a/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc b/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc
index 5550383..223bc16 100644
--- a/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc
+++ b/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc
@@ -71,7 +71,7 @@ class ExtensionDiscoveryTest : public BrowserWithTestWindowTest {
public:
virtual void SetUp() {
BrowserWithTestWindowTest::SetUp();
- extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::LOAD);
+ extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::UNPACKED);
}
// Runs a function and returns a pointer to a value, transferring ownership.
diff --git a/chrome/browser/extensions/api/idle/idle_api_unittest.cc b/chrome/browser/extensions/api/idle/idle_api_unittest.cc
index fec96da..a7f2db5 100644
--- a/chrome/browser/extensions/api/idle/idle_api_unittest.cc
+++ b/chrome/browser/extensions/api/idle/idle_api_unittest.cc
@@ -144,7 +144,7 @@ void IdleTest::SetUp() {
idle_manager_ = IdleManagerFactory::GetForProfile(browser()->profile());
extension_ = utils::CreateEmptyExtensionWithLocation(
- extensions::Manifest::LOAD);
+ extensions::Manifest::UNPACKED);
idle_provider_ = new TestIdleProvider();
idle_manager_->SetIdleTimeProviderForTest(
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index 18aa8cd..45ab1cd 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -177,7 +177,8 @@ scoped_ptr<management::ExtensionInfo> CreateExtensionInfo(
case Manifest::INTERNAL:
info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL;
break;
- case Manifest::LOAD:
+ case Manifest::UNPACKED:
+ case Manifest::COMMAND_LINE:
info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT;
break;
case Manifest::EXTERNAL_PREF:
diff --git a/chrome/browser/extensions/api/socket/socket_api_unittest.cc b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
index d3c7eab..9f27f33 100644
--- a/chrome/browser/extensions/api/socket/socket_api_unittest.cc
+++ b/chrome/browser/extensions/api/socket/socket_api_unittest.cc
@@ -27,7 +27,7 @@ class SocketUnitTest : public BrowserWithTestWindowTest {
system->CreateSocketManager();
extension_ = utils::CreateEmptyExtensionWithLocation(
- extensions::Manifest::LOAD);
+ extensions::Manifest::UNPACKED);
}
base::Value* RunFunctionWithExtension(
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index 61dbfb9..ceb75f6 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -287,7 +287,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) {
std::string error;
scoped_refptr<const Extension> extension(extension_file_util::LoadExtension(
test_data_dir_.AppendASCII("app_process"),
- extensions::Manifest::LOAD,
+ extensions::Manifest::UNPACKED,
Extension::FROM_BOOKMARK,
&error));
service->OnExtensionInstalled(extension,
diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc
index ce13401..03f69305 100644
--- a/chrome/browser/extensions/extension_nacl_browsertest.cc
+++ b/chrome/browser/extensions/extension_nacl_browsertest.cc
@@ -152,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) {
const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED);
ASSERT_TRUE(extension);
- ASSERT_EQ(extension->location(), Manifest::LOAD);
+ ASSERT_EQ(extension->location(), Manifest::UNPACKED);
CheckPluginsCreated(extension, true);
}
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 55d9fea..df2d71e 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -441,7 +441,8 @@ void ExtensionPrefs::MakePathsRelative() {
continue;
int location_value;
if (extension_dict->GetInteger(kPrefLocation, &location_value) &&
- location_value == Manifest::LOAD) {
+ Manifest::IsUnpackedLocation(
+ static_cast<Manifest::Location>(location_value))) {
// Unpacked extensions can have absolute paths.
continue;
}
@@ -1590,7 +1591,7 @@ std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
}
void ExtensionPrefs::UpdateManifest(const Extension* extension) {
- if (extension->location() != Manifest::LOAD) {
+ if (!Manifest::IsUnpackedLocation(extension->location())) {
const DictionaryValue* extension_dict = GetExtensionPref(extension->id());
if (!extension_dict)
return;
@@ -1680,25 +1681,24 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo(
// Make path absolute. Unpacked extensions will already have absolute paths,
// otherwise make it so.
- if (location_value != Manifest::LOAD) {
- DCHECK(location_value == Manifest::COMPONENT ||
+ Manifest::Location location =
+ static_cast<Manifest::Location>(location_value);
+ if (!Manifest::IsUnpackedLocation(location)) {
+ DCHECK(location == Manifest::COMPONENT ||
!base::FilePath(path).IsAbsolute());
path = install_directory_.Append(path).value();
}
- // Only the following extension types can be installed permanently in the
- // preferences.
- Manifest::Location location =
- static_cast<Manifest::Location>(location_value);
+ // Only the following extension types have data saved in the preferences.
if (location != Manifest::INTERNAL &&
- location != Manifest::LOAD &&
+ !Manifest::IsUnpackedLocation(location) &&
!Manifest::IsExternalLocation(location)) {
NOTREACHED();
return scoped_ptr<ExtensionInfo>();
}
const DictionaryValue* manifest = NULL;
- if (location != Manifest::LOAD &&
+ if (!Manifest::IsUnpackedLocation(location) &&
!ext->GetDictionary(kPrefManifest, &manifest)) {
LOG(WARNING) << "Missing manifest for extension " << extension_id;
// Just a warning for now.
@@ -1813,25 +1813,24 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo(
// Make path absolute. Unpacked extensions will already have absolute paths,
// otherwise make it so.
- if (location_value != Manifest::LOAD) {
- DCHECK(location_value == Manifest::COMPONENT ||
+ Manifest::Location location =
+ static_cast<Manifest::Location>(location_value);
+ if (!Manifest::IsUnpackedLocation(location)) {
+ DCHECK(location == Manifest::COMPONENT ||
!base::FilePath(path).IsAbsolute());
path = install_directory_.Append(path).value();
}
- // Only the following extension types can be installed permanently in the
- // preferences.
- Manifest::Location location =
- static_cast<Manifest::Location>(location_value);
+ // Only the following extension types have data saved in the preferences.
if (location != Manifest::INTERNAL &&
- location != Manifest::LOAD &&
+ !Manifest::IsUnpackedLocation(location) &&
!Manifest::IsExternalLocation(location)) {
NOTREACHED();
return scoped_ptr<ExtensionInfo>();
}
const DictionaryValue* manifest = NULL;
- if (location != Manifest::LOAD &&
+ if (!Manifest::IsUnpackedLocation(location) &&
!ext->GetDictionary(kPrefManifest, &manifest)) {
LOG(WARNING) << "Missing manifest for extension " << extension_id;
// Just a warning for now.
@@ -2393,7 +2392,7 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs(
extension_dict->Set(kPrefPath, Value::CreateStringValue(path));
// We store prefs about LOAD extensions, but don't cache their manifest
// since it may change on disk.
- if (extension->location() != Manifest::LOAD) {
+ if (!Manifest::IsUnpackedLocation(extension->location())) {
extension_dict->Set(kPrefManifest,
extension->manifest()->value()->DeepCopy());
}
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 91d901b..a64dfab 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -822,7 +822,7 @@ bool ExtensionService::UninstallExtension(
external_uninstall);
// Tell the backend to start deleting installed extensions on the file thread.
- if (Manifest::LOAD != extension->location()) {
+ if (!Manifest::IsUnpackedLocation(extension->location())) {
if (!GetFileTaskRunner()->PostTask(
FROM_HERE,
base::Bind(
@@ -2224,7 +2224,7 @@ void ExtensionService::InitializePermissions(const Extension* extension) {
if (is_extension_upgrade) {
// Other than for unpacked extensions, CrxInstaller should have guaranteed
// that we aren't downgrading.
- if (extension->location() != Manifest::LOAD)
+ if (!Manifest::IsUnpackedLocation(extension->location()))
CHECK_GE(extension->version()->CompareTo(*(old->version())), 0);
// Extensions get upgraded if the privileges are allowed to increase or
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index f096ffe..fe89f3f 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -2656,7 +2656,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) {
EXPECT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
- EXPECT_EQ(Manifest::LOAD, loaded_[0]->location());
+ EXPECT_EQ(Manifest::UNPACKED, loaded_[0]->location());
EXPECT_EQ(1u, service_->extensions()->size());
EXPECT_EQ("2.0", loaded_[0]->VersionString());
@@ -2670,7 +2670,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) {
EXPECT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
- EXPECT_EQ(Manifest::LOAD, loaded_[0]->location());
+ EXPECT_EQ(Manifest::UNPACKED, loaded_[0]->location());
EXPECT_EQ(1u, service_->extensions()->size());
EXPECT_EQ("1.0", loaded_[0]->VersionString());
}
@@ -3304,11 +3304,11 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) {
DictionaryValue manifest;
manifest.SetString(keys::kName, "simple_extension");
manifest.SetString(keys::kVersion, "1");
- // LOAD is for extensions loaded from the command line. We use it here, even
+ // UNPACKED is for extensions loaded from a directory. We use it here, even
// though we're testing loading from prefs, so that we don't need to provide
// an extension key.
extensions::ExtensionInfo extension_info(&manifest, "", path,
- Manifest::LOAD);
+ Manifest::UNPACKED);
// Ensure we can load it with no management policy in place.
management_policy_->UnregisterAllProviders();
@@ -3995,7 +3995,7 @@ TEST_F(ExtensionServiceTest, LoadExtension) {
loop_.RunUntilIdle();
EXPECT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
- EXPECT_EQ(Manifest::LOAD, loaded_[0]->location());
+ EXPECT_EQ(Manifest::UNPACKED, loaded_[0]->location());
EXPECT_EQ(1u, service_->extensions()->size());
ValidatePrefKeyCount(1);
@@ -4032,7 +4032,7 @@ TEST_F(ExtensionServiceTest, GenerateID) {
EXPECT_EQ(0u, GetErrors().size());
ASSERT_EQ(1u, loaded_.size());
ASSERT_TRUE(Extension::IdIsValid(loaded_[0]->id()));
- EXPECT_EQ(loaded_[0]->location(), Manifest::LOAD);
+ EXPECT_EQ(loaded_[0]->location(), Manifest::UNPACKED);
ValidatePrefKeyCount(1);
diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc
index 60e7eaa..9571536 100644
--- a/chrome/browser/extensions/extension_ui_unittest.cc
+++ b/chrome/browser/extensions/extension_ui_unittest.cc
@@ -189,7 +189,7 @@ TEST_F(ExtensionUITest, GenerateExtensionsJSONData) {
CompareExpectedAndActualOutput(extension_path, pages, expected_output_path);
}
-// Test that using Manifest::LOAD for the extension location triggers the
+// Test that using Manifest::UNPACKED for the extension location triggers the
// correct values in the details, including location, order, and allow_reload.
TEST_F(ExtensionUITest, LocationLoadPropagation) {
base::FilePath data_test_dir_path, extension_path;
@@ -205,7 +205,7 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) {
scoped_ptr<DictionaryValue> extension_details(
CreateExtensionDetailViewFromPath(
- extension_path, pages, Manifest::LOAD));
+ extension_path, pages, Manifest::UNPACKED));
bool ui_allow_reload = false;
bool ui_is_unpacked = false;
@@ -221,7 +221,7 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) {
// Test that using Manifest::EXTERNAL_PREF for the extension location triggers
// the correct values in the details, including location, order, and
-// allow_reload. Contrast to Manifest::LOAD, which has somewhat different
+// allow_reload. Contrast to Manifest::UNPACKED, which has somewhat different
// values.
TEST_F(ExtensionUITest, LocationExternalPrefPropagation) {
base::FilePath data_test_dir_path, extension_path;
@@ -266,7 +266,7 @@ TEST_F(ExtensionUITest, PathPropagation) {
scoped_ptr<DictionaryValue> extension_details(
CreateExtensionDetailViewFromPath(
- extension_path, pages, Manifest::LOAD));
+ extension_path, pages, Manifest::UNPACKED));
base::FilePath::StringType ui_path;
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index deb0f85..a12a547 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -51,7 +51,7 @@ enum ManifestReloadReason {
ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) {
// Always reload manifests of unpacked extensions, because they can change
// on disk independent of the manifest in our prefs.
- if (info.extension_location == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(info.extension_location))
return UNPACKED_DIR;
// Reload the manifest if it needs to be relocalized.
@@ -106,7 +106,7 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
// updating the 'key' field in their manifest).
// TODO(jstritar): migrate preferences when unpacked extensions change IDs.
if (extension &&
- extension->location() != Manifest::LOAD &&
+ !Manifest::IsUnpackedLocation(extension->location()) &&
info.extension_id != extension->id()) {
error = errors::kCannotChangeExtensionID;
extension = NULL;
@@ -152,6 +152,11 @@ void InstalledLoader::LoadAllExtensions() {
for (size_t i = 0; i < extensions_info->size(); ++i) {
ExtensionInfo* info = extensions_info->at(i).get();
+ // Skip extensions that were loaded from the command-line because we don't
+ // want those to persist across browser restart.
+ if (info->extension_location == Manifest::COMMAND_LINE)
+ continue;
+
scoped_ptr<ExtensionInfo> pending_update(
extension_prefs_->GetDelayedInstallInfo(info->extension_id));
if (pending_update) {
@@ -271,7 +276,7 @@ void InstalledLoader::LoadAllExtensions() {
// Don't count unpacked extensions, since they're a developer-specific
// feature.
- if (location == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(location))
continue;
// Using an enumeration shows us the total installed ratio across all users.
@@ -370,7 +375,7 @@ void InstalledLoader::LoadAllExtensions() {
int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) {
int flags = extension_prefs_->GetCreationFlags(info->extension_id);
- if (info->extension_location != Manifest::LOAD)
+ if (!Manifest::IsUnpackedLocation(info->extension_location))
flags |= Extension::REQUIRE_KEY;
if (extension_prefs_->AllowFileAccess(info->extension_id))
flags |= Extension::ALLOW_FILE_ACCESS;
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc
index 8c0e8be..10623ee 100644
--- a/chrome/browser/extensions/permissions_updater.cc
+++ b/chrome/browser/extensions/permissions_updater.cc
@@ -136,7 +136,7 @@ void PermissionsUpdater::GrantActivePermissions(const Extension* extension,
// We only maintain the granted permissions prefs for INTERNAL and LOAD
// extensions.
- if (extension->location() != Manifest::LOAD &&
+ if (!Manifest::IsUnpackedLocation(extension->location()) &&
extension->location() != Manifest::INTERNAL)
return;
diff --git a/chrome/browser/extensions/requirements_checker_browsertest.cc b/chrome/browser/extensions/requirements_checker_browsertest.cc
index 192239d..e7c8e9d 100644
--- a/chrome/browser/extensions/requirements_checker_browsertest.cc
+++ b/chrome/browser/extensions/requirements_checker_browsertest.cc
@@ -47,7 +47,7 @@ class RequirementsCheckerBrowserTest : public ExtensionBrowserTest {
extension_path = extension_path.AppendASCII("requirements_checker")
.AppendASCII(extension_dir_name);
scoped_refptr<const Extension> extension =
- extension_file_util::LoadExtension(extension_path, Manifest::LOAD,
+ extension_file_util::LoadExtension(extension_path, Manifest::UNPACKED,
0, &load_error);
CHECK(load_error.length() == 0u);
return extension;
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc
index ec6739c..c99a5b0 100644
--- a/chrome/browser/extensions/unpacked_installer.cc
+++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -138,7 +138,7 @@ void UnpackedInstaller::LoadFromCommandLine(const base::FilePath& path_in,
std::string error;
extension_ = extension_file_util::LoadExtension(
extension_path_,
- Manifest::LOAD,
+ Manifest::COMMAND_LINE,
GetFlags(),
&error);
@@ -174,7 +174,7 @@ void UnpackedInstaller::OnRequirementsChecked(
int UnpackedInstaller::GetFlags() {
std::string id = Extension::GenerateIdForPath(extension_path_);
bool allow_file_access =
- Manifest::ShouldAlwaysAllowFileAccess(Manifest::LOAD);
+ Manifest::ShouldAlwaysAllowFileAccess(Manifest::UNPACKED);
if (service_weak_->extension_prefs()->HasAllowFileAccessSetting(id))
allow_file_access = service_weak_->extension_prefs()->AllowFileAccess(id);
@@ -225,7 +225,7 @@ void UnpackedInstaller::LoadWithFileAccess(int flags) {
std::string error;
extension_ = extension_file_util::LoadExtension(
extension_path_,
- Manifest::LOAD,
+ Manifest::UNPACKED,
flags,
&error);
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 8b14a60..0f0f159 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -95,7 +95,7 @@ scoped_refptr<Extension> LoadExtension(const std::string& filename,
scoped_ptr<DictionaryValue> value(LoadManifestFile(path, error));
if (!value.get())
return NULL;
- return Extension::Create(path.DirName(), Manifest::LOAD, *value,
+ return Extension::Create(path.DirName(), Manifest::UNPACKED, *value,
Extension::NO_FLAGS, error);
}
diff --git a/chrome/browser/performance_monitor/database_unittest.cc b/chrome/browser/performance_monitor/database_unittest.cc
index 752b064..32c30a5 100644
--- a/chrome/browser/performance_monitor/database_unittest.cc
+++ b/chrome/browser/performance_monitor/database_unittest.cc
@@ -132,19 +132,19 @@ class PerformanceMonitorDatabaseEventTest : public ::testing::Test {
void InitEvents() {
install_event_1_ = util::CreateExtensionEvent(
EVENT_EXTENSION_INSTALL, clock_->GetTime(), "a", "extension 1",
- "http://foo.com", static_cast<int>(Manifest::LOAD), "0.1",
+ "http://foo.com", static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
install_event_2_ = util::CreateExtensionEvent(
EVENT_EXTENSION_INSTALL, clock_->GetTime(), "b", "extension 2",
- "http://bar.com", static_cast<int>(Manifest::LOAD), "0.1",
+ "http://bar.com", static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
uninstall_event_1_ = util::CreateExtensionEvent(
EVENT_EXTENSION_UNINSTALL, clock_->GetTime(), "a", "extension 1",
- "http://foo.com", static_cast<int>(Manifest::LOAD), "0.1",
+ "http://foo.com", static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
uninstall_event_2_ = util::CreateExtensionEvent(
EVENT_EXTENSION_UNINSTALL, clock_->GetTime(), "b", "extension 2",
- "http://bar.com", static_cast<int>(Manifest::LOAD), "0.1",
+ "http://bar.com", static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
}
};
@@ -358,12 +358,12 @@ TEST_F(PerformanceMonitorDatabaseEventTest, GetEventsTimeRange) {
scoped_ptr<Event> new_install_event =
util::CreateExtensionEvent(EVENT_EXTENSION_INSTALL, clock_->GetTime(),
"c", "test extension", "http://foo.com",
- static_cast<int>(Manifest::LOAD), "0.1",
+ static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
scoped_ptr<Event> new_uninstall_event =
util::CreateExtensionEvent(EVENT_EXTENSION_UNINSTALL, clock_->GetTime(),
"c", "test extension", "http://foo.com",
- static_cast<int>(Manifest::LOAD), "0.1",
+ static_cast<int>(Manifest::UNPACKED), "0.1",
"Test Test");
base::Time end_time = clock_->GetTime();
db_->AddEvent(*new_install_event.get());
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index fdc406f..a571127 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -538,7 +538,7 @@ void RenderViewContextMenu::AppendPlatformAppItems() {
PrintableSelectionText(), &index);
// Add dev tools for unpacked extensions.
- if (platform_app->location() == extensions::Manifest::LOAD ||
+ if (extensions::Manifest::IsUnpackedLocation(platform_app->location()) ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDebugPackedApps)) {
// Add a separator if there are any items already in the menu.
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
index 8f8d23e..9304e0d 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
@@ -66,22 +66,26 @@ class ChromeLauncherControllerPerAppTest : public BrowserWithTestWindowTest {
CommandLine::ForCurrentProcess(), base::FilePath(), false);
std::string error;
- extension1_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
&error);
- extension2_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension2_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
&error);
// Fake gmail extension.
- extension3_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension3_ = Extension::Create(base::FilePath(), Manifest::UNPACKED
+ , manifest,
Extension::NO_FLAGS,
gmail_app_id,
&error);
// Fake search extension.
- extension4_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension4_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"coobgpohoikkiipiblmjeljniedjpjpf",
&error);
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc
index d8f89a0..1dcae7e 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc
@@ -52,21 +52,25 @@ class ChromeLauncherControllerPerBrowserTest : public testing::Test {
CommandLine::ForCurrentProcess(), base::FilePath(), false);
std::string error;
- extension1_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
&error);
- extension2_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension2_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
&error);
// Fake gmail extension.
- extension3_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension3_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"pjkljhegncpnkpknbcohdijeoejaedia",
&error);
// Fake search extension.
- extension4_ = Extension::Create(base::FilePath(), Manifest::LOAD, manifest,
+ extension4_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
+ manifest,
Extension::NO_FLAGS,
"coobgpohoikkiipiblmjeljniedjpjpf",
&error);
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index aacb0e5..3330c12 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -139,11 +139,11 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
extension_misc::EXTENSION_ICON_MEDIUM,
ExtensionIconSet::MATCH_BIGGER,
!enabled, NULL);
- if (extension->location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(extension->location()))
extension_data->SetString("path", extension->path().value());
extension_data->SetString("icon", icon.spec());
extension_data->SetBoolean("isUnpacked",
- extension->location() == Manifest::LOAD);
+ Manifest::IsUnpackedLocation(extension->location()));
extension_data->SetBoolean("terminated",
extension_service_->terminated_extensions()->Contains(extension->id()));
extension_data->SetBoolean("enabledIncognito",
@@ -157,7 +157,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
enabled && CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExtensionActivityUI));
extension_data->SetBoolean("allow_reload",
- extension->location() == Manifest::LOAD);
+ Manifest::IsUnpackedLocation(extension->location()));
extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
extension_data->SetBoolean("is_platform_app", extension->is_platform_app());
extension_data->SetBoolean("homepageProvided",
@@ -185,7 +185,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
// Determine the sort order: Extensions loaded through --load-extensions show
// up at the top. Disabled extensions show up at the bottom.
- if (extension->location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(extension->location()))
extension_data->SetInteger("order", 1);
else
extension_data->SetInteger("order", 2);
@@ -236,7 +236,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue(
}
// Add install warnings (these are not the same as warnings!).
- if (extension->location() == Manifest::LOAD) {
+ if (Manifest::IsUnpackedLocation(extension->location())) {
const std::vector<extensions::InstallWarning>& install_warnings =
extension->install_warnings();
if (!install_warnings.empty()) {
@@ -535,7 +535,7 @@ void ExtensionSettingsHandler::ReloadUnpackedExtensions() {
std::vector<const Extension*> unpacked_extensions;
for (ExtensionSet::const_iterator extension = extensions->begin();
extension != extensions->end(); ++extension) {
- if ((*extension)->location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation((*extension)->location()))
unpacked_extensions.push_back(*extension);
}
diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc
index 39d9481..125085c 100644
--- a/chrome/common/extensions/api/extension_api_unittest.cc
+++ b/chrome/common/extensions/api/extension_api_unittest.cc
@@ -208,7 +208,8 @@ scoped_refptr<Extension> CreateExtensionWithPermissions(
std::string error;
scoped_refptr<Extension> extension(Extension::Create(
- base::FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, &error));
+ base::FilePath(), Manifest::UNPACKED,
+ manifest, Extension::NO_FLAGS, &error));
CHECK(extension.get());
CHECK(error.empty());
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index b8f18f7..7b11c8a 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1061,7 +1061,7 @@ bool Extension::ShouldDisplayInExtensionSettings() const {
}
// Always show unpacked extensions and apps.
- if (location() == Manifest::LOAD)
+ if (Manifest::IsUnpackedLocation(location()))
return true;
// Unless they are unpacked, never show hosted apps. Note: We intentionally
diff --git a/chrome/common/extensions/extension_builder.cc b/chrome/common/extensions/extension_builder.cc
index 44d7b03..31b3f27 100644
--- a/chrome/common/extensions/extension_builder.cc
+++ b/chrome/common/extensions/extension_builder.cc
@@ -9,7 +9,7 @@
namespace extensions {
ExtensionBuilder::ExtensionBuilder()
- : location_(Manifest::LOAD),
+ : location_(Manifest::UNPACKED),
flags_(Extension::NO_FLAGS) {
}
ExtensionBuilder::~ExtensionBuilder() {}
diff --git a/chrome/common/extensions/extension_builder.h b/chrome/common/extensions/extension_builder.h
index 1591a05..aca5b1b 100644
--- a/chrome/common/extensions/extension_builder.h
+++ b/chrome/common/extensions/extension_builder.h
@@ -29,7 +29,7 @@ class ExtensionBuilder {
// Defaults to FilePath().
ExtensionBuilder& SetPath(const base::FilePath& path);
- // Defaults to Manifest::LOAD.
+ // Defaults to Manifest::UNPACKED.
ExtensionBuilder& SetLocation(Manifest::Location location);
ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest);
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index dc3fd3b..36a9117 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -136,7 +136,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithValidLocales) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension != NULL);
EXPECT_EQ("The first extension that I made.", extension->description());
}
@@ -152,7 +152,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionWithoutLocalesFolder) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_FALSE(extension == NULL);
EXPECT_TRUE(error.empty());
}
@@ -226,7 +226,7 @@ TEST_F(ExtensionFileUtilTest,
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension == NULL);
ASSERT_FALSE(error.empty());
ASSERT_STREQ("Manifest file is missing or unreadable.", error.c_str());
@@ -243,7 +243,7 @@ TEST_F(ExtensionFileUtilTest, LoadExtensionGivesHelpfullErrorOnBadManifest) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension == NULL);
ASSERT_FALSE(error.empty());
ASSERT_STREQ("Manifest is not valid JSON. "
@@ -259,7 +259,7 @@ TEST_F(ExtensionFileUtilTest, FailLoadingNonUTF8Scripts) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- install_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ install_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension == NULL);
ASSERT_STREQ("Could not load file 'bad_encoding.js' for content script. "
"It isn't UTF-8 encoded.", error.c_str());
@@ -429,7 +429,7 @@ TEST_F(ExtensionFileUtilTest, ValidateThemeUTF8) {
"}", non_ascii_file.c_str());
std::string error;
scoped_refptr<Extension> extension = LoadExtensionManifest(
- kManifest, temp.path(), Manifest::LOAD, 0, &error);
+ kManifest, temp.path(), Manifest::UNPACKED, 0, &error);
ASSERT_TRUE(extension.get()) << error;
std::vector<extensions::InstallWarning> warnings;
@@ -461,7 +461,7 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) {
std::string error;
std::vector<extensions::InstallWarning> warnings;
scoped_refptr<Extension> extension = LoadExtensionManifest(
- value.get(), temp.path(), Manifest::LOAD, 0, &error);
+ value.get(), temp.path(), Manifest::UNPACKED, 0, &error);
ASSERT_TRUE(extension.get()) << error;
EXPECT_FALSE(extension_file_util::ValidateExtension(extension,
@@ -474,8 +474,8 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) {
scripts->Clear();
scripts->Append(new base::StringValue("http://google.com/foo.js"));
- extension = LoadExtensionManifest(value.get(), temp.path(), Manifest::LOAD,
- 0, &error);
+ extension = LoadExtensionManifest(value.get(), temp.path(),
+ Manifest::UNPACKED, 0, &error);
ASSERT_TRUE(extension.get()) << error;
warnings.clear();
@@ -589,7 +589,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
std::string error;
scoped_refptr<Extension> extension(extension_file_util::LoadExtension(
- ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension == NULL);
ASSERT_STREQ("Could not load extension icon 'icon.png'.",
error.c_str());
@@ -601,7 +601,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
.AppendASCII("gggggggggggggggggggggggggggggggg");
scoped_refptr<Extension> extension2(extension_file_util::LoadExtension(
- ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension2 == NULL);
ASSERT_STREQ("Could not load icon 'icon.png' for browser action.",
error.c_str());
@@ -613,7 +613,7 @@ TEST_F(ExtensionFileUtilTest, CheckZeroLengthImageFile) {
.AppendASCII("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
scoped_refptr<Extension> extension3(extension_file_util::LoadExtension(
- ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
+ ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error));
ASSERT_TRUE(extension3 == NULL);
ASSERT_STREQ("Could not load icon 'icon.png' for page action.",
error.c_str());
diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc
index d11da97..b607e10 100644
--- a/chrome/common/extensions/extension_l10n_util_unittest.cc
+++ b/chrome/common/extensions/extension_l10n_util_unittest.cc
@@ -561,7 +561,7 @@ TEST(ExtensionL10nUtil, LocalizeManifestWithNameDescriptionFileHandlerTitle) {
// Try with NULL manifest.
TEST(ExtensionL10nUtil, ShouldRelocalizeManifestWithNullManifest) {
- ExtensionInfo info(NULL, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(NULL, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_FALSE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
@@ -569,7 +569,7 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestWithNullManifest) {
// Try with default and current locales missing.
TEST(ExtensionL10nUtil, ShouldRelocalizeManifestEmptyManifest) {
DictionaryValue manifest;
- ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_FALSE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
@@ -579,7 +579,7 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestWithDefaultLocale) {
DictionaryValue manifest;
manifest.SetString(keys::kDefaultLocale, "en_US");
- ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
@@ -590,7 +590,7 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestWithCurrentLocale) {
manifest.SetString(keys::kCurrentLocale,
extension_l10n_util::CurrentLocaleOrDefault());
- ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_FALSE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
@@ -602,7 +602,7 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestSameCurrentLocale) {
manifest.SetString(keys::kCurrentLocale,
extension_l10n_util::CurrentLocaleOrDefault());
- ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_FALSE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
@@ -613,7 +613,7 @@ TEST(ExtensionL10nUtil, ShouldRelocalizeManifestDifferentCurrentLocale) {
manifest.SetString(keys::kDefaultLocale, "en_US");
manifest.SetString(keys::kCurrentLocale, "sr");
- ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::LOAD);
+ ExtensionInfo info(&manifest, "", base::FilePath(), Manifest::UNPACKED);
EXPECT_TRUE(extension_l10n_util::ShouldRelocalizeManifest(info));
}
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index 2d0d059..e4cd7fe 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -113,10 +113,11 @@ TEST_F(ExtensionTest, LocationValuesTest) {
ASSERT_EQ(1, Manifest::INTERNAL);
ASSERT_EQ(2, Manifest::EXTERNAL_PREF);
ASSERT_EQ(3, Manifest::EXTERNAL_REGISTRY);
- ASSERT_EQ(4, Manifest::LOAD);
+ ASSERT_EQ(4, Manifest::UNPACKED);
ASSERT_EQ(5, Manifest::COMPONENT);
ASSERT_EQ(6, Manifest::EXTERNAL_PREF_DOWNLOAD);
ASSERT_EQ(7, Manifest::EXTERNAL_POLICY_DOWNLOAD);
+ ASSERT_EQ(8, Manifest::COMMAND_LINE);
}
TEST_F(ExtensionTest, LocationPriorityTest) {
diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc
index 2ca07a2..982e4a9 100644
--- a/chrome/common/extensions/manifest.cc
+++ b/chrome/common/extensions/manifest.cc
@@ -34,18 +34,23 @@ int GetLocationRank(Manifest::Location location) {
switch (location) {
// Component extensions can not be overriden by any other type.
case Manifest::COMPONENT:
- rank = 6;
+ rank = 7;
break;
// Policy controlled extensions may not be overridden by any type
// that is not part of chrome.
case Manifest::EXTERNAL_POLICY_DOWNLOAD:
- rank = 5;
+ rank = 6;
break;
// A developer-loaded extension should override any installed type
- // that a user can disable.
- case Manifest::LOAD:
+ // that a user can disable. Anything specified on the command-line should
+ // override one loaded via the extensions UI.
+ case Manifest::COMMAND_LINE:
+ rank = 5;
+ break;
+
+ case Manifest::UNPACKED:
rank = 4;
break;
diff --git a/chrome/common/extensions/manifest.h b/chrome/common/extensions/manifest.h
index 3d892cb..1f1f93b 100644
--- a/chrome/common/extensions/manifest.h
+++ b/chrome/common/extensions/manifest.h
@@ -30,7 +30,8 @@ class Manifest {
EXTERNAL_PREF, // A crx file from an external directory (via prefs).
EXTERNAL_REGISTRY, // A crx file from an external directory (via eg the
// registry on Windows).
- LOAD, // --load-extension.
+ UNPACKED, // From loading an unpacked extension from the
+ // extensions settings page.
COMPONENT, // An integral component of Chrome itself, which
// happens to be implemented as an extension. We don't
// show these in the management UI.
@@ -38,6 +39,7 @@ class Manifest {
// prefs), installed from an update URL.
EXTERNAL_POLICY_DOWNLOAD, // A crx file from an external directory (via
// admin policies), installed from an update URL.
+ COMMAND_LINE, // --load-extension.
NUM_LOCATIONS
};
@@ -69,6 +71,11 @@ class Manifest {
location == EXTERNAL_POLICY_DOWNLOAD;
}
+ // Whether the |location| is unpacked (no CRX) or not.
+ static inline bool IsUnpackedLocation(Location location) {
+ return location == UNPACKED || location == COMMAND_LINE;
+ }
+
// Whether extensions with |location| are auto-updatable or not.
static inline bool IsAutoUpdateableLocation(Location location) {
// Only internal and external extensions can be autoupdated.
@@ -79,7 +86,7 @@ class Manifest {
// Unpacked extensions start off with file access since they are a developer
// feature.
static inline bool ShouldAlwaysAllowFileAccess(Location location) {
- return location == LOAD;
+ return IsUnpackedLocation(location);
}
Manifest(Location location, scoped_ptr<DictionaryValue> value);
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc
index bff1706..ba382f1 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_manifest_version_unittest.cc
@@ -45,12 +45,12 @@ TEST_F(ExtensionManifestTest, ManifestVersionError) {
Manifest(test_data[i].manifest,
test_data[i].test_name),
errors::kInvalidManifestVersionOld,
- extensions::Manifest::LOAD,
+ extensions::Manifest::UNPACKED,
create_flags);
} else {
LoadAndExpectSuccess(Manifest(test_data[i].manifest,
test_data[i].test_name),
- extensions::Manifest::LOAD,
+ extensions::Manifest::UNPACKED,
create_flags);
}
}
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 5ce2d1a..0a28d0f 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -545,7 +545,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
// Allow built-in extensions and extensions under development.
bool is_extension_unrestricted = extension &&
(extension->location() == extensions::Manifest::COMPONENT ||
- extension->location() == extensions::Manifest::LOAD);
+ extensions::Manifest::IsUnpackedLocation(extension->location()));
GURL top_url = frame->top()->document().url();
if (!IsNaClAllowed(manifest_url,
top_url,
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index a76441f..930cb5d 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -783,7 +783,7 @@ void Dispatcher::DidCreateScriptContext(
int manifest_version = extension ? extension->manifest_version() : 1;
bool send_request_disabled =
- (extension && extension->location() == Manifest::LOAD &&
+ (extension && Manifest::IsUnpackedLocation(extension->location()) &&
extension->has_lazy_background_page());
module_system->RegisterNativeHandler("process",
scoped_ptr<NativeHandler>(new ProcessInfoNativeHandler(