diff options
author | m.pistrich <m.pistrich@gmail.com> | 2016-02-25 18:17:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 02:19:45 +0000 |
commit | 1cdbf437f9f45896ccff18c834c7e8b7bc3e8061 (patch) | |
tree | eeaf20c46090fcc1e8c6df63a9814cbea0080f74 /extensions/common/manifest_handlers | |
parent | 8f0b97ae15609cee6fe67d2b0b958ef37cffb1e0 (diff) | |
download | chromium_src-1cdbf437f9f45896ccff18c834c7e8b7bc3e8061.zip chromium_src-1cdbf437f9f45896ccff18c834c7e8b7bc3e8061.tar.gz chromium_src-1cdbf437f9f45896ccff18c834c7e8b7bc3e8061.tar.bz2 |
Add warning for packaged apps trying to use a persistent background page
Packaged apps do not support a persistent background page, so the
manifest entry is ignored. To make this more obvious, this CL adds a
warning when validating the manifest.
R=rockot@chromium.org,asargent@chromium.org
BUG=586535
Review URL: https://codereview.chromium.org/1701523002
Cr-Commit-Position: refs/heads/master@{#377775}
Diffstat (limited to 'extensions/common/manifest_handlers')
-rw-r--r-- | extensions/common/manifest_handlers/background_info.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/extensions/common/manifest_handlers/background_info.cc b/extensions/common/manifest_handlers/background_info.cc index 7263aae..c33d22c 100644 --- a/extensions/common/manifest_handlers/background_info.cc +++ b/extensions/common/manifest_handlers/background_info.cc @@ -297,12 +297,32 @@ bool BackgroundManifestHandler::Validate( const base::FilePath path = extension->GetResource(page_path).GetFilePath(); if (path.empty() || !base::PathExists(path)) { *error = - l10n_util::GetStringFUTF8( - IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, - page_path.LossyDisplayName()); + l10n_util::GetStringFUTF8(IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, + page_path.LossyDisplayName()); return false; } } + + if (extension->is_platform_app()) { + const std::string manifest_key = + std::string(keys::kPlatformAppBackground) + ".persistent"; + bool is_persistent = false; + // Validate that packaged apps do not use a persistent background page. + if (extension->manifest()->GetBoolean(manifest_key, &is_persistent) && + is_persistent) { + warnings->push_back( + InstallWarning(errors::kInvalidBackgroundPersistentInPlatformApp)); + } + // Validate that packaged apps do not use the key 'background.persistent'. + // Use the dictionary directly to prevent an access check as + // 'background.persistent' is not available for packaged apps. + if (extension->manifest()->value()->Get(keys::kBackgroundPersistent, + NULL)) { + warnings->push_back( + InstallWarning(errors::kBackgroundPersistentInvalidForPlatformApps)); + } + } + return true; } |