summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/csp_validator.cc2
-rw-r--r--chrome/common/extensions/csp_validator_unittest.cc2
-rw-r--r--chrome/common/extensions/extension.cc12
-rw-r--r--chrome/common/extensions/extension.h8
-rw-r--r--chrome/common/extensions/features/feature.cc5
-rw-r--r--chrome/common/extensions/features/feature_unittest.cc20
-rw-r--r--chrome/common/extensions/features/simple_feature_provider_unittest.cc4
-rw-r--r--chrome/common/extensions/manifest.cc2
-rw-r--r--chrome/common/extensions/manifest.h4
-rw-r--r--chrome/common/extensions/manifest_unittest.cc6
10 files changed, 36 insertions, 29 deletions
diff --git a/chrome/common/extensions/csp_validator.cc b/chrome/common/extensions/csp_validator.cc
index bf7306a..da573da 100644
--- a/chrome/common/extensions/csp_validator.cc
+++ b/chrome/common/extensions/csp_validator.cc
@@ -61,7 +61,7 @@ bool HasOnlySecureTokens(StringTokenizer& tokenizer, Extension::Type type) {
// crbug.com/146487
if (type == Extension::TYPE_EXTENSION ||
- type == Extension::TYPE_PACKAGED_APP) {
+ type == Extension::TYPE_LEGACY_PACKAGED_APP) {
if (source == "'unsafe-eval'")
continue;
}
diff --git a/chrome/common/extensions/csp_validator_unittest.cc b/chrome/common/extensions/csp_validator_unittest.cc
index 5afa989..8ca3434c 100644
--- a/chrome/common/extensions/csp_validator_unittest.cc
+++ b/chrome/common/extensions/csp_validator_unittest.cc
@@ -63,7 +63,7 @@ TEST(ExtensionCSPValidator, IsSecure) {
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
"default-src 'unsafe-eval'", Extension::TYPE_EXTENSION));
EXPECT_TRUE(ContentSecurityPolicyIsSecure(
- "default-src 'unsafe-eval'", Extension::TYPE_PACKAGED_APP));
+ "default-src 'unsafe-eval'", Extension::TYPE_LEGACY_PACKAGED_APP));
EXPECT_FALSE(ContentSecurityPolicyIsSecure(
"default-src 'unsafe-eval'", Extension::TYPE_PLATFORM_APP));
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 66f0542..860a525 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -543,8 +543,8 @@ bool Extension::is_hosted_app() const {
return manifest()->is_hosted_app();
}
-bool Extension::is_packaged_app() const {
- return manifest()->is_packaged_app();
+bool Extension::is_legacy_packaged_app() const {
+ return manifest()->is_legacy_packaged_app();
}
bool Extension::is_theme() const {
@@ -1225,7 +1225,7 @@ bool Extension::LoadLaunchURL(string16* error) {
}
launch_web_url_ = launch_url;
- } else if (is_packaged_app() || is_hosted_app()) {
+ } else if (is_legacy_packaged_app() || is_hosted_app()) {
*error = ASCIIToUTF16(errors::kLaunchURLRequired);
return false;
}
@@ -2002,7 +2002,7 @@ bool Extension::LoadWebIntentAction(const std::string& action_name,
if (href.empty()) {
if (is_hosted_app()) {
href = launch_web_url();
- } else if (is_packaged_app()) {
+ } else if (is_legacy_packaged_app()) {
href = launch_local_path();
}
}
@@ -2628,7 +2628,7 @@ bool Extension::LoadChromeURLOverrides(string16* error) {
chrome_url_overrides_[page] = GetResourceURL(val);
// For component extensions, add override URL to extent patterns.
- if (is_packaged_app() && location() == COMPONENT) {
+ if (is_legacy_packaged_app() && location() == COMPONENT) {
URLPattern pattern(URLPattern::SCHEME_CHROMEUI);
std::string url = base::StringPrintf(kOverrideExtentUrlPatternFormat,
page.c_str());
@@ -3803,7 +3803,7 @@ Extension::SyncType Extension::GetSyncType() const {
return SYNC_TYPE_NONE;
case Extension::TYPE_HOSTED_APP:
- case Extension::TYPE_PACKAGED_APP:
+ case Extension::TYPE_LEGACY_PACKAGED_APP:
return SYNC_TYPE_APP;
default:
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index adca60d..2df033e 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -131,7 +131,9 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
TYPE_THEME,
TYPE_USER_SCRIPT,
TYPE_HOSTED_APP,
- TYPE_PACKAGED_APP,
+ // This is marked legacy because platform apps are preferred. For
+ // backwards compatibility, we can't remove support for packaged apps
+ TYPE_LEGACY_PACKAGED_APP,
TYPE_PLATFORM_APP
};
@@ -723,11 +725,11 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// App-related.
bool is_app() const {
- return is_packaged_app() || is_hosted_app() || is_platform_app();
+ return is_legacy_packaged_app() || is_hosted_app() || is_platform_app();
}
bool is_platform_app() const;
bool is_hosted_app() const;
- bool is_packaged_app() const;
+ bool is_legacy_packaged_app() const;
bool is_storage_isolated() const { return is_storage_isolated_; }
const URLPatternSet& web_extent() const { return extent_; }
const std::string& launch_local_path() const { return launch_local_path_; }
diff --git a/chrome/common/extensions/features/feature.cc b/chrome/common/extensions/features/feature.cc
index 1d2e0c3..8e4bb64 100644
--- a/chrome/common/extensions/features/feature.cc
+++ b/chrome/common/extensions/features/feature.cc
@@ -21,7 +21,8 @@ struct Mappings {
Mappings() {
extension_types["extension"] = Extension::TYPE_EXTENSION;
extension_types["theme"] = Extension::TYPE_THEME;
- extension_types["packaged_app"] = Extension::TYPE_PACKAGED_APP;
+ extension_types["packaged_app"]
+ = Extension::TYPE_LEGACY_PACKAGED_APP;
extension_types["hosted_app"] = Extension::TYPE_HOSTED_APP;
extension_types["platform_app"] = Extension::TYPE_PLATFORM_APP;
@@ -145,7 +146,7 @@ std::string GetDisplayTypeName(Extension::Type type) {
return "extension";
case Extension::TYPE_HOSTED_APP:
return "hosted app";
- case Extension::TYPE_PACKAGED_APP:
+ case Extension::TYPE_LEGACY_PACKAGED_APP:
return "legacy packaged app";
case Extension::TYPE_PLATFORM_APP:
return "packaged app";
diff --git a/chrome/common/extensions/features/feature_unittest.cc b/chrome/common/extensions/features/feature_unittest.cc
index 1d4a4aa..24134db 100644
--- a/chrome/common/extensions/features/feature_unittest.cc
+++ b/chrome/common/extensions/features/feature_unittest.cc
@@ -39,7 +39,7 @@ TEST_F(ExtensionFeatureTest, IsAvailableNullCase) {
{ "random-extension", Extension::TYPE_UNKNOWN,
Feature::UNSPECIFIED_LOCATION, Feature::UNSPECIFIED_PLATFORM, -1,
Feature::IS_AVAILABLE },
- { "", Extension::TYPE_PACKAGED_APP,
+ { "", Extension::TYPE_LEGACY_PACKAGED_APP,
Feature::UNSPECIFIED_LOCATION, Feature::UNSPECIFIED_PLATFORM, -1,
Feature::IS_AVAILABLE },
{ "", Extension::TYPE_UNKNOWN,
@@ -87,23 +87,24 @@ TEST_F(ExtensionFeatureTest, Whitelist) {
"", Extension::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1,
Feature::UNSPECIFIED_PLATFORM).result());
- feature.extension_types()->insert(Extension::TYPE_PACKAGED_APP);
+ feature.extension_types()->insert(Extension::TYPE_LEGACY_PACKAGED_APP);
EXPECT_EQ(Feature::NOT_FOUND_IN_WHITELIST, feature.IsAvailableToManifest(
- "baz", Extension::TYPE_PACKAGED_APP, Feature::UNSPECIFIED_LOCATION, -1,
+ "baz", Extension::TYPE_LEGACY_PACKAGED_APP,
+ Feature::UNSPECIFIED_LOCATION, -1,
Feature::UNSPECIFIED_PLATFORM).result());
}
TEST_F(ExtensionFeatureTest, PackageType) {
Feature feature;
feature.extension_types()->insert(Extension::TYPE_EXTENSION);
- feature.extension_types()->insert(Extension::TYPE_PACKAGED_APP);
+ feature.extension_types()->insert(Extension::TYPE_LEGACY_PACKAGED_APP);
EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest(
"", Extension::TYPE_EXTENSION, Feature::UNSPECIFIED_LOCATION, -1,
Feature::UNSPECIFIED_PLATFORM).result());
EXPECT_EQ(Feature::IS_AVAILABLE, feature.IsAvailableToManifest(
- "", Extension::TYPE_PACKAGED_APP, Feature::UNSPECIFIED_LOCATION, -1,
- Feature::UNSPECIFIED_PLATFORM).result());
+ "", Extension::TYPE_LEGACY_PACKAGED_APP, Feature::UNSPECIFIED_LOCATION,
+ -1, Feature::UNSPECIFIED_PLATFORM).result());
EXPECT_EQ(Feature::INVALID_TYPE, feature.IsAvailableToManifest(
"", Extension::TYPE_UNKNOWN, Feature::UNSPECIFIED_LOCATION, -1,
@@ -116,7 +117,7 @@ TEST_F(ExtensionFeatureTest, PackageType) {
TEST_F(ExtensionFeatureTest, Context) {
Feature feature;
feature.contexts()->insert(Feature::BLESSED_EXTENSION_CONTEXT);
- feature.extension_types()->insert(Extension::TYPE_PACKAGED_APP);
+ feature.extension_types()->insert(Extension::TYPE_LEGACY_PACKAGED_APP);
feature.set_platform(Feature::CHROMEOS_PLATFORM);
feature.set_min_manifest_version(21);
feature.set_max_manifest_version(25);
@@ -145,7 +146,7 @@ TEST_F(ExtensionFeatureTest, Context) {
extension.get(), Feature::BLESSED_EXTENSION_CONTEXT,
Feature::CHROMEOS_PLATFORM).result());
feature.extension_types()->clear();
- feature.extension_types()->insert(Extension::TYPE_PACKAGED_APP);
+ feature.extension_types()->insert(Extension::TYPE_LEGACY_PACKAGED_APP);
feature.contexts()->clear();
feature.contexts()->insert(Feature::UNBLESSED_EXTENSION_CONTEXT);
@@ -284,7 +285,8 @@ TEST_F(ExtensionFeatureTest, ParsePackageTypes) {
EXPECT_EQ(5u, feature->extension_types()->size());
EXPECT_TRUE(feature->extension_types()->count(Extension::TYPE_EXTENSION));
EXPECT_TRUE(feature->extension_types()->count(Extension::TYPE_THEME));
- EXPECT_TRUE(feature->extension_types()->count(Extension::TYPE_PACKAGED_APP));
+ EXPECT_TRUE(feature->extension_types()->count(
+ Extension::TYPE_LEGACY_PACKAGED_APP));
EXPECT_TRUE(feature->extension_types()->count(Extension::TYPE_HOSTED_APP));
EXPECT_TRUE(feature->extension_types()->count(Extension::TYPE_PLATFORM_APP));
diff --git a/chrome/common/extensions/features/simple_feature_provider_unittest.cc b/chrome/common/extensions/features/simple_feature_provider_unittest.cc
index 64d95bb..0503ddc 100644
--- a/chrome/common/extensions/features/simple_feature_provider_unittest.cc
+++ b/chrome/common/extensions/features/simple_feature_provider_unittest.cc
@@ -18,7 +18,7 @@ TEST(SimpleFeatureProvider, ManifestFeatures) {
EXPECT_EQ(5u, feature->extension_types()->size());
EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION));
EXPECT_EQ(1u,
- feature->extension_types()->count(Extension::TYPE_PACKAGED_APP));
+ feature->extension_types()->count(Extension::TYPE_LEGACY_PACKAGED_APP));
EXPECT_EQ(1u,
feature->extension_types()->count(Extension::TYPE_PLATFORM_APP));
EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_HOSTED_APP));
@@ -57,7 +57,7 @@ TEST(SimpleFeatureProvider, PermissionFeatures) {
EXPECT_EQ(3u, feature->extension_types()->size());
EXPECT_EQ(1u, feature->extension_types()->count(Extension::TYPE_EXTENSION));
EXPECT_EQ(1u,
- feature->extension_types()->count(Extension::TYPE_PACKAGED_APP));
+ feature->extension_types()->count(Extension::TYPE_LEGACY_PACKAGED_APP));
EXPECT_EQ(1u,
feature->extension_types()->count(Extension::TYPE_PLATFORM_APP));
diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc
index 35b99c5..42362a5 100644
--- a/chrome/common/extensions/manifest.cc
+++ b/chrome/common/extensions/manifest.cc
@@ -33,7 +33,7 @@ Manifest::Manifest(Extension::Location location,
} else if (value_->Get(keys::kPlatformAppBackground, NULL)) {
type_ = Extension::TYPE_PLATFORM_APP;
} else {
- type_ = Extension::TYPE_PACKAGED_APP;
+ type_ = Extension::TYPE_LEGACY_PACKAGED_APP;
}
} else {
type_ = Extension::TYPE_EXTENSION;
diff --git a/chrome/common/extensions/manifest.h b/chrome/common/extensions/manifest.h
index 8efd6a2..da5f542 100644
--- a/chrome/common/extensions/manifest.h
+++ b/chrome/common/extensions/manifest.h
@@ -45,8 +45,10 @@ class Manifest {
bool is_theme() const { return type_ == Extension::TYPE_THEME; }
bool is_platform_app() const { return type_ == Extension::TYPE_PLATFORM_APP; }
- bool is_packaged_app() const { return type_ == Extension::TYPE_PACKAGED_APP; }
bool is_hosted_app() const { return type_ == Extension::TYPE_HOSTED_APP; }
+ bool is_legacy_packaged_app() const {
+ return type_ == Extension::TYPE_LEGACY_PACKAGED_APP;
+ }
// These access the wrapped manifest value, returning false when the property
// does not exist or if the manifest type can't access it.
diff --git a/chrome/common/extensions/manifest_unittest.cc b/chrome/common/extensions/manifest_unittest.cc
index 5f2323d..65c308f 100644
--- a/chrome/common/extensions/manifest_unittest.cc
+++ b/chrome/common/extensions/manifest_unittest.cc
@@ -31,8 +31,8 @@ class ManifestTest : public testing::Test {
EXPECT_EQ(type == Extension::TYPE_THEME, manifest->is_theme());
EXPECT_EQ(type == Extension::TYPE_PLATFORM_APP,
manifest->is_platform_app());
- EXPECT_EQ(type == Extension::TYPE_PACKAGED_APP,
- manifest->is_packaged_app());
+ EXPECT_EQ(type == Extension::TYPE_LEGACY_PACKAGED_APP,
+ manifest->is_legacy_packaged_app());
EXPECT_EQ(type == Extension::TYPE_HOSTED_APP, manifest->is_hosted_app());
}
@@ -138,7 +138,7 @@ TEST_F(ManifestTest, ExtensionTypes) {
// Packaged app.
MutateManifest(
&manifest, keys::kApp, new DictionaryValue());
- AssertType(manifest.get(), Extension::TYPE_PACKAGED_APP);
+ AssertType(manifest.get(), Extension::TYPE_LEGACY_PACKAGED_APP);
// Platform app.
MutateManifest(