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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <h1>event_rules</h1>
2
3 <p>
4 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="../decla rativeWebRequest">declarativeWebRequest</a> or take actions depending on the con tent of a page, without requiring permission to read the page's content using <a href="../declarativeContent">declarativeContent</a>.
5 </p>
6
7 <h2 id="translation">Translating rules from javascript to manifest</h2>
8
9 <p>
10 The following defines a rule to display a page action if the current page has a video css tag in javascript:
11 </p>
12
13 <pre data-filename="example.js">
14 chrome.<b>declarativeContent.onPageChanged</b>.addRules([{
15 actions: [
16 new chrome.<b>declarativeContent.ShowPageAction</b>()
17 ],
18 conditions: [
19 new chrome.<b>declarativeContent.PageStateMatcher</b>(
20 <b>{css: ["video"]}</b>
21 )
22 ]
23 }]);
24 </pre>
25
26 <p>
27 This is the same definition in the manifest:
28 </p>
29
30 <pre data-filename="manifest.json">
31 {
32 "name": "Sample {{platform}}",
33 "event_rules": {[
34 "event": <b>"declarativeContent.onPageChanged"</b>,
35 "actions": [{
36 "type": <b>"declarativeContent.ShowPageAction"</b>
37 }],
38 "conditions": [{
39 "type": <b>"declarativeContent.PageStateMatcher"</b>,
40 <b>"css": ["video"]</b>
41 }]
42 }],
43 ...
44 }
45 </pre>
OLDNEW
« 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