| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 11 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "extensions/common/constants.h" | 17 #include "extensions/common/constants.h" |
| 17 #include "extensions/common/error_utils.h" | 18 #include "extensions/common/error_utils.h" |
| 18 #include "extensions/common/file_util.h" | 19 #include "extensions/common/file_util.h" |
| 19 #include "extensions/common/manifest_constants.h" | 20 #include "extensions/common/manifest_constants.h" |
| 20 #include "extensions/common/manifest_handlers/permissions_parser.h" | 21 #include "extensions/common/manifest_handlers/permissions_parser.h" |
| 21 #include "extensions/common/permissions/api_permission_set.h" | 22 #include "extensions/common/permissions/api_permission_set.h" |
| 22 #include "extensions/common/switches.h" | 23 #include "extensions/common/switches.h" |
| 23 #include "grit/extensions_strings.h" | 24 #include "grit/extensions_strings.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 243 } |
| 243 | 244 |
| 244 BackgroundManifestHandler::BackgroundManifestHandler() { | 245 BackgroundManifestHandler::BackgroundManifestHandler() { |
| 245 } | 246 } |
| 246 | 247 |
| 247 BackgroundManifestHandler::~BackgroundManifestHandler() { | 248 BackgroundManifestHandler::~BackgroundManifestHandler() { |
| 248 } | 249 } |
| 249 | 250 |
| 250 bool BackgroundManifestHandler::Parse(Extension* extension, | 251 bool BackgroundManifestHandler::Parse(Extension* extension, |
| 251 base::string16* error) { | 252 base::string16* error) { |
| 252 scoped_ptr<BackgroundInfo> info(new BackgroundInfo); | 253 std::unique_ptr<BackgroundInfo> info(new BackgroundInfo); |
| 253 if (!info->Parse(extension, error)) | 254 if (!info->Parse(extension, error)) |
| 254 return false; | 255 return false; |
| 255 | 256 |
| 256 // Platform apps must have background pages. | 257 // Platform apps must have background pages. |
| 257 if (extension->is_platform_app() && !info->has_background_page()) { | 258 if (extension->is_platform_app() && !info->has_background_page()) { |
| 258 *error = ASCIIToUTF16(errors::kBackgroundRequiredForPlatformApps); | 259 *error = ASCIIToUTF16(errors::kBackgroundRequiredForPlatformApps); |
| 259 return false; | 260 return false; |
| 260 } | 261 } |
| 261 // Lazy background pages are incompatible with the webRequest API. | 262 // Lazy background pages are incompatible with the webRequest API. |
| 262 if (info->has_lazy_background_page() && | 263 if (info->has_lazy_background_page() && |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 const std::vector<std::string> BackgroundManifestHandler::Keys() const { | 334 const std::vector<std::string> BackgroundManifestHandler::Keys() const { |
| 334 static const char* keys[] = { | 335 static const char* keys[] = { |
| 335 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, | 336 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, |
| 336 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, | 337 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, |
| 337 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, | 338 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, |
| 338 keys::kPlatformAppBackgroundScripts}; | 339 keys::kPlatformAppBackgroundScripts}; |
| 339 return std::vector<std::string>(keys, keys + arraysize(keys)); | 340 return std::vector<std::string>(keys, keys + arraysize(keys)); |
| 340 } | 341 } |
| 341 | 342 |
| 342 } // namespace extensions | 343 } // namespace extensions |
| OLD | NEW |