Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / extensions / common / manifest_handlers / sandboxed_page_info.h
blob3dd0ae7242c29cd6607ba02429abe8c52c0fe6b7
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_
8 #include <string>
10 #include "extensions/common/extension.h"
11 #include "extensions/common/manifest_handler.h"
12 #include "extensions/common/url_pattern_set.h"
14 namespace extensions {
16 struct SandboxedPageInfo : public Extension::ManifestData {
17 public:
18 SandboxedPageInfo();
19 ~SandboxedPageInfo() override;
21 // Returns the extension's Content Security Policy for the sandboxed pages.
22 static const std::string& GetContentSecurityPolicy(
23 const Extension* extension);
25 // Returns the extension's sandboxed pages.
26 static const URLPatternSet& GetPages(const Extension* extension);
28 // Returns true if the specified page is sandboxed.
29 static bool IsSandboxedPage(const Extension* extension,
30 const std::string& relative_path);
32 // Optional list of extension pages that are sandboxed (served from a unique
33 // origin with a different Content Security Policy).
34 URLPatternSet pages;
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
38 // "allow-same-origin" token).
39 std::string content_security_policy;
42 class SandboxedPageHandler : public ManifestHandler {
43 public:
44 SandboxedPageHandler();
45 ~SandboxedPageHandler() override;
47 bool Parse(Extension* extension, base::string16* error) override;
49 private:
50 const std::vector<std::string> Keys() const override;
53 } // namespace extensions
55 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_SANDBOXED_PAGE_INFO_H_