| 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 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| 11 #include "extensions/common/manifest_handler.h" | 11 #include "extensions/common/manifest_handler.h" |
| 12 #include "extensions/common/url_pattern_set.h" | 12 #include "extensions/common/url_pattern_set.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 struct SandboxedPageInfo : public Extension::ManifestData { | 16 struct SandboxedPageInfo : public Extension::ManifestData { |
| 17 public: | 17 public: |
| 18 SandboxedPageInfo(); | 18 SandboxedPageInfo(); |
| 19 virtual ~SandboxedPageInfo(); | 19 ~SandboxedPageInfo() override; |
| 20 | 20 |
| 21 // Returns the extension's Content Security Policy for the sandboxed pages. | 21 // Returns the extension's Content Security Policy for the sandboxed pages. |
| 22 static const std::string& GetContentSecurityPolicy( | 22 static const std::string& GetContentSecurityPolicy( |
| 23 const Extension* extension); | 23 const Extension* extension); |
| 24 | 24 |
| 25 // Returns the extension's sandboxed pages. | 25 // Returns the extension's sandboxed pages. |
| 26 static const URLPatternSet& GetPages(const Extension* extension); | 26 static const URLPatternSet& GetPages(const Extension* extension); |
| 27 | 27 |
| 28 // Returns true if the specified page is sandboxed. | 28 // Returns true if the specified page is sandboxed. |
| 29 static bool IsSandboxedPage(const Extension* extension, | 29 static bool IsSandboxedPage(const Extension* extension, |
| 30 const std::string& relative_path); | 30 const std::string& relative_path); |
| 31 | 31 |
| 32 // Optional list of extension pages that are sandboxed (served from a unique | 32 // Optional list of extension pages that are sandboxed (served from a unique |
| 33 // origin with a different Content Security Policy). | 33 // origin with a different Content Security Policy). |
| 34 URLPatternSet pages; | 34 URLPatternSet pages; |
| 35 | 35 |
| 36 // Content Security Policy that should be used to enforce the sandbox used | 36 // Content Security Policy that should be used to enforce the sandbox used |
| 37 // by sandboxed pages (guaranteed to have the "sandbox" directive without the | 37 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
| 38 // "allow-same-origin" token). | 38 // "allow-same-origin" token). |
| 39 std::string content_security_policy; | 39 std::string content_security_policy; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class SandboxedPageHandler : public ManifestHandler { | 42 class SandboxedPageHandler : public ManifestHandler { |
| 43 public: | 43 public: |
| 44 SandboxedPageHandler(); | 44 SandboxedPageHandler(); |
| 45 virtual ~SandboxedPageHandler(); | 45 ~SandboxedPageHandler() override; |
| 46 | 46 |
| 47 virtual bool Parse(Extension* extension, base::string16* error) override; | 47 bool Parse(Extension* extension, base::string16* error) override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 virtual const std::vector<std::string> Keys() const override; | 50 const std::vector<std::string> Keys() const override; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace extensions | 53 } // namespace extensions |
| 54 | 54 |
| 55 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ | 55 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_ |
| OLD | NEW |