| 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> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 | 31 |
| 32 namespace keys = manifest_keys; | 32 namespace keys = manifest_keys; |
| 33 namespace values = manifest_values; | 33 namespace values = manifest_values; |
| 34 namespace errors = manifest_errors; | 34 namespace errors = manifest_errors; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 const char kBackground[] = "background"; | 38 const char kBackground[] = "background"; |
| 39 | 39 |
| 40 static base::LazyInstance<BackgroundInfo> g_empty_background_info = | 40 static base::LazyInstance<BackgroundInfo>::DestructorAtExit |
| 41 LAZY_INSTANCE_INITIALIZER; | 41 g_empty_background_info = LAZY_INSTANCE_INITIALIZER; |
| 42 | 42 |
| 43 const BackgroundInfo& GetBackgroundInfo(const Extension* extension) { | 43 const BackgroundInfo& GetBackgroundInfo(const Extension* extension) { |
| 44 BackgroundInfo* info = static_cast<BackgroundInfo*>( | 44 BackgroundInfo* info = static_cast<BackgroundInfo*>( |
| 45 extension->GetManifestData(kBackground)); | 45 extension->GetManifestData(kBackground)); |
| 46 if (!info) | 46 if (!info) |
| 47 return g_empty_background_info.Get(); | 47 return g_empty_background_info.Get(); |
| 48 return *info; | 48 return *info; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 const std::vector<std::string> BackgroundManifestHandler::Keys() const { | 334 const std::vector<std::string> BackgroundManifestHandler::Keys() const { |
| 335 static const char* keys[] = { | 335 static const char* keys[] = { |
| 336 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, | 336 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, |
| 337 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, | 337 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, |
| 338 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, | 338 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, |
| 339 keys::kPlatformAppBackgroundScripts}; | 339 keys::kPlatformAppBackgroundScripts}; |
| 340 return std::vector<std::string>(keys, keys + arraysize(keys)); | 340 return std::vector<std::string>(keys, keys + arraysize(keys)); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace extensions | 343 } // namespace extensions |
| OLD | NEW |