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

Unified Diff: chrome/common/extensions/extension.cc

Issue 10536084: Add a warning when developing an extension that uses old manifest version. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blonk Created 8 years, 6 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/common/extensions/extension.h ('k') | chrome/common/extensions/extension_file_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 6216fdd793e668903c29201a92a9d25941f3ec84..0020993badc6803a35124d39a86f0fc93c07e858 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -321,7 +321,7 @@ scoped_refptr<Extension> Extension::Create(const FilePath& path,
return NULL;
}
- std::vector<std::string> install_warnings;
+ InstallWarningVector install_warnings;
manifest->ValidateManifest(utf8_error, &install_warnings);
if (!utf8_error->empty())
return NULL;
@@ -410,7 +410,7 @@ const std::string Extension::VersionString() const {
}
void Extension::AddInstallWarnings(
- const std::vector<std::string>& new_warnings) {
+ const InstallWarningVector& new_warnings) {
install_warnings_.insert(install_warnings_.end(),
new_warnings.begin(), new_warnings.end());
}
@@ -1347,9 +1347,19 @@ bool Extension::LoadManifestVersion(string16* error) {
if (creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION &&
manifest_version_ < kModernManifestVersion &&
!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAllowLegacyExtensionManifests)) {
- *error = ASCIIToUTF16(errors::kInvalidManifestVersion);
- return false;
+ switches::kAllowLegacyExtensionManifests)) {
+ *error = ASCIIToUTF16(errors::kInvalidManifestVersion);
+ return false;
+ }
+
+ if (location() == LOAD && manifest_version_ == 1) {
+ install_warnings_.push_back(Extension::InstallWarning(
+ Extension::InstallWarning::FORMAT_HTML,
+ l10n_util::GetStringFUTF8(
+ IDS_EXTENSION_MANIFEST_VERSION_OLD,
+ ASCIIToUTF16("<a href='http://code.google.com/chrome/extensions/"
+ "manifestVersion.html'>"),
+ ASCIIToUTF16("</a>"))));
}
return true;
@@ -3241,7 +3251,9 @@ bool Extension::ParsePermissions(const char* key,
// Don't fail, but warn the developer that the manifest contains
// unrecognized permissions. This may happen legitimately if the
// extensions requests platform- or channel-specific permissions.
- install_warnings_.push_back(feature->GetErrorMessage(availability));
+ install_warnings_.push_back(
+ InstallWarning(InstallWarning::FORMAT_TEXT,
+ feature->GetErrorMessage(availability)));
continue;
}
@@ -3287,9 +3299,11 @@ bool Extension::ParsePermissions(const char* key,
// It's probably an unknown API permission. Do not throw an error so
// extensions can retain backwards compatability (http://crbug.com/42742).
- install_warnings_.push_back(base::StringPrintf(
- "Permission '%s' is unknown or URL pattern is malformed.",
- permission_str.c_str()));
+ install_warnings_.push_back(InstallWarning(
+ InstallWarning::FORMAT_TEXT,
+ base::StringPrintf(
+ "Permission '%s' is unknown or URL pattern is malformed.",
+ permission_str.c_str())));
}
}
return true;
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698