OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/common/manifest_handlers/background_info.h" | 5 #include "extensions/common/manifest_handlers/background_info.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 bool BackgroundInfo::LoadServiceWorkerScript(const Extension* extension, | 135 bool BackgroundInfo::LoadServiceWorkerScript(const Extension* extension, |
136 const std::string& key, | 136 const std::string& key, |
137 base::string16* error) { | 137 base::string16* error) { |
138 const base::Value* service_worker_script_value = NULL; | 138 const base::Value* service_worker_script_value = NULL; |
139 if (!extension->manifest()->Get(key, &service_worker_script_value)) | 139 if (!extension->manifest()->Get(key, &service_worker_script_value)) |
140 return true; | 140 return true; |
141 | 141 |
142 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 142 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
143 ::switches::kEnableServiceWorker)) { | 143 ::switches::kEnableExperimentalWebPlatformFeatures)) { |
144 *error = ASCIIToUTF16(errors::kServiceWorkerRequiresFlag); | 144 *error = ASCIIToUTF16(errors::kServiceWorkerRequiresFlag); |
145 return false; | 145 return false; |
146 } | 146 } |
147 | 147 |
148 CHECK(service_worker_script_value); | 148 CHECK(service_worker_script_value); |
149 if (!service_worker_script_value->GetAsString(&service_worker_script_)) { | 149 if (!service_worker_script_value->GetAsString(&service_worker_script_)) { |
150 *error = ASCIIToUTF16(errors::kInvalidServiceWorkerScript); | 150 *error = ASCIIToUTF16(errors::kInvalidServiceWorkerScript); |
151 return false; | 151 return false; |
152 } | 152 } |
153 return true; | 153 return true; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 keys::kBackgroundPageLegacy, | 353 keys::kBackgroundPageLegacy, |
354 keys::kBackgroundPersistent, | 354 keys::kBackgroundPersistent, |
355 keys::kBackgroundScripts, | 355 keys::kBackgroundScripts, |
356 keys::kPlatformAppBackgroundPage, | 356 keys::kPlatformAppBackgroundPage, |
357 keys::kPlatformAppBackgroundScripts, | 357 keys::kPlatformAppBackgroundScripts, |
358 keys::kPlatformAppServiceWorkerScript}; | 358 keys::kPlatformAppServiceWorkerScript}; |
359 return std::vector<std::string>(keys, keys + arraysize(keys)); | 359 return std::vector<std::string>(keys, keys + arraysize(keys)); |
360 } | 360 } |
361 | 361 |
362 } // namespace extensions | 362 } // namespace extensions |
OLD | NEW |