Chromium Code Reviews| Index: extensions/common/manifest_handlers/background_info.h |
| diff --git a/extensions/common/manifest_handlers/background_info.h b/extensions/common/manifest_handlers/background_info.h |
| index e9e360e696306160376a52b709ba8561c3bae2d7..e75dcdef6823b1c084f841498606f98d58083f7b 100644 |
| --- a/extensions/common/manifest_handlers/background_info.h |
| +++ b/extensions/common/manifest_handlers/background_info.h |
| @@ -23,10 +23,12 @@ class BackgroundInfo : public Extension::ManifestData { |
| static GURL GetBackgroundURL(const Extension* extension); |
| static const std::vector<std::string>& GetBackgroundScripts( |
| const Extension* extension); |
| + static std::string GetServiceWorkerScript(const Extension* extension); |
|
Jeffrey Yasskin
2014/02/28 01:54:37
Return a const std::string&?
scheib
2014/03/03 19:54:00
Done.
|
| static bool HasBackgroundPage(const Extension* extension); |
| static bool HasPersistentBackgroundPage(const Extension* extension); |
| static bool HasLazyBackgroundPage(const Extension* extension); |
| static bool HasGeneratedBackgroundPage(const Extension* extension); |
| + static bool HasServiceWorker(const Extension* extension); |
|
Jeffrey Yasskin
2014/02/28 01:54:37
It may be useful to provide an IsLazy() function s
scheib
2014/02/28 04:16:07
Will we be supporting non lazy Service Workers? Wh
|
| static bool AllowJSAccess(const Extension* extension); |
| bool has_background_page() const { |
| @@ -41,9 +43,14 @@ class BackgroundInfo : public Extension::ManifestData { |
| return has_background_page() && !is_persistent_; |
| } |
| + bool has_service_worker() const { return !service_worker_script_.empty(); } |
| + |
| bool Parse(const Extension* extension, base::string16* error); |
| private: |
| + bool LoadServiceWorkerScript(const Extension* extension, |
| + const std::string& key, |
| + base::string16* error); |
| bool LoadBackgroundScripts(const Extension* extension, |
| const std::string& key, |
| base::string16* error); |
| @@ -67,6 +74,10 @@ class BackgroundInfo : public Extension::ManifestData { |
| // load on-demand (when it needs to handle an event). Defaults to true. |
| bool is_persistent_; |
| + // Optional script to register as a service worker. This is mutually exclusive |
| + // to the use of background_url_ or background_scripts_. |
| + std::string service_worker_script_; |
| + |
| // True if the background page can be scripted by pages of the app or |
| // extension, in which case all such pages must run in the same process. |
| // False if such pages are not permitted to script the background page, |