Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3781)

Unified Diff: chrome/common/extensions/manifest_web_handler.h

Issue 11821009: move 'web_accessible_resources' parsing out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_parse
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_web_handler.h
diff --git a/chrome/common/extensions/manifest_web_handler.h b/chrome/common/extensions/manifest_web_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..aaf3da899804cab3362bce892adc807650a82fc9
--- /dev/null
+++ b/chrome/common/extensions/manifest_web_handler.h
@@ -0,0 +1,47 @@
+// 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_MANIFEST_WEB_HANDLER_H_
Yoyo Zhou 2013/01/10 00:37:58 The name of this file doesn't match any class name
Joe Thomas 2013/01/10 20:56:18 Renamed to web_accessible_resources_handler.
+#define CHROME_COMMON_EXTENSIONS_MANIFEST_WEB_HANDLER_H_
+
+#include <string>
+
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/manifest_handler.h"
+
+namespace extensions {
+
+// A structure to hold the web accessible extension resources
+// that may be specified in the manifest of an extension using
+// "web_accessible_resources" key.
+struct WebAccessibleResourcesInfo : public Extension::ManifestData {
+ // Define out of line constructor/destructor to please Clang.
+ WebAccessibleResourcesInfo();
+ virtual ~WebAccessibleResourcesInfo();
+
+ // Returns true if the specified resource is web accessible.
+ static bool IsResourceWebAccessible(const std::string& relative_path,
Yoyo Zhou 2013/01/10 00:37:58 I think it's better to reverse the order of the ar
Joe Thomas 2013/01/10 20:56:18 Done.
+ const Extension* extension);
+
+ // Returns true when 'web_accessible_resources' are defined for the extension.
+ static bool HasWebAccessibleResources(const Extension* extension);
+
+ // Optional list of web accessible extension resources.
+ URLPatternSet web_accessible_resources_;
+};
+
+// Parses the "web_accessible_resources" manifest key.
+class WebAccessibleResourcesHandler : public ManifestHandler {
+ public:
+ WebAccessibleResourcesHandler();
+ virtual ~WebAccessibleResourcesHandler();
+
+ virtual bool Parse(const base::Value* value,
+ Extension* extension,
+ string16* error) OVERRIDE;
+};
+
+} // namespace extensions
+
+#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_WEB_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698