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

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

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
Index: chrome/common/extensions/extension_file_util.cc
diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc
index d0c422f3deaec3702fc6b0b81483faeff152b1a2..2bdd8109ef4d028ffbd294d71866bde7cea75f34 100644
--- a/chrome/common/extensions/extension_file_util.cc
+++ b/chrome/common/extensions/extension_file_util.cc
@@ -23,6 +23,7 @@
#include "chrome/common/extensions/api/extension_action/browser_action_handler.h"
#include "chrome/common/extensions/api/i18n/default_locale_handler.h"
#include "chrome/common/extensions/api/themes/theme_handler.h"
+#include "chrome/common/extensions/background_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
@@ -356,13 +357,14 @@ bool ValidateExtension(const Extension* extension,
}
// Validate that background scripts exist.
- for (size_t i = 0; i < extension->background_scripts().size(); ++i) {
+ const std::vector<std::string>& background_scripts =
+ extensions::BackgroundInfo::GetBackgroundScripts(extension);
+ for (size_t i = 0; i < background_scripts.size(); ++i) {
if (!file_util::PathExists(
- extension->GetResource(
- extension->background_scripts()[i]).GetFilePath())) {
+ extension->GetResource(background_scripts[i]).GetFilePath())) {
*error = l10n_util::GetStringFUTF8(
IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED,
- UTF8ToUTF16(extension->background_scripts()[i]));
+ UTF8ToUTF16(background_scripts[i]));
return false;
}
}
@@ -370,11 +372,11 @@ bool ValidateExtension(const Extension* extension,
// Validate background page location, except for hosted apps, which should use
// an external URL. Background page for hosted apps are verified when the
// extension is created (in Extension::InitFromValue)
- if (extension->has_background_page() &&
+ if (extensions::BackgroundInfo::HasBackgroundPage(extension) &&
!extension->is_hosted_app() &&
- extension->background_scripts().empty()) {
+ extensions::BackgroundInfo::GetBackgroundScripts(extension).empty()) {
Matt Perry 2013/02/15 20:15:02 already have background_scripts
Yoyo Zhou 2013/02/16 00:54:04 Not sure I understand this comment.
Matt Perry 2013/02/16 01:16:52 you cache the scripts in |background_scripts| abov
base::FilePath page_path = ExtensionURLToRelativeFilePath(
- extension->GetBackgroundURL());
+ extensions::BackgroundInfo::GetBackgroundURL(extension));
const base::FilePath path = extension->GetResource(page_path).GetFilePath();
if (path.empty() || !file_util::PathExists(path)) {
*error =

Powered by Google App Engine
This is Rietveld 408576698