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> |