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

Unified Diff: extensions/common/manifest_handlers/background_info.cc

Issue 447783003: Remove service worker concepts from apps/extensions manifest parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « extensions/common/manifest_handlers/background_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/manifest_handlers/background_info.cc
diff --git a/extensions/common/manifest_handlers/background_info.cc b/extensions/common/manifest_handlers/background_info.cc
index a5583d7594816b00cc9fa27b488fbc12083d02a3..1e06e8c4d69b22fed20831e8fd8a6d6f513b4fe6 100644
--- a/extensions/common/manifest_handlers/background_info.cc
+++ b/extensions/common/manifest_handlers/background_info.cc
@@ -10,7 +10,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
-#include "content/public/common/content_switches.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/file_util.h"
@@ -70,12 +69,6 @@ const std::vector<std::string>& BackgroundInfo::GetBackgroundScripts(
}
// static
-const std::string& BackgroundInfo::GetServiceWorkerScript(
- const Extension* extension) {
- return GetBackgroundInfo(extension).service_worker_script_;
-}
-
-// static
bool BackgroundInfo::HasBackgroundPage(const Extension* extension) {
return GetBackgroundInfo(extension).has_background_page();
}
@@ -97,11 +90,6 @@ bool BackgroundInfo::HasGeneratedBackgroundPage(const Extension* extension) {
}
// static
-bool BackgroundInfo::HasServiceWorker(const Extension* extension) {
- return GetBackgroundInfo(extension).has_service_worker();
-}
-
-// static
bool BackgroundInfo::AllowJSAccess(const Extension* extension) {
return GetBackgroundInfo(extension).allow_js_access_;
}
@@ -109,12 +97,7 @@ bool BackgroundInfo::AllowJSAccess(const Extension* extension) {
bool BackgroundInfo::Parse(const Extension* extension, base::string16* error) {
const std::string& bg_scripts_key = extension->is_platform_app() ?
keys::kPlatformAppBackgroundScripts : keys::kBackgroundScripts;
- const std::string& sw_scripts_key =
- extension->is_platform_app()
- ? keys::kPlatformAppServiceWorkerScript
- : ""; // TODO(scheib): Support extensions crbug.com/346885
- if (!LoadServiceWorkerScript(extension, sw_scripts_key, error) ||
- !LoadBackgroundScripts(extension, bg_scripts_key, error) ||
+ if (!LoadBackgroundScripts(extension, bg_scripts_key, error) ||
!LoadBackgroundPage(extension, error) ||
!LoadBackgroundPersistent(extension, error) ||
!LoadAllowJSAccess(extension, error)) {
@@ -122,8 +105,7 @@ bool BackgroundInfo::Parse(const Extension* extension, base::string16* error) {
}
int background_solution_sum = (background_url_.is_valid() ? 1 : 0) +
- (!background_scripts_.empty() ? 1 : 0) +
- (has_service_worker() ? 1 : 0);
+ (!background_scripts_.empty() ? 1 : 0);
if (background_solution_sum > 1) {
*error = ASCIIToUTF16(errors::kInvalidBackgroundCombination);
return false;
@@ -132,27 +114,6 @@ bool BackgroundInfo::Parse(const Extension* extension, base::string16* error) {
return true;
}
-bool BackgroundInfo::LoadServiceWorkerScript(const Extension* extension,
- const std::string& key,
- base::string16* error) {
- const base::Value* service_worker_script_value = NULL;
- if (!extension->manifest()->Get(key, &service_worker_script_value))
- return true;
-
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- ::switches::kEnableExperimentalWebPlatformFeatures)) {
- *error = ASCIIToUTF16(errors::kServiceWorkerRequiresFlag);
- return false;
- }
-
- CHECK(service_worker_script_value);
- if (!service_worker_script_value->GetAsString(&service_worker_script_)) {
- *error = ASCIIToUTF16(errors::kInvalidServiceWorkerScript);
- return false;
- }
- return true;
-}
-
bool BackgroundInfo::LoadBackgroundScripts(const Extension* extension,
const std::string& key,
base::string16* error) {
@@ -289,9 +250,8 @@ bool BackgroundManifestHandler::Parse(Extension* extension,
if (!info->Parse(extension, error))
return false;
- // Platform apps must have background pages or service workers.
- if (extension->is_platform_app() && !info->has_background_page() &&
- !info->has_service_worker()) {
+ // Platform apps must have background pages.
+ if (extension->is_platform_app() && !info->has_background_page()) {
*error = ASCIIToUTF16(errors::kBackgroundRequiredForPlatformApps);
return false;
}
@@ -348,14 +308,11 @@ bool BackgroundManifestHandler::AlwaysParseForType(Manifest::Type type) const {
}
const std::vector<std::string> BackgroundManifestHandler::Keys() const {
- static const char* keys[] = {keys::kBackgroundAllowJsAccess,
- keys::kBackgroundPage,
- keys::kBackgroundPageLegacy,
- keys::kBackgroundPersistent,
- keys::kBackgroundScripts,
- keys::kPlatformAppBackgroundPage,
- keys::kPlatformAppBackgroundScripts,
- keys::kPlatformAppServiceWorkerScript};
+ static const char* keys[] = {
+ keys::kBackgroundAllowJsAccess, keys::kBackgroundPage,
+ keys::kBackgroundPageLegacy, keys::kBackgroundPersistent,
+ keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage,
+ keys::kPlatformAppBackgroundScripts};
return std::vector<std::string>(keys, keys + arraysize(keys));
}
« no previous file with comments | « extensions/common/manifest_handlers/background_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698