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

Unified Diff: chrome/common/extensions/docs/templates/articles/manifest/event_rules.html

Issue 1158693006: Create a mechanism define declarative rules via the extension manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add thread safety to extensionregistry notifications Created 5 years, 6 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/docs/templates/articles/manifest/event_rules.html
diff --git a/chrome/common/extensions/docs/templates/articles/manifest/event_rules.html b/chrome/common/extensions/docs/templates/articles/manifest/event_rules.html
new file mode 100644
index 0000000000000000000000000000000000000000..a0d65a161a940afd59234b6e0e8e5a58c05c59d3
--- /dev/null
+++ b/chrome/common/extensions/docs/templates/articles/manifest/event_rules.html
@@ -0,0 +1,45 @@
+<h1>event_rules</h1>
+
+<p>
+The <code>event_rules</code> manifest property provides a mechanism to add rules that intercept, block, or modify web requests in-flight using <a href="../declarativeWebRequest">declarativeWebRequest</a> or take actions depending on the content of a page, without requiring permission to read the page's content using <a href="../declarativeContent">declarativeContent</a>.
+</p>
+
+<h2 id="translation">Translating rules from javascript to manifest</h2>
+
+<p>
+The following defines a rule to display a page action if the current page has a video css tag in javascript:
+</p>
+
+<pre data-filename="example.js">
+chrome.<b>declarativeContent.onPageChanged</b>.addRules([{
+ actions: [
+ new chrome.<b>declarativeContent.ShowPageAction</b>()
+ ],
+ conditions: [
+ new chrome.<b>declarativeContent.PageStateMatcher</b>(
+ <b>{css: ["video"]}</b>
+ )
+ ]
+}]);
+</pre>
+
+<p>
+This is the same definition in the manifest:
+</p>
+
+<pre data-filename="manifest.json">
+{
+ "name": "Sample {{platform}}",
+ "event_rules": {[
+ "event": <b>"declarativeContent.onPageChanged"</b>,
+ "actions": [{
+ "type": <b>"declarativeContent.ShowPageAction"</b>
+ }],
+ "conditions": [{
+ "type": <b>"declarativeContent.PageStateMatcher"</b>,
+ <b>"css": ["video"]</b>
+ }]
+ }],
+ ...
+}
+</pre>
« no previous file with comments | « chrome/common/extensions/api/_manifest_features.json ('k') | chrome/common/extensions/docs/templates/json/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698