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/sandboxed_page_info.h" | 5 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 namespace keys = extensions::manifest_keys; | 24 namespace keys = extensions::manifest_keys; |
25 namespace errors = manifest_errors; | 25 namespace errors = manifest_errors; |
26 | 26 |
27 const char kDefaultSandboxedPageContentSecurityPolicy[] = | 27 const char kDefaultSandboxedPageContentSecurityPolicy[] = |
28 "sandbox allow-scripts allow-forms allow-popups allow-modals; " | 28 "sandbox allow-scripts allow-forms allow-popups allow-modals; " |
29 "script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self';"; | 29 "script-src 'self' 'unsafe-inline' 'unsafe-eval'; child-src 'self';"; |
30 | 30 |
31 static base::LazyInstance<SandboxedPageInfo> g_empty_sandboxed_info = | 31 static base::LazyInstance<SandboxedPageInfo>::DestructorAtExit |
32 LAZY_INSTANCE_INITIALIZER; | 32 g_empty_sandboxed_info = LAZY_INSTANCE_INITIALIZER; |
33 | 33 |
34 const SandboxedPageInfo& GetSandboxedPageInfo(const Extension* extension) { | 34 const SandboxedPageInfo& GetSandboxedPageInfo(const Extension* extension) { |
35 SandboxedPageInfo* info = static_cast<SandboxedPageInfo*>( | 35 SandboxedPageInfo* info = static_cast<SandboxedPageInfo*>( |
36 extension->GetManifestData(keys::kSandboxedPages)); | 36 extension->GetManifestData(keys::kSandboxedPages)); |
37 return info ? *info : g_empty_sandboxed_info.Get(); | 37 return info ? *info : g_empty_sandboxed_info.Get(); |
38 } | 38 } |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 SandboxedPageInfo::SandboxedPageInfo() { | 42 SandboxedPageInfo::SandboxedPageInfo() { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 extension->SetManifestData(keys::kSandboxedPages, std::move(sandboxed_info)); | 123 extension->SetManifestData(keys::kSandboxedPages, std::move(sandboxed_info)); |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 const std::vector<std::string> SandboxedPageHandler::Keys() const { | 127 const std::vector<std::string> SandboxedPageHandler::Keys() const { |
128 return SingleKey(keys::kSandboxedPages); | 128 return SingleKey(keys::kSandboxedPages); |
129 } | 129 } |
130 | 130 |
131 } // namespace extensions | 131 } // namespace extensions |
OLD | NEW |