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

Unified Diff: chrome/browser/extensions/install_verifier.cc

Issue 133273016: Fix extension install verification for v1 packaged apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/browser/extensions/install_verifier.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/install_verifier.cc
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc
index 34d8735e088a91a545a7d6edb95be2a6954261ba..c0b862befb4d6bc2ed2056ac2f60f89726d6cd62 100644
--- a/chrome/browser/extensions/install_verifier.cc
+++ b/chrome/browser/extensions/install_verifier.cc
@@ -123,8 +123,22 @@ void LogInitResultHistogram(InitResult result) {
result, INIT_RESULT_MAX);
}
+bool FromStore(const Extension& extension) {
+ bool updates_from_store = ManifestURL::UpdatesFromGallery(&extension);
+ return extension.from_webstore() || updates_from_store;
+}
+
+bool CanUseExtensionApis(const Extension& extension) {
+ return extension.is_extension() || extension.is_legacy_packaged_app();
+}
+
} // namespace
+// static
+bool InstallVerifier::NeedsVerification(const Extension& extension) {
+ return FromStore(extension) && CanUseExtensionApis(extension);
+}
+
void InstallVerifier::Init() {
const base::DictionaryValue* pref = prefs_->GetInstallSignature();
if (pref) {
@@ -228,11 +242,6 @@ std::string InstallVerifier::GetDebugPolicyProviderName() const {
return std::string("InstallVerifier");
}
-static bool FromStore(const Extension* extension) {
- bool updates_from_store = ManifestURL::UpdatesFromGallery(extension);
- return extension->from_webstore() || updates_from_store;
-}
-
namespace {
enum MustRemainDisabledOutcome {
@@ -262,7 +271,8 @@ void MustRemainDisabledHistogram(MustRemainDisabledOutcome outcome) {
bool InstallVerifier::MustRemainDisabled(const Extension* extension,
Extension::DisableReason* reason,
base::string16* error) const {
- if (!extension->is_extension()) {
+ CHECK(extension);
+ if (!CanUseExtensionApis(*extension)) {
MustRemainDisabledHistogram(NOT_EXTENSION);
return false;
}
@@ -280,7 +290,7 @@ bool InstallVerifier::MustRemainDisabled(const Extension* extension,
if (ContainsKey(InstallSigner::GetForcedNotFromWebstore(), extension->id())) {
verified = false;
outcome = FORCED_NOT_VERIFIED;
- } else if (!FromStore(extension)) {
+ } else if (!FromStore(*extension)) {
verified = false;
outcome = NOT_FROM_STORE;
} else if (signature_.get() == NULL) {
« no previous file with comments | « chrome/browser/extensions/install_verifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698