summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/install_verifier.cc
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-16 17:59:12 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-16 17:59:12 +0000
commit8862293b9cdeae9a6b589b2a29c0bddde58c3348 (patch)
treea256a6c641f184bbcfa5701c3b2c6803cc3cc453 /chrome/browser/extensions/install_verifier.cc
parentd57905e9d64d545c597ba17aa0bea785e3e36af7 (diff)
downloadchromium_src-8862293b9cdeae9a6b589b2a29c0bddde58c3348.zip
chromium_src-8862293b9cdeae9a6b589b2a29c0bddde58c3348.tar.gz
chromium_src-8862293b9cdeae9a6b589b2a29c0bddde58c3348.tar.bz2
Fix extension install verification for v1 packaged apps
BUG=334479 Review URL: https://codereview.chromium.org/133273016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245240 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/install_verifier.cc')
-rw-r--r--chrome/browser/extensions/install_verifier.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc
index 34d8735..c0b862b 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) {