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

Side by Side Diff: chrome/common/extensions/docs/declarative.html

Issue 10392127: Move declarative API into events API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix change schema type reference from 'Event' to 'events.Event' Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note:
2 1) The <head> information in this page is significant, should be uniform
3 across api docs and should be edited only with knowledge of the
4 templating mechanism.
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a
6 browser, it will be re-generated from the template, json schema and
7 authored overview content.
8 4) The <body>.innerHTML is also generated by an offline step so that this
9 page may easily be indexed by search engines.
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print">
14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla te_compiled.js">
15 </script>
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini fy-sans-regexp.js">
17 </script>
18 <script type="text/javascript" src="js/api_page_generator.js"></script>
19 <script type="text/javascript" src="js/bootstrap.js"></script>
20 <script type="text/javascript" src="js/sidebar.js"></script>
21 <meta name="description" content="Documentation for the chrome.declarative mod ule, which is part of the Google Chrome extension APIs."><title>chrome.declarat ive - Google Chrome Extensions - Google Code</title></head>
22 <body> <div id="devModeWarning" class="displayModeWarning">
23 You are viewing extension docs in chrome via the 'file:' scheme: are you exp ecting to see local changes when you refresh? You'll need run chrome with --allo w-file-access-from-files.
24 </div>
25 <div id="branchWarning" class="displayModeWarning">
26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation.
27 It may not work with the stable release of Chrome.</span>
28 <select id="branchChooser">
29 <option>Choose a different version...
30 </option><option value="">Stable
31 </option><option value="beta">Beta
32 </option><option value="dev">Dev
33 </option><option value="trunk">Trunk
34 </option></select>
35 </div>
36 <div id="unofficialWarning" class="displayModeWarning">
37 <span>WARNING: This is unofficial documentation. It may not work with the
38 current release of Chrome.</span>
39 <button id="goToOfficialDocs">Go to the official docs</button>
40 </div>
41 <div id="gc-container" class="labs">
42 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
43 <!-- In particular, sub-templates that recurse, must be used by allowing
44 jstemplate to make a copy of the template in this section which
45 are not operated on by way of the jsskip="true" -->
46 <!-- /SUBTEMPLATES -->
47 <a id="top"></a>
48 <div id="skipto">
49 <a href="#gc-pagecontent">Skip to page content</a>
50 <a href="#gc-toc">Skip to main navigation</a>
51 </div>
52 <!-- API HEADER -->
53 <table id="header" width="100%" cellspacing="0" border="0">
54 <tbody><tr>
55 <td valign="middle"><a href="http://code.google.com/"><img src="images/c ode_labs_logo.gif" height="43" width="161" alt="Google Code Labs" style="border: 0; margin:0;"></a></td>
56 <td valign="middle" width="100%" style="padding-left:0.6em;">
57 <form action="http://www.google.com/cse" id="cse" style="margin-top:0. 5em">
58 <div id="gsc-search-box">
59 <input type="hidden" name="cx" value="002967670403910741006:61_cvz fqtno">
60 <input type="hidden" name="ie" value="UTF-8">
61 <input type="text" name="q" value="" size="55">
62 <input class="gsc-search-button" type="submit" name="sa" value="Se arch">
63 <br>
64 <span class="greytext">e.g. "page action" or "tabs"</span>
65 </div>
66 </form>
67 <script type="text/javascript" src="https://www.google.com/jsapi"></sc ript>
68 <script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
69 <script type="text/javascript" src="https://www.google.com/coop/cse/t1 3n?form=cse&amp;t13n_langs=en"></script>
70 <script type="text/javascript" src="https://www.google.com/coop/cse/br and?form=cse&amp;lang=en"></script>
71 </td>
72 </tr>
73 </tbody></table>
74 <div id="codesiteContent" class="">
75 <a id="gc-topnav-anchor"></a>
76 <div id="gc-topnav">
77 <h1>Google Chrome Extensions (<a href="http://code.google.com/labs/">Lab s</a>)</h1>
78 <ul id="home" class="gc-topnav-tabs">
79 <li id="home_link">
80 <a href="index.html" title="Google Chrome Extensions home page">Home </a>
81 </li>
82 <li id="docs_link">
83 <a href="docs.html" title="Official Google Chrome Extensions documen tation">Docs</a>
84 </li>
85 <li id="faq_link">
86 <a href="faq.html" title="Answers to frequently asked questions abou t Google Chrome Extensions">FAQ</a>
87 </li>
88 <li id="samples_link">
89 <a href="samples.html" title="Sample extensions (with source code)"> Samples</a>
90 </li>
91 <li id="group_link">
92 <a href="http://groups.google.com/a/chromium.org/group/chromium-exte nsions" title="Google Chrome Extensions developer forum">Group</a>
93 </li>
94 <li id="so_link">
95 <a href="http://stackoverflow.com/questions/tagged/google-chrome-ext ension" title="[google-chrome-extension] tag on Stack Overflow">Questions?</a>
96 </li>
97 </ul>
98 </div> <!-- end gc-topnav -->
99 <div class="g-section g-tpl-170">
100 <!-- SIDENAV -->
101 <div class="g-unit g-first" id="gc-toc">
102 <ul>
103 <li><a href="getstarted.html">Getting Started</a></li>
104 <li><a href="overview.html">Overview</a></li>
105 <li><a href="whats_new.html">What's New?</a></li>
106 <li><h2><a href="devguide.html">Developer's Guide</a></h2>
107 <ul>
108 <li>Browser UI
109 <ul>
110 <li><a href="browserAction.html">Browser Actions</a></li>
111 <li><a href="contextMenus.html">Context Menus</a></li>
112 <li><a href="notifications.html">Desktop Notifications</a></li >
113 <li><a href="omnibox.html">Omnibox</a></li>
114 <li><a href="options.html">Options Pages</a></li>
115 <li><a href="override.html">Override Pages</a></li>
116 <li><a href="pageAction.html">Page Actions</a></li>
117 </ul>
118 </li>
119 <li>Browser Interaction
120 <ul>
121 <li><a href="bookmarks.html">Bookmarks</a></li>
122 <li><a href="cookies.html">Cookies</a></li>
123 <li><a href="devtools.html">Developer Tools</a></li>
124 <li><a href="events.html">Events</a></li>
125 <li><a href="history.html">History</a></li>
126 <li><a href="management.html">Management</a></li>
127 <li><a href="tabs.html">Tabs</a></li>
128 <li><a href="windows.html">Windows</a></li>
129 </ul>
130 </li>
131 <li>Implementation
132 <ul>
133 <li><a href="a11y.html">Accessibility</a></li>
134 <li><a href="background_pages.html">Background Pages</a></li>
135 <li><a href="content_scripts.html">Content Scripts</a></li>
136 <li><a href="xhr.html">Cross-Origin XHR</a></li>
137 <li><a href="i18n.html">Internationalization</a></li>
138 <li><a href="messaging.html">Message Passing</a></li>
139 <li><a href="permissions.html">Optional Permissions</a></li>
140 <li><a href="npapi.html">NPAPI Plugins</a></li>
141 </ul>
142 </li>
143 <li>Finishing
144 <ul>
145 <li><a href="hosting.html">Hosting</a></li>
146 <li><a href="external_extensions.html">Other Deployment Option s</a></li>
147 </ul>
148 </li>
149 </ul>
150 </li>
151 <li><h2><a href="apps.html">Packaged Apps</a></h2></li>
152 <li><h2><a href="tutorials.html">Tutorials</a></h2>
153 <ul>
154 <li><a href="tut_debugging.html">Debugging</a></li>
155 <li><a href="tut_analytics.html">Google Analytics</a></li>
156 <li><a href="tut_oauth.html">OAuth</a></li>
157 </ul>
158 </li>
159 <li><h2>Reference</h2>
160 <ul>
161 <li>Formats
162 <ul>
163 <li><a href="manifest.html">Manifest Files</a></li>
164 <li><a href="match_patterns.html">Match Patterns</a></li>
165 </ul>
166 </li>
167 <li><a href="permission_warnings.html">Permission Warnings</a></li >
168 <li><a href="api_index.html">chrome.* APIs</a></li>
169 <li><a href="api_other.html">Other APIs</a></li>
170 </ul>
171 </li>
172 <li><h2><a href="samples.html">Samples</a></h2></li>
173 <div class="line"> </div>
174 <li><h2>More</h2>
175 <ul>
176 <li><a href="http://code.google.com/chrome/webstore/docs/index.htm l">Chrome Web Store</a></li>
177 <li><a href="http://code.google.com/chrome/apps/docs/developers_gu ide.html">Hosted Apps</a></li>
178 <li><a href="themes.html">Themes</a></li>
179 </ul>
180 </li>
181 </ul>
182 </div>
183 <script>
184 initToggles();
185 </script>
186 <div class="g-unit" id="gc-pagecontent">
187 <div id="pageTitle">
188 <h1 class="page_title">chrome.declarative</h1>
189 </div>
190 <!-- TABLE OF CONTENTS -->
191 <div id="toc">
192 <h2>Contents</h2>
193 <ol>
194 <li>
195 <a href="#notes">Notes</a>
196 <ol>
197 </ol>
198 </li><li>
199 <a href="#manifest">Manifest</a>
200 <ol>
201 </ol>
202 </li><li>
203 <a href="#rules">Rules</a>
204 <ol>
205 </ol>
206 </li><li>
207 <a href="#eventobjects">Event objects</a>
208 <ol>
209 <li>
210 <a href="#addingrules">Adding rules</a>
211 </li><li>
212 <a href="#removingrules">Removing rules</a>
213 </li><li>
214 <a href="#retrievingrules">Retrieving rules</a>
215 </li>
216 </ol>
217 </li>
218 <li>
219 <a href="#apiReference">API reference: chrome.declarative</a>
220 <ol>
221 <li>
222 <a href="#global-methods">Methods</a>
223 <ol>
224 <li>
225 <a href="#method-addRules">addRules</a>
226 </li><li>
227 <a href="#method-getRules">getRules</a>
228 </li><li>
229 <a href="#method-removeRules">removeRules</a>
230 </li>
231 </ol>
232 </li>
233 <li>
234 <a href="#types">Types</a>
235 <ol>
236 <li>
237 <a href="#type-Rule">Rule</a>
238 <ol>
239 </ol>
240 </li><li>
241 <a href="#type-UrlFilter">UrlFilter</a>
242 <ol>
243 </ol>
244 </li>
245 </ol>
246 </li>
247 </ol>
248 </li>
249 </ol>
250 </div>
251 <!-- /TABLE OF CONTENTS -->
252 <!-- Standard content lead-in for experimental API pages -->
253 <p class="warning">
254 <!-- Standard content lead-in for APIs that are not yet available on
255 the stable channel. -->
256 <em>Warning:</em> This API is still under development. It is only
257 available for Chrome users on the
258 <span>
259 <strong>dev</strong>
260 <a href="http://www.chromium.org/getting-involved/dev-channel">ear ly
261 release channel</a>.</span>
262 <a href="TODO">Learn more</a>.
263 </p>
264 <!-- STATIC CONTENT PLACEHOLDER -->
265 <div id="static"><!-- BEGIN AUTHORED CONTENT -->
266 <h2 id="notes">Notes</h2>
267 <p>
268 The Declarative API is a framework to define rules consisting of declarative
269 conditions and actions. Conditions are evaluated in the browser rather than the
270 JavaScript engine which reduces roundtrip latencies and allows for very high
271 efficiency.
272 </p>
273 <p></p>The Declarative API is an abstract foundation for the <a href="declarativ eWebRequest.html">Declarative Web Request API</a> and
274 possibly further extension APIs in the future. This page describes the
275 underlying concepts of all Declarative APIs.
276 <p></p>
277 <h2 id="manifest">Manifest</h2>
278 <p>
279 You must declare the "declarative" permission in your extension's manifest
280 to use APIs that are based on this API.
281 </p>
282 <pre>{
283 "name": "My extension",
284 ...
285 <b> "permissions": [
286 "declarative",
287 ]</b>,
288 ...
289 }</pre>
290 <h2 id="rules">Rules</h2>
291 <p>The simplest possible rule consists of one or more conditions and one or more
292 actions:</p>
293 <pre>var rule = {
294 conditions: [ /* my conditions */ ],
295 actions: [ /* my actions */ ]
296 };
297 </pre>
298 <p>If any of the conditions is fulfilled, all actions are executed.</p>
299 <p>In addition to conditions and actions you may give each rule an identifier,
300 which simplifies unregistering previously registered rules, and a priority to
301 define precedences among rules. Priorities are only considered if rules conflict
302 each other or need to be executed in a specific order.</p>
303 <pre>var rule = {
304 id: "my rule", // optional, will be generated if not set.
305 priority: 100, // optional, defaults to 100.
306 conditions: [ /* my conditions */ ],
307 actions: [ /* my actions */ ]
308 };
309 </pre>
310 <h2 id="eventobjects">Event objects</h2>
311 <p>
312 <a href="events.html">Event objects</a> may support rules. These event objects
313 don't call a callback function when events happer but test whether any
314 registered rule has at least one fulfilled condition and execute the actions
315 associated with this rule. Event objects supporting the declarative API have
316 three relevant methods: <a href="#method-addRules"><code>addRules()</code></a>,
317 <a href="#method-removeRules"><code>removeRules()</code></a>, and
318 <a href="#method-getRules"><code>getRules()</code></a>.
319 </p>
320 <h3 id="addingrules">Adding rules</h3>
321 <p>
322 To add rules call the <code>addRules()</code> function of the event object. It
323 takes an array of rule instances as its first parameter and a callback function
324 that is called on completion.
325 </p>
326 <pre>var rule_list = [rule1, rule2, ...];
327 function addRules(rule_list, function callback(details) {...});
328 </pre>
329 <p>
330 If the rules were inserted successfully, the <code>details</code> parameter
331 contains an array of inserted rules appearing in the same order as in the passed
332 <code>rule_list</code> where the optional parameters <code>id</code> and
333 <code>priority</code> were filled with the generated values. If any rule is
334 invalid, e.g., because it contained an invalid condition or action, none of the
335 rules are added and the <a href="extension.html#property-lastError">lastError</a > variable is set when
336 the callback function is called. Each rule in <code>rule_list</code> must
337 contain a unique identifier that is not currently used by another rule or an
338 empty identifier.
339 </p>
340 <h3 id="removingrules">Removing rules</h3>
341 <p>
342 To remove rules call the <code>removeRules()</code> function. It accepts an
343 optional array of rule identifiers as its first parameter and a callback
344 function as its second parameter.
345 </p>
346 <pre>var rule_ids = ["id1", "id2", ...];
347 function removeRules(rule_ids, function callback() {...});
348 </pre>
349 <p>
350 If <code>rule_ids</code> is an array of identifiers, all rules having
351 identifiers listed in the array are removed. If <code>rule_ids</code> lists an
352 identifier, that is unknown, this identifier is silently ignored. If
353 <code>rule_ids</code> is <code>undefined</code>, all registered rules of this
354 extension are removed. The <code>callback()</code> function is called when the
355 rules were removed.
356 </p>
357 <h3 id="retrievingrules">Retrieving rules</h3>
358 <p>
359 To retrieve a list of currently registered rules, call the
360 <code>getRules()</code> function. It accepts an optional array of rule
361 identifiers with the same semantics as <code>removeRules</code> and a callback
362 function.
363 </p><p>
364 </p><pre>var rule_ids = ["id1", "id2", ...];
365 function getRules(rule_ids, function callback(details) {...});
366 </pre>
367 <p>
368 The <code>details</code> parameter passed to the <code>calback()</code> function
369 refers to an array of rules including filled optional parameters.
370 </p>
371 <!-- END AUTHORED CONTENT -->
372 </div>
373 <!-- API PAGE -->
374 <div class="apiPage">
375 <a name="apiReference"></a>
376 <h2>API reference: chrome.declarative</h2>
377 <!-- PROPERTIES -->
378 <!-- /apiGroup -->
379 <!-- METHODS -->
380 <div id="methodsTemplate" class="apiGroup">
381 <a name="global-methods"></a>
382 <h3>Methods</h3>
383 <!-- iterates over all functions -->
384 <div class="apiItem">
385 <a name="method-addRules"></a> <!-- method-anchor -->
386 <h4>addRules</h4>
387 <div class="summary">
388 <!-- Note: intentionally longer 80 columns -->
389 <span>chrome.declarative.addRules</span>(<span class="null"><s pan>array of Rule</span>
390 <var><span>rules</span></var></span><span class="optional" ><span>, </span><span>function</span>
391 <var><span>callback</span></var></span>)</div>
392 <div class="description">
393 <p>Registers rules to handle events. Note that you cannot call t his function as <code>chrome.declarative.addRules(...)</code>. Instead a functio n of this signature is provided for event objects supporting the declarative API such as <code>chrome.declarativeWebRequest.onRequest</code>.</p>
394 <!-- PARAMETERS -->
395 <h4>Parameters</h4>
396 <dl>
397 <div>
398 <div>
399 <dt>
400 <var>rules</var>
401 <em>
402 <!-- TYPE -->
403 <div style="display:inline">
404 (
405 <span id="typeTemplate">
406 <span>
407 <span>
408 array of <span><span>
409 <span>
410 <a href="declarative.html#type-Rule">Rule</a>
411 </span>
412 </span></span>
413 </span>
414 </span>
415 </span>
416 )
417 </div>
418 </em>
419 </dt>
420 <dd>Rules to be registered. These do not replace previously registered rules.</dd>
421 <!-- OBJECT PROPERTIES -->
422 <!-- OBJECT METHODS -->
423 <!-- OBJECT EVENT FIELDS -->
424 <!-- FUNCTION PARAMETERS -->
425 </div>
426 </div><div>
427 <div>
428 <dt>
429 <var>callback</var>
430 <em>
431 <!-- TYPE -->
432 <div style="display:inline">
433 (
434 <span class="optional">optional</span>
435 <span id="typeTemplate">
436 <span>
437 <span>function</span>
438 </span>
439 </span>
440 )
441 </div>
442 </em>
443 </dt>
444 <dd>Called with registered rules.</dd>
445 <!-- OBJECT PROPERTIES -->
446 <!-- OBJECT METHODS -->
447 <!-- OBJECT EVENT FIELDS -->
448 <!-- FUNCTION PARAMETERS -->
449 </div>
450 </div>
451 </dl>
452 <!-- RETURNS -->
453 <dl>
454 </dl>
455 <!-- CALLBACK -->
456 <div>
457 <div>
458 <h4>Callback function</h4>
459 <p>
460 If you specify the <em>callback</em> parameter, it should
461 specify a function that looks like this:
462 </p>
463 <!-- Note: intentionally longer 80 columns -->
464 <pre>function(<span>array of Rule rules</span>) <span class="s ubdued">{...}</span>;</pre>
465 <dl>
466 <div>
467 <div>
468 <dt>
469 <var>rules</var>
470 <em>
471 <!-- TYPE -->
472 <div style="display:inline">
473 (
474 <span id="typeTemplate">
475 <span>
476 <span>
477 array of <span><span>
478 <span>
479 <a href="declarative.html#type-Rule">Rule</a>
480 </span>
481 </span></span>
482 </span>
483 </span>
484 </span>
485 )
486 </div>
487 </em>
488 </dt>
489 <dd>Rules that were registered, the optional parameters are filled wit h values.</dd>
490 <!-- OBJECT PROPERTIES -->
491 <!-- OBJECT METHODS -->
492 <!-- OBJECT EVENT FIELDS -->
493 <!-- FUNCTION PARAMETERS -->
494 </div>
495 </div>
496 </dl>
497 </div>
498 </div>
499 <!-- MIN_VERSION -->
500 </div> <!-- /description -->
501 </div><div class="apiItem">
502 <a name="method-getRules"></a> <!-- method-anchor -->
503 <h4>getRules</h4>
504 <div class="summary">
505 <!-- Note: intentionally longer 80 columns -->
506 <span>chrome.declarative.getRules</span>(<span class="optional "><span>array of string</span>
507 <var><span>ruleIdentifiers</span></var></span><span class= "null"><span>, </span><span>function</span>
508 <var><span>callback</span></var></span>)</div>
509 <div class="description">
510 <p>Returns currently registered rules. Note that you cannot call this function as <code>chrome.declarative.getRules(...)</code>. Instead a funct ion of this signature is provided for event objects supporting the declarative A PI such as <code>chrome.declarativeWebRequest.onRequest</code>.</p>
511 <!-- PARAMETERS -->
512 <h4>Parameters</h4>
513 <dl>
514 <div>
515 <div>
516 <dt>
517 <var>ruleIdentifiers</var>
518 <em>
519 <!-- TYPE -->
520 <div style="display:inline">
521 (
522 <span class="optional">optional</span>
523 <span id="typeTemplate">
524 <span>
525 <span>
526 array of <span><span>
527 <span>
528 <span>string</span>
529 </span>
530 </span></span>
531 </span>
532 </span>
533 </span>
534 )
535 </div>
536 </em>
537 </dt>
538 <dd>If an array is passed, only rules with identifiers contained in th is array are returned.</dd>
539 <!-- OBJECT PROPERTIES -->
540 <!-- OBJECT METHODS -->
541 <!-- OBJECT EVENT FIELDS -->
542 <!-- FUNCTION PARAMETERS -->
543 </div>
544 </div><div>
545 <div>
546 <dt>
547 <var>callback</var>
548 <em>
549 <!-- TYPE -->
550 <div style="display:inline">
551 (
552 <span id="typeTemplate">
553 <span>
554 <span>function</span>
555 </span>
556 </span>
557 )
558 </div>
559 </em>
560 </dt>
561 <dd>Called with registered rules.</dd>
562 <!-- OBJECT PROPERTIES -->
563 <!-- OBJECT METHODS -->
564 <!-- OBJECT EVENT FIELDS -->
565 <!-- FUNCTION PARAMETERS -->
566 </div>
567 </div>
568 </dl>
569 <!-- RETURNS -->
570 <dl>
571 </dl>
572 <!-- CALLBACK -->
573 <div>
574 <div>
575 <h4>Callback function</h4>
576 <p>
577 The callback <em>parameter</em> should specify a function
578 that looks like this:
579 </p>
580 <!-- Note: intentionally longer 80 columns -->
581 <pre>function(<span>array of Rule rules</span>) <span class="s ubdued">{...}</span>;</pre>
582 <dl>
583 <div>
584 <div>
585 <dt>
586 <var>rules</var>
587 <em>
588 <!-- TYPE -->
589 <div style="display:inline">
590 (
591 <span id="typeTemplate">
592 <span>
593 <span>
594 array of <span><span>
595 <span>
596 <a href="declarative.html#type-Rule">Rule</a>
597 </span>
598 </span></span>
599 </span>
600 </span>
601 </span>
602 )
603 </div>
604 </em>
605 </dt>
606 <dd>Rules that were registered, the optional parameters are filled wit h values.</dd>
607 <!-- OBJECT PROPERTIES -->
608 <!-- OBJECT METHODS -->
609 <!-- OBJECT EVENT FIELDS -->
610 <!-- FUNCTION PARAMETERS -->
611 </div>
612 </div>
613 </dl>
614 </div>
615 </div>
616 <!-- MIN_VERSION -->
617 </div> <!-- /description -->
618 </div><div class="apiItem">
619 <a name="method-removeRules"></a> <!-- method-anchor -->
620 <h4>removeRules</h4>
621 <div class="summary">
622 <!-- Note: intentionally longer 80 columns -->
623 <span>chrome.declarative.removeRules</span>(<span class="optio nal"><span>array of string</span>
624 <var><span>ruleIdentifiers</span></var></span><span class= "optional"><span>, </span><span>function</span>
625 <var><span>callback</span></var></span>)</div>
626 <div class="description">
627 <p>Unregisters currently registered rules. Note that you cannot call this function as <code>chrome.declarative.removeRules(...)</code>. Instead a function of this signature is provided for event objects supporting the declar ative API such as <code>chrome.declarativeWebRequest.onRequest</code>.</p>
628 <!-- PARAMETERS -->
629 <h4>Parameters</h4>
630 <dl>
631 <div>
632 <div>
633 <dt>
634 <var>ruleIdentifiers</var>
635 <em>
636 <!-- TYPE -->
637 <div style="display:inline">
638 (
639 <span class="optional">optional</span>
640 <span id="typeTemplate">
641 <span>
642 <span>
643 array of <span><span>
644 <span>
645 <span>string</span>
646 </span>
647 </span></span>
648 </span>
649 </span>
650 </span>
651 )
652 </div>
653 </em>
654 </dt>
655 <dd>If an array is passed, only rules with identifiers contained in th is array are unregistered.</dd>
656 <!-- OBJECT PROPERTIES -->
657 <!-- OBJECT METHODS -->
658 <!-- OBJECT EVENT FIELDS -->
659 <!-- FUNCTION PARAMETERS -->
660 </div>
661 </div><div>
662 <div>
663 <dt>
664 <var>callback</var>
665 <em>
666 <!-- TYPE -->
667 <div style="display:inline">
668 (
669 <span class="optional">optional</span>
670 <span id="typeTemplate">
671 <span>
672 <span>function</span>
673 </span>
674 </span>
675 )
676 </div>
677 </em>
678 </dt>
679 <dd>Called when rules were unregistered.</dd>
680 <!-- OBJECT PROPERTIES -->
681 <!-- OBJECT METHODS -->
682 <!-- OBJECT EVENT FIELDS -->
683 <!-- FUNCTION PARAMETERS -->
684 </div>
685 </div>
686 </dl>
687 <!-- RETURNS -->
688 <dl>
689 </dl>
690 <!-- CALLBACK -->
691 <div>
692 <div>
693 <h4>Callback function</h4>
694 <p>
695 If you specify the <em>callback</em> parameter, it should
696 specify a function that looks like this:
697 </p>
698 <!-- Note: intentionally longer 80 columns -->
699 <pre>function(<span></span>) <span class="subdued">{...}</span >;</pre>
700 <dl>
701 </dl>
702 </div>
703 </div>
704 <!-- MIN_VERSION -->
705 </div> <!-- /description -->
706 </div> <!-- /apiItem -->
707 </div> <!-- /apiGroup -->
708 <!-- EVENTS -->
709 <!-- /apiGroup -->
710 <!-- TYPES -->
711 <div class="apiGroup">
712 <a name="types"></a>
713 <h3 id="types">Types</h3>
714 <!-- iterates over all types -->
715 <div class="apiItem">
716 <a name="type-Rule"></a>
717 <h4>Rule</h4>
718 <div>
719 <dt>
720 <em>
721 <!-- TYPE -->
722 <div style="display:inline">
723 (
724 <span id="typeTemplate">
725 <span>
726 <span>object</span>
727 </span>
728 </span>
729 )
730 </div>
731 </em>
732 </dt>
733 <dd>Description of a declarative rule for handling events.</dd>
734 <!-- OBJECT PROPERTIES -->
735 <dd>
736 <dl>
737 <div>
738 <div>
739 <dt>
740 <var>id</var>
741 <em>
742 <!-- TYPE -->
743 <div style="display:inline">
744 (
745 <span class="optional">optional</span>
746 <span id="typeTemplate">
747 <span>
748 <span>string</span>
749 </span>
750 </span>
751 )
752 </div>
753 </em>
754 </dt>
755 <dd>Optional identifier that allows referencing this rule.</dd>
756 <!-- OBJECT PROPERTIES -->
757 <!-- OBJECT METHODS -->
758 <!-- OBJECT EVENT FIELDS -->
759 <!-- FUNCTION PARAMETERS -->
760 </div>
761 </div><div>
762 <div>
763 <dt>
764 <var>conditions</var>
765 <em>
766 <!-- TYPE -->
767 <div style="display:inline">
768 (
769 <span id="typeTemplate">
770 <span>
771 <span>
772 array of <span><span>
773 <span>
774 <span>any</span>
775 </span>
776 </span></span>
777 </span>
778 </span>
779 </span>
780 )
781 </div>
782 </em>
783 </dt>
784 <dd>List of conditions that can trigger the actions.</dd>
785 <!-- OBJECT PROPERTIES -->
786 <!-- OBJECT METHODS -->
787 <!-- OBJECT EVENT FIELDS -->
788 <!-- FUNCTION PARAMETERS -->
789 </div>
790 </div><div>
791 <div>
792 <dt>
793 <var>actions</var>
794 <em>
795 <!-- TYPE -->
796 <div style="display:inline">
797 (
798 <span id="typeTemplate">
799 <span>
800 <span>
801 array of <span><span>
802 <span>
803 <span>any</span>
804 </span>
805 </span></span>
806 </span>
807 </span>
808 </span>
809 )
810 </div>
811 </em>
812 </dt>
813 <dd>List of actions that are triggered if one of the condtions is fulf illed.</dd>
814 <!-- OBJECT PROPERTIES -->
815 <!-- OBJECT METHODS -->
816 <!-- OBJECT EVENT FIELDS -->
817 <!-- FUNCTION PARAMETERS -->
818 </div>
819 </div><div>
820 <div>
821 <dt>
822 <var>priority</var>
823 <em>
824 <!-- TYPE -->
825 <div style="display:inline">
826 (
827 <span class="optional">optional</span>
828 <span id="typeTemplate">
829 <span>
830 <span>integer</span>
831 </span>
832 </span>
833 )
834 </div>
835 </em>
836 </dt>
837 <dd>Optional priority of this rule. Defaults to 100.</dd>
838 <!-- OBJECT PROPERTIES -->
839 <!-- OBJECT METHODS -->
840 <!-- OBJECT EVENT FIELDS -->
841 <!-- FUNCTION PARAMETERS -->
842 </div>
843 </div>
844 </dl>
845 </dd>
846 <!-- OBJECT METHODS -->
847 <!-- OBJECT EVENT FIELDS -->
848 <!-- FUNCTION PARAMETERS -->
849 </div>
850 </div><div class="apiItem">
851 <a name="type-UrlFilter"></a>
852 <h4>UrlFilter</h4>
853 <div>
854 <dt>
855 <em>
856 <!-- TYPE -->
857 <div style="display:inline">
858 (
859 <span id="typeTemplate">
860 <span>
861 <span>object</span>
862 </span>
863 </span>
864 )
865 </div>
866 </em>
867 </dt>
868 <dd>Filters URLs for various criteria</dd>
869 <!-- OBJECT PROPERTIES -->
870 <dd>
871 <dl>
872 <div>
873 <div>
874 <dt>
875 <var>hostContains</var>
876 <em>
877 <!-- TYPE -->
878 <div style="display:inline">
879 (
880 <span class="optional">optional</span>
881 <span id="typeTemplate">
882 <span>
883 <span>string</span>
884 </span>
885 </span>
886 )
887 </div>
888 </em>
889 </dt>
890 <dd>Matches if the host name of the URL contains a specified string.</ dd>
891 <!-- OBJECT PROPERTIES -->
892 <!-- OBJECT METHODS -->
893 <!-- OBJECT EVENT FIELDS -->
894 <!-- FUNCTION PARAMETERS -->
895 </div>
896 </div><div>
897 <div>
898 <dt>
899 <var>hostEquals</var>
900 <em>
901 <!-- TYPE -->
902 <div style="display:inline">
903 (
904 <span class="optional">optional</span>
905 <span id="typeTemplate">
906 <span>
907 <span>string</span>
908 </span>
909 </span>
910 )
911 </div>
912 </em>
913 </dt>
914 <dd>Matches if the host name of the URL is equal to a specified string .</dd>
915 <!-- OBJECT PROPERTIES -->
916 <!-- OBJECT METHODS -->
917 <!-- OBJECT EVENT FIELDS -->
918 <!-- FUNCTION PARAMETERS -->
919 </div>
920 </div><div>
921 <div>
922 <dt>
923 <var>hostPrefix</var>
924 <em>
925 <!-- TYPE -->
926 <div style="display:inline">
927 (
928 <span class="optional">optional</span>
929 <span id="typeTemplate">
930 <span>
931 <span>string</span>
932 </span>
933 </span>
934 )
935 </div>
936 </em>
937 </dt>
938 <dd>Matches if the host name of the URL starts with a specified string .</dd>
939 <!-- OBJECT PROPERTIES -->
940 <!-- OBJECT METHODS -->
941 <!-- OBJECT EVENT FIELDS -->
942 <!-- FUNCTION PARAMETERS -->
943 </div>
944 </div><div>
945 <div>
946 <dt>
947 <var>hostSuffix</var>
948 <em>
949 <!-- TYPE -->
950 <div style="display:inline">
951 (
952 <span class="optional">optional</span>
953 <span id="typeTemplate">
954 <span>
955 <span>string</span>
956 </span>
957 </span>
958 )
959 </div>
960 </em>
961 </dt>
962 <dd>Matches if the host name of the URL ends with a specified string.< /dd>
963 <!-- OBJECT PROPERTIES -->
964 <!-- OBJECT METHODS -->
965 <!-- OBJECT EVENT FIELDS -->
966 <!-- FUNCTION PARAMETERS -->
967 </div>
968 </div><div>
969 <div>
970 <dt>
971 <var>pathContains</var>
972 <em>
973 <!-- TYPE -->
974 <div style="display:inline">
975 (
976 <span class="optional">optional</span>
977 <span id="typeTemplate">
978 <span>
979 <span>string</span>
980 </span>
981 </span>
982 )
983 </div>
984 </em>
985 </dt>
986 <dd>Matches if the path segment of the URL contains a specified string .</dd>
987 <!-- OBJECT PROPERTIES -->
988 <!-- OBJECT METHODS -->
989 <!-- OBJECT EVENT FIELDS -->
990 <!-- FUNCTION PARAMETERS -->
991 </div>
992 </div><div>
993 <div>
994 <dt>
995 <var>pathEquals</var>
996 <em>
997 <!-- TYPE -->
998 <div style="display:inline">
999 (
1000 <span class="optional">optional</span>
1001 <span id="typeTemplate">
1002 <span>
1003 <span>string</span>
1004 </span>
1005 </span>
1006 )
1007 </div>
1008 </em>
1009 </dt>
1010 <dd>Matches if the path segment of the URL is equal to a specified str ing.</dd>
1011 <!-- OBJECT PROPERTIES -->
1012 <!-- OBJECT METHODS -->
1013 <!-- OBJECT EVENT FIELDS -->
1014 <!-- FUNCTION PARAMETERS -->
1015 </div>
1016 </div><div>
1017 <div>
1018 <dt>
1019 <var>pathPrefix</var>
1020 <em>
1021 <!-- TYPE -->
1022 <div style="display:inline">
1023 (
1024 <span class="optional">optional</span>
1025 <span id="typeTemplate">
1026 <span>
1027 <span>string</span>
1028 </span>
1029 </span>
1030 )
1031 </div>
1032 </em>
1033 </dt>
1034 <dd>Matches if the path segment of the URL starts with a specified str ing.</dd>
1035 <!-- OBJECT PROPERTIES -->
1036 <!-- OBJECT METHODS -->
1037 <!-- OBJECT EVENT FIELDS -->
1038 <!-- FUNCTION PARAMETERS -->
1039 </div>
1040 </div><div>
1041 <div>
1042 <dt>
1043 <var>pathSuffix</var>
1044 <em>
1045 <!-- TYPE -->
1046 <div style="display:inline">
1047 (
1048 <span class="optional">optional</span>
1049 <span id="typeTemplate">
1050 <span>
1051 <span>string</span>
1052 </span>
1053 </span>
1054 )
1055 </div>
1056 </em>
1057 </dt>
1058 <dd>Matches if the path segment of the URL ends with a specified strin g.</dd>
1059 <!-- OBJECT PROPERTIES -->
1060 <!-- OBJECT METHODS -->
1061 <!-- OBJECT EVENT FIELDS -->
1062 <!-- FUNCTION PARAMETERS -->
1063 </div>
1064 </div><div>
1065 <div>
1066 <dt>
1067 <var>queryEquals</var>
1068 <em>
1069 <!-- TYPE -->
1070 <div style="display:inline">
1071 (
1072 <span class="optional">optional</span>
1073 <span id="typeTemplate">
1074 <span>
1075 <span>string</span>
1076 </span>
1077 </span>
1078 )
1079 </div>
1080 </em>
1081 </dt>
1082 <dd>Matches if the query segment of the URL is equal to a specified st ring.</dd>
1083 <!-- OBJECT PROPERTIES -->
1084 <!-- OBJECT METHODS -->
1085 <!-- OBJECT EVENT FIELDS -->
1086 <!-- FUNCTION PARAMETERS -->
1087 </div>
1088 </div><div>
1089 <div>
1090 <dt>
1091 <var>queryPrefix</var>
1092 <em>
1093 <!-- TYPE -->
1094 <div style="display:inline">
1095 (
1096 <span class="optional">optional</span>
1097 <span id="typeTemplate">
1098 <span>
1099 <span>string</span>
1100 </span>
1101 </span>
1102 )
1103 </div>
1104 </em>
1105 </dt>
1106 <dd>Matches if the query segment of the URL starts with a specified st ring.</dd>
1107 <!-- OBJECT PROPERTIES -->
1108 <!-- OBJECT METHODS -->
1109 <!-- OBJECT EVENT FIELDS -->
1110 <!-- FUNCTION PARAMETERS -->
1111 </div>
1112 </div><div>
1113 <div>
1114 <dt>
1115 <var>querySuffix</var>
1116 <em>
1117 <!-- TYPE -->
1118 <div style="display:inline">
1119 (
1120 <span class="optional">optional</span>
1121 <span id="typeTemplate">
1122 <span>
1123 <span>string</span>
1124 </span>
1125 </span>
1126 )
1127 </div>
1128 </em>
1129 </dt>
1130 <dd>Matches if the query segment of the URL ends with a specified stri ng.</dd>
1131 <!-- OBJECT PROPERTIES -->
1132 <!-- OBJECT METHODS -->
1133 <!-- OBJECT EVENT FIELDS -->
1134 <!-- FUNCTION PARAMETERS -->
1135 </div>
1136 </div><div>
1137 <div>
1138 <dt>
1139 <var>urlSuffix</var>
1140 <em>
1141 <!-- TYPE -->
1142 <div style="display:inline">
1143 (
1144 <span class="optional">optional</span>
1145 <span id="typeTemplate">
1146 <span>
1147 <span>string</span>
1148 </span>
1149 </span>
1150 )
1151 </div>
1152 </em>
1153 </dt>
1154 <dd>Matches if the URL ends with a specified string.</dd>
1155 <!-- OBJECT PROPERTIES -->
1156 <!-- OBJECT METHODS -->
1157 <!-- OBJECT EVENT FIELDS -->
1158 <!-- FUNCTION PARAMETERS -->
1159 </div>
1160 </div><div>
1161 <div>
1162 <dt>
1163 <var>urlEquals</var>
1164 <em>
1165 <!-- TYPE -->
1166 <div style="display:inline">
1167 (
1168 <span class="optional">optional</span>
1169 <span id="typeTemplate">
1170 <span>
1171 <span>string</span>
1172 </span>
1173 </span>
1174 )
1175 </div>
1176 </em>
1177 </dt>
1178 <dd>Matches if the URL is equal to a specified string.</dd>
1179 <!-- OBJECT PROPERTIES -->
1180 <!-- OBJECT METHODS -->
1181 <!-- OBJECT EVENT FIELDS -->
1182 <!-- FUNCTION PARAMETERS -->
1183 </div>
1184 </div><div>
1185 <div>
1186 <dt>
1187 <var>urlPrefix</var>
1188 <em>
1189 <!-- TYPE -->
1190 <div style="display:inline">
1191 (
1192 <span class="optional">optional</span>
1193 <span id="typeTemplate">
1194 <span>
1195 <span>string</span>
1196 </span>
1197 </span>
1198 )
1199 </div>
1200 </em>
1201 </dt>
1202 <dd>Matches if the URL starts with a specified string.</dd>
1203 <!-- OBJECT PROPERTIES -->
1204 <!-- OBJECT METHODS -->
1205 <!-- OBJECT EVENT FIELDS -->
1206 <!-- FUNCTION PARAMETERS -->
1207 </div>
1208 </div><div>
1209 <div>
1210 <dt>
1211 <var>schemes</var>
1212 <em>
1213 <!-- TYPE -->
1214 <div style="display:inline">
1215 (
1216 <span class="optional">optional</span>
1217 <span id="typeTemplate">
1218 <span>
1219 <span>
1220 array of <span><span>
1221 <span>
1222 <span>string</span>
1223 </span>
1224 </span></span>
1225 </span>
1226 </span>
1227 </span>
1228 )
1229 </div>
1230 </em>
1231 </dt>
1232 <dd>Matches if the scheme of the URL is equal to any of the schemes sp ecified in the array.</dd>
1233 <!-- OBJECT PROPERTIES -->
1234 <!-- OBJECT METHODS -->
1235 <!-- OBJECT EVENT FIELDS -->
1236 <!-- FUNCTION PARAMETERS -->
1237 </div>
1238 </div><div>
1239 <div>
1240 <dt>
1241 <var>ports</var>
1242 <em>
1243 <!-- TYPE -->
1244 <div style="display:inline">
1245 (
1246 <span class="optional">optional</span>
1247 <span id="typeTemplate">
1248 <span>
1249 <span>
1250 array of <span><span>
1251 <span>
1252 <span>integer or array of integer</span>
1253 </span>
1254 </span></span>
1255 </span>
1256 </span>
1257 </span>
1258 )
1259 </div>
1260 </em>
1261 </dt>
1262 <dd>Matches if the port of the URL is contained in any of the specifie d port lists. For example <code>[80, 443, [1000, 1200]]</code> matches all reque sts on port 80, 443 and in the range 1000-1200.</dd>
1263 <!-- OBJECT PROPERTIES -->
1264 <!-- OBJECT METHODS -->
1265 <!-- OBJECT EVENT FIELDS -->
1266 <!-- FUNCTION PARAMETERS -->
1267 </div>
1268 </div>
1269 </dl>
1270 </dd>
1271 <!-- OBJECT METHODS -->
1272 <!-- OBJECT EVENT FIELDS -->
1273 <!-- FUNCTION PARAMETERS -->
1274 </div>
1275 </div> <!-- /apiItem -->
1276 </div> <!-- /apiGroup -->
1277 </div> <!-- /apiPage -->
1278 </div> <!-- /gc-pagecontent -->
1279 </div> <!-- /g-section -->
1280 </div> <!-- /codesiteContent -->
1281 <div id="gc-footer" --="">
1282 <div class="text">
1283 <p>
1284 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>,
1285 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons
1286 Attribution 3.0 License</a>, and code samples are licensed under the
1287 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>.
1288 </p>
1289 <p>
1290 ©2011 Google
1291 </p>
1292 <!-- begin analytics -->
1293 <script src="https://www.google-analytics.com/urchin.js" type="text/javascript"> </script>
1294 <script src="https://www.google-analytics.com/ga.js" type="text/javascript"></sc ript>
1295 <script type="text/javascript">
1296 // chrome doc tracking
1297 try {
1298 var engdocs = _gat._getTracker("YT-10763712-2");
1299 engdocs._trackPageview();
1300 } catch(err) {}
1301 // code.google.com site-wide tracking
1302 try {
1303 _uacct="UA-18071-1";
1304 _uanchor=1;
1305 _uff=0;
1306 urchinTracker();
1307 }
1308 catch(e) {/* urchinTracker not available. */}
1309 </script>
1310 <!-- end analytics -->
1311 </div>
1312 </div> <!-- /gc-footer -->
1313 </div> <!-- /gc-container -->
1314 </body></html>
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/api_index.html ('k') | chrome/common/extensions/docs/declarativeWebRequest.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698