Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / manifest_handlers / content_capabilities_handler.h
blobef1bd1113ea300c622338bdbbf99287ecbc3b0d6
1 // Copyright 2014 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_CONTENT_CAPABILITIES_HANDLER_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_CONTENT_CAPABILITIES_HANDLER_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest_handler.h"
14 #include "extensions/common/permissions/permission_set.h"
15 #include "extensions/common/url_pattern_set.h"
17 namespace extensions {
19 // Manifest data describing an extension's set of granted content capabilities.
20 struct ContentCapabilitiesInfo : public Extension::ManifestData {
21 // The set of API permissions to be granted to web content.
22 APIPermissionSet permissions;
24 // The URL pattern set which should be used to decide which content is granted
25 // these capabilities.
26 URLPatternSet url_patterns;
28 ContentCapabilitiesInfo();
29 ~ContentCapabilitiesInfo() override;
31 static const ContentCapabilitiesInfo& Get(const Extension* extension);
34 // Parses the "content_capabilities" manifest key.
35 class ContentCapabilitiesHandler : public ManifestHandler {
36 public:
37 ContentCapabilitiesHandler();
38 ~ContentCapabilitiesHandler() override;
40 bool Parse(Extension* extension, base::string16* error) override;
42 private:
43 const std::vector<std::string> Keys() const override;
45 DISALLOW_COPY_AND_ASSIGN(ContentCapabilitiesHandler);
48 } // namespace extensions
50 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_CONTENT_CAPABILITIES_HANDLER_H_