OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_WEBVIEW_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
14 #include "extensions/common/manifest_handler.h" | 14 #include "extensions/common/manifest_handler.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 class PartitionItem; | 18 class PartitionItem; |
19 | 19 |
20 // A class to hold the <webview> accessible extension resources | 20 // A class to hold the <webview> accessible extension resources |
21 // that may be specified in the manifest of an extension using the | 21 // that may be specified in the manifest of an extension using the |
22 // "webview" key. | 22 // "webview" key. |
23 class WebviewInfo : public Extension::ManifestData { | 23 class WebviewInfo : public Extension::ManifestData { |
24 public: | 24 public: |
25 // Returns true if |extension|'s resource at |relative_path| is accessible | 25 // Returns true if |extension|'s resource at |relative_path| is accessible |
26 // from the WebView partition with ID |partition_id|. | 26 // from the WebView partition with ID |partition_id|. |
27 static bool IsResourceWebviewAccessible(const Extension* extension, | 27 static bool IsResourceWebviewAccessible(const Extension* extension, |
28 const std::string& partition_id, | 28 const std::string& partition_id, |
29 const std::string& relative_path); | 29 const std::string& relative_path); |
| 30 // Returns true if the given |extension| has any webview accessible |
| 31 // resources in the given |partition_id|. |
| 32 static bool HasWebviewAccessibleResources(const Extension& extension, |
| 33 const std::string& partition_id); |
30 | 34 |
31 // Define out of line constructor/destructor to please Clang. | 35 // Define out of line constructor/destructor to please Clang. |
32 explicit WebviewInfo(const std::string& extension_id); | 36 explicit WebviewInfo(const std::string& extension_id); |
33 ~WebviewInfo() override; | 37 ~WebviewInfo() override; |
34 | 38 |
35 void AddPartitionItem(std::unique_ptr<PartitionItem> item); | 39 void AddPartitionItem(std::unique_ptr<PartitionItem> item); |
36 | 40 |
37 private: | 41 private: |
38 std::string extension_id_; | 42 std::string extension_id_; |
39 std::vector<std::unique_ptr<PartitionItem>> partition_items_; | 43 std::vector<std::unique_ptr<PartitionItem>> partition_items_; |
(...skipping 11 matching lines...) Expand all Loading... |
51 | 55 |
52 private: | 56 private: |
53 const std::vector<std::string> Keys() const override; | 57 const std::vector<std::string> Keys() const override; |
54 | 58 |
55 DISALLOW_COPY_AND_ASSIGN(WebviewHandler); | 59 DISALLOW_COPY_AND_ASSIGN(WebviewHandler); |
56 }; | 60 }; |
57 | 61 |
58 } // namespace extensions | 62 } // namespace extensions |
59 | 63 |
60 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ | 64 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_WEBVIEW_INFO_H_ |
OLD | NEW |