Chromium Code Reviews| Index: chrome/common/extensions/webview_accessible_resources_handler.h |
| diff --git a/chrome/common/extensions/webview_accessible_resources_handler.h b/chrome/common/extensions/webview_accessible_resources_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aba2a5b5d03f0281c53c966c16fa1d692c921809 |
| --- /dev/null |
| +++ b/chrome/common/extensions/webview_accessible_resources_handler.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_COMMON_EXTENSIONS_WEBVIEW_ACCESSIBLE_RESOURCES_HANDLER_H_ |
| +#define CHROME_COMMON_EXTENSIONS_WEBVIEW_ACCESSIBLE_RESOURCES_HANDLER_H_ |
| + |
| +#include <string> |
| + |
| +#include "chrome/common/extensions/extension.h" |
| +#include "chrome/common/extensions/manifest_handler.h" |
| + |
| +namespace extensions { |
| + |
| +// A structure to hold the <webview> accessible extension resources |
| +// that may be specified in the manifest of an extension using |
| +// "webview_accessible_resources" key. |
| +struct WebviewAccessibleResourcesInfo : public Extension::ManifestData { |
|
Matt Perry
2013/09/24 23:09:29
Make this WebviewInfo, and update the filename and
Fady Samuel
2013/09/24 23:35:38
Done.
|
| + // Define out of line constructor/destructor to please Clang. |
| + WebviewAccessibleResourcesInfo(); |
| + virtual ~WebviewAccessibleResourcesInfo(); |
| + |
| + // Returns true if the specified resource is web accessible. |
| + static bool IsResourceWebviewAccessible(const Extension* extension, |
| + const std::string& partition_id, |
| + const std::string& relative_path); |
| + |
| + // Returns true when 'webview_accessible_resources' are defined for the |
| + // app. |
| + static bool HasWebviewAccessibleResources(const Extension* extension); |
| + |
| + // Optional list of webview accessible extension resources. |
| + std::vector<std::string> webview_privileged_partitions_; |
| + URLPatternSet webview_accessible_resources_; |
| +}; |
| + |
| +// Parses the "webview_accessible_resources" manifest key. |
| +class WebviewAccessibleResourcesHandler : public ManifestHandler { |
| + public: |
| + WebviewAccessibleResourcesHandler(); |
| + virtual ~WebviewAccessibleResourcesHandler(); |
| + |
| + virtual bool Parse(Extension* extension, string16* error) OVERRIDE; |
| + |
| + private: |
| + virtual const std::vector<std::string> Keys() const OVERRIDE; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebviewAccessibleResourcesHandler); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_COMMON_EXTENSIONS_WEBVIEW_ACCESSIBLE_RESOURCES_HANDLER_H_ |