Introduce background.scripts feature for extension manifests.
This optimizes for the common use case where background pages
just include a reference to one or more script files and no
additional HTML.
BUG=107791
Review URL: http://codereview.chromium.org/9150008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117110 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index ad85a5b..6c3ed477 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -526,7 +526,12 @@
const std::vector<InputComponentInfo>& input_components() const {
return input_components_;
}
- const GURL& background_url() const { return background_url_; }
+ bool has_background_page() const {
+ return background_url_.is_valid() || !background_scripts_.empty();
+ }
+ const std::vector<std::string>& background_scripts() const {
+ return background_scripts_;
+ }
const GURL& options_url() const { return options_url_; }
const GURL& devtools_url() const { return devtools_url_; }
const ExtensionPermissionSet* optional_permission_set() const {
@@ -588,6 +593,8 @@
return theme_display_properties_.get();
}
+ GURL GetBackgroundURL() const;
+
private:
friend class base::RefCountedThreadSafe<Extension>;
@@ -664,6 +671,8 @@
string16* error);
bool LoadWebIntentServices(const extensions::Manifest* manifest,
string16* error);
+ bool LoadBackgroundScripts(const extensions::Manifest* manifest,
+ string16* error);
bool LoadBackgroundPage(const extensions::Manifest* manifest,
const ExtensionAPIPermissionSet& api_permissions,
string16* error);
@@ -796,6 +805,10 @@
// loaded in the background.
GURL background_url_;
+ // Optional list of scripts to use to generate a background page. If this is
+ // present, background_url_ will be empty and generated by GetBackgroundURL().
+ std::vector<std::string> background_scripts_;
+
// Optional URL to a page for setting options/preferences.
GURL options_url_;