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

Side by Side Diff: chrome/common/extensions/docs/events.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
1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc. Note: 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 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 3 across api docs and should be edited only with knowledge of the
4 templating mechanism. 4 templating mechanism.
5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a 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 6 browser, it will be re-generated from the template, json schema and
7 authored overview content. 7 authored overview content.
8 4) The <body>.innerHTML is also generated by an offline step so that this 8 4) The <body>.innerHTML is also generated by an offline step so that this
9 page may easily be indexed by search engines. 9 page may easily be indexed by search engines.
10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head>
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css"> 12 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
13 <link href="css/print.css" rel="stylesheet" type="text/css" media="print"> 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"> 14 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla te_compiled.js">
15 </script> 15 </script>
16 <script type="text/javascript" src="../../../../third_party/json_minify/mini fy-sans-regexp.js"> 16 <script type="text/javascript" src="../../../../third_party/json_minify/mini fy-sans-regexp.js">
17 </script> 17 </script>
18 <script type="text/javascript" src="js/api_page_generator.js"></script> 18 <script type="text/javascript" src="js/api_page_generator.js"></script>
19 <script type="text/javascript" src="js/bootstrap.js"></script> 19 <script type="text/javascript" src="js/bootstrap.js"></script>
20 <script type="text/javascript" src="js/sidebar.js"></script> 20 <script type="text/javascript" src="js/sidebar.js"></script>
21 <title>Events - Google Chrome Extensions - Google Code</title></head> 21 <meta name="description" content="Documentation for the chrome.events module, which is part of the Google Chrome extension APIs."><title>chrome.events - Goog le Chrome Extensions - Google Code</title></head>
22 <body> <div id="devModeWarning" class="displayModeWarning"> 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. 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> 24 </div>
25 <div id="branchWarning" class="displayModeWarning"> 25 <div id="branchWarning" class="displayModeWarning">
26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation. 26 <span>WARNING: This is the <span id="branchName">BETA</span> documentation.
27 It may not work with the stable release of Chrome.</span> 27 It may not work with the stable release of Chrome.</span>
28 <select id="branchChooser"> 28 <select id="branchChooser">
29 <option>Choose a different version... 29 <option>Choose a different version...
30 </option><option value="">Stable 30 </option><option value="">Stable
31 </option><option value="beta">Beta 31 </option><option value="beta">Beta
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 <li><a href="themes.html">Themes</a></li> 178 <li><a href="themes.html">Themes</a></li>
179 </ul> 179 </ul>
180 </li> 180 </li>
181 </ul> 181 </ul>
182 </div> 182 </div>
183 <script> 183 <script>
184 initToggles(); 184 initToggles();
185 </script> 185 </script>
186 <div class="g-unit" id="gc-pagecontent"> 186 <div class="g-unit" id="gc-pagecontent">
187 <div id="pageTitle"> 187 <div id="pageTitle">
188 <h1 class="page_title">Events</h1> 188 <h1 class="page_title">chrome.events</h1>
189 </div> 189 </div>
190 <!-- TABLE OF CONTENTS --> 190 <!-- TABLE OF CONTENTS -->
191 <div id="toc">
192 <h2>Contents</h2>
193 <ol>
194 <li>
195 <a href="#H2-0">
196 Methods
197 </a>
198 <ol>
199 </ol>
200 </li><li>
201 <a href="#declarative">Declarative Event Handlers</a>
202 <ol>
203 <li>
204 <a href="#rules">Rules</a>
205 </li><li>
206 <a href="#eventobjects">Event objects</a>
207 </li><li>
208 <a href="#addingrules">Adding rules</a>
209 </li><li>
210 <a href="#removingrules">Removing rules</a>
211 </li><li>
212 <a href="#retrievingrules">Retrieving rules</a>
213 </li>
214 </ol>
215 </li>
216 <li>
217 <a href="#apiReference">API reference: chrome.events</a>
218 <ol>
219 <li>
220 <a href="#types">Types</a>
221 <ol>
222 <li>
223 <a href="#type-Event">Event</a>
224 <ol>
225 <li>
226 <a href="#global-Event-methods">Methods</a>
227 <ol>
228 <li>
229 <a href="#method-Event-addListener">addListener</a>
230 </li><li>
231 <a href="#method-Event-addRules">addRules</a>
232 </li><li>
233 <a href="#method-Event-getRules">getRules</a>
234 </li><li>
235 <a href="#method-Event-hasListener">hasListener</a>
236 </li><li>
237 <a href="#method-Event-hasListeners">hasListeners</a>
238 </li><li>
239 <a href="#method-Event-removeListener">removeListener</a>
240 </li><li>
241 <a href="#method-Event-removeRules">removeRules</a>
242 </li>
243 </ol>
244 </li>
245 </ol>
246 </li><li>
247 <a href="#type-Rule">Rule</a>
248 <ol>
249 </ol>
250 </li><li>
251 <a href="#type-UrlFilter">UrlFilter</a>
252 <ol>
253 </ol>
254 </li>
255 </ol>
256 </li>
257 </ol>
258 </li>
259 </ol>
260 </div>
191 <!-- /TABLE OF CONTENTS --> 261 <!-- /TABLE OF CONTENTS -->
192 <!-- Standard content lead-in for experimental API pages --> 262 <!-- Standard content lead-in for experimental API pages -->
193 <!-- STATIC CONTENT PLACEHOLDER --> 263 <!-- STATIC CONTENT PLACEHOLDER -->
194 <div id="static"><p> 264 <div id="static"><p>
195 An <code>Event</code> is an object 265 An <code>Event</code> is an object
196 that allows you to be notified 266 that allows you to be notified
197 when something interesting happens. 267 when something interesting happens.
198 Here's an example of using the 268 Here's an example of using the
199 <code>chrome.tabs.onCreated</code> event 269 <code>chrome.tabs.onCreated</code> event
200 to be notified whenever there's a new tab: 270 to be notified whenever there's a new tab:
(...skipping 12 matching lines...) Expand all
213 The argument to <code>addListener()</code> 283 The argument to <code>addListener()</code>
214 is always a function that you define to handle the event, 284 is always a function that you define to handle the event,
215 but the parameters to the function depend on 285 but the parameters to the function depend on
216 which event you're handling. 286 which event you're handling.
217 Checking the documentation for 287 Checking the documentation for
218 <a href="tabs.html#event-onCreated"><code>chrome.tabs.onCreated</code></a>, 288 <a href="tabs.html#event-onCreated"><code>chrome.tabs.onCreated</code></a>,
219 you can see that the function has a single parameter: 289 you can see that the function has a single parameter:
220 a <a href="tabs.html#type-Tab">Tab</a> object 290 a <a href="tabs.html#type-Tab">Tab</a> object
221 that has details about the newly created tab. 291 that has details about the newly created tab.
222 </p> 292 </p>
223 <h2> 293 <a name="H2-0"></a><h2>
224 Methods 294 Methods
225 </h2> 295 </h2>
226 <p> 296 <p>
227 You can invoke the following methods on any <code>Event</code> object: 297 You can invoke the following methods on any <code>Event</code> object:
228 </p> 298 </p>
229 <pre>void addListener(function callback(...)) 299 <pre>void addListener(function callback(...))
230 void removeListener(function callback(...)) 300 void removeListener(function callback(...))
231 bool hasListener(function callback(...)) 301 bool hasListener(function callback(...))
232 </pre> 302 </pre>
233 <!-- [PENDING: explain removeListener and hasListener] --> 303 <!-- [PENDING: explain removeListener and hasListener] -->
304 <h2 id="declarative">Declarative Event Handlers</h2>
305 <p>
306 The declarative event handlers provide a means to define rules consisting of
307 declarative conditions and actions. Conditions are evaluated in the browser
308 rather than the JavaScript engine which reduces roundtrip latencies and allows
309 for very high efficiency.
310 </p>
311 <p>Declarative event handlers are used for example in the <a href="declarativeWe bRequest.html">Declarative Web Request API</a> and possibly
312 further extension APIs in the future. This page describes the underlying
313 concepts of all declarative event handlers.
314 </p>
315 <h3 id="rules">Rules</h3>
316 <p>The simplest possible rule consists of one or more conditions and one or more
317 actions:</p>
318 <pre>var rule = {
319 conditions: [ /* my conditions */ ],
320 actions: [ /* my actions */ ]
321 };
322 </pre>
323 <p>If any of the conditions is fulfilled, all actions are executed.</p>
324 <p>In addition to conditions and actions you may give each rule an identifier,
325 which simplifies unregistering previously registered rules, and a priority to
326 define precedences among rules. Priorities are only considered if rules conflict
327 each other or need to be executed in a specific order.</p>
328 <pre>var rule = {
329 id: "my rule", // optional, will be generated if not set.
330 priority: 100, // optional, defaults to 100.
331 conditions: [ /* my conditions */ ],
332 actions: [ /* my actions */ ]
333 };
334 </pre>
335 <h3 id="eventobjects">Event objects</h3>
336 <p>
337 <a href="events.html">Event objects</a> may support rules. These event objects
338 don't call a callback function when events happer but test whether any
339 registered rule has at least one fulfilled condition and execute the actions
340 associated with this rule. Event objects supporting the declarative API have
341 three relevant methods: <a href="#method-addRules"><code>addRules()</code></a>,
342 <a href="#method-removeRules"><code>removeRules()</code></a>, and
343 <a href="#method-getRules"><code>getRules()</code></a>.
344 </p>
345 <h3 id="addingrules">Adding rules</h3>
346 <p>
347 To add rules call the <code>addRules()</code> function of the event object. It
348 takes an array of rule instances as its first parameter and a callback function
349 that is called on completion.
350 </p>
351 <pre>var rule_list = [rule1, rule2, ...];
352 function addRules(rule_list, function callback(details) {...});
353 </pre>
354 <p>
355 If the rules were inserted successfully, the <code>details</code> parameter
356 contains an array of inserted rules appearing in the same order as in the passed
357 <code>rule_list</code> where the optional parameters <code>id</code> and
358 <code>priority</code> were filled with the generated values. If any rule is
359 invalid, e.g., because it contained an invalid condition or action, none of the
360 rules are added and the <a href="extension.html#property-lastError">lastError</a > variable is set when
361 the callback function is called. Each rule in <code>rule_list</code> must
362 contain a unique identifier that is not currently used by another rule or an
363 empty identifier.
364 </p>
365 <h3 id="removingrules">Removing rules</h3>
366 <p>
367 To remove rules call the <code>removeRules()</code> function. It accepts an
368 optional array of rule identifiers as its first parameter and a callback
369 function as its second parameter.
370 </p>
371 <pre>var rule_ids = ["id1", "id2", ...];
372 function removeRules(rule_ids, function callback() {...});
373 </pre>
374 <p>
375 If <code>rule_ids</code> is an array of identifiers, all rules having
376 identifiers listed in the array are removed. If <code>rule_ids</code> lists an
377 identifier, that is unknown, this identifier is silently ignored. If
378 <code>rule_ids</code> is <code>undefined</code>, all registered rules of this
379 extension are removed. The <code>callback()</code> function is called when the
380 rules were removed.
381 </p>
382 <h3 id="retrievingrules">Retrieving rules</h3>
383 <p>
384 To retrieve a list of currently registered rules, call the
385 <code>getRules()</code> function. It accepts an optional array of rule
386 identifiers with the same semantics as <code>removeRules</code> and a callback
387 function.
388 </p><p>
389 </p><pre>var rule_ids = ["id1", "id2", ...];
390 function getRules(rule_ids, function callback(details) {...});
391 </pre>
392 <p>
393 The <code>details</code> parameter passed to the <code>calback()</code> function
394 refers to an array of rules including filled optional parameters.
395 </p>
234 </div> 396 </div>
235 <!-- API PAGE --> 397 <!-- API PAGE -->
236 <!-- /apiPage --> 398 <div class="apiPage">
399 <a name="apiReference"></a>
400 <h2>API reference: chrome.events</h2>
401 <!-- PROPERTIES -->
402 <!-- /apiGroup -->
403 <!-- METHODS -->
404 <!-- /apiGroup -->
405 <!-- EVENTS -->
406 <!-- /apiGroup -->
407 <!-- TYPES -->
408 <div class="apiGroup">
409 <a name="types"></a>
410 <h3 id="types">Types</h3>
411 <!-- iterates over all types -->
412 <div class="apiItem">
413 <a name="type-Event"></a>
414 <h4>Event</h4>
415 <div>
416 <dt>
417 <em>
418 <!-- TYPE -->
419 <div style="display:inline">
420 (
421 <span id="typeTemplate">
422 <span>
423 <span>object</span>
424 </span>
425 </span>
426 )
427 </div>
428 </em>
429 </dt>
430 <dd>An object which allows the addition and removal of listeners for a Chrome event.</dd>
431 <!-- OBJECT PROPERTIES -->
432 <!-- OBJECT METHODS -->
433 <dd>
434 <div class="apiGroup">
435 <a name="global-Event-methods"></a>
436 <h3>Methods of Event</h3>
437 <!-- iterates over all functions -->
438 <div class="apiItem">
439 <a name="method-Event-addListener"></a> <!-- method-anchor -->
440 <h4>addListener</h4>
441 <div class="summary">
442 <!-- Note: intentionally longer 80 columns -->
443 <span>event.addListener</span>()</div>
444 <div class="description">
445 <!-- PARAMETERS -->
446 <dl>
447 </dl>
448 <!-- RETURNS -->
449 <dl>
450 </dl>
451 <!-- CALLBACK -->
452 <!-- MIN_VERSION -->
453 </div> <!-- /description -->
454 </div><div class="apiItem">
455 <a name="method-Event-addRules"></a> <!-- method-anchor -->
456 <h4>addRules</h4>
457 <div class="summary">
458 <!-- Note: intentionally longer 80 columns -->
459 <span>event.addRules</span>(<span class="null"><span>array of Rule</span>
460 <var><span>rules</span></var></span><span class="optional" ><span>, </span><span>function</span>
461 <var><span>callback</span></var></span>)</div>
462 <div class="description">
463 <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>
464 <!-- PARAMETERS -->
465 <h4>Parameters</h4>
466 <dl>
467 <div>
468 <div>
469 <dt>
470 <var>rules</var>
471 <em>
472 <!-- TYPE -->
473 <div style="display:inline">
474 (
475 <span id="typeTemplate">
476 <span>
477 <span>
478 array of <span><span>
479 <span>
480 <a href="events.html#type-Rule">Rule</a>
481 </span>
482 </span></span>
483 </span>
484 </span>
485 </span>
486 )
487 </div>
488 </em>
489 </dt>
490 <dd>Rules to be registered. These do not replace previously registered rules.</dd>
491 <!-- OBJECT PROPERTIES -->
492 <!-- OBJECT METHODS -->
493 <!-- OBJECT EVENT FIELDS -->
494 <!-- FUNCTION PARAMETERS -->
495 </div>
496 </div><div>
497 <div>
498 <dt>
499 <var>callback</var>
500 <em>
501 <!-- TYPE -->
502 <div style="display:inline">
503 (
504 <span class="optional">optional</span>
505 <span id="typeTemplate">
506 <span>
507 <span>function</span>
508 </span>
509 </span>
510 )
511 </div>
512 </em>
513 </dt>
514 <dd>Called with registered rules.</dd>
515 <!-- OBJECT PROPERTIES -->
516 <!-- OBJECT METHODS -->
517 <!-- OBJECT EVENT FIELDS -->
518 <!-- FUNCTION PARAMETERS -->
519 </div>
520 </div>
521 </dl>
522 <!-- RETURNS -->
523 <dl>
524 </dl>
525 <!-- CALLBACK -->
526 <div>
527 <div>
528 <h4>Callback function</h4>
529 <p>
530 If you specify the <em>callback</em> parameter, it should
531 specify a function that looks like this:
532 </p>
533 <!-- Note: intentionally longer 80 columns -->
534 <pre>function(<span>array of Rule rules</span>) <span class="s ubdued">{...}</span>;</pre>
535 <dl>
536 <div>
537 <div>
538 <dt>
539 <var>rules</var>
540 <em>
541 <!-- TYPE -->
542 <div style="display:inline">
543 (
544 <span id="typeTemplate">
545 <span>
546 <span>
547 array of <span><span>
548 <span>
549 <a href="events.html#type-Rule">Rule</a>
550 </span>
551 </span></span>
552 </span>
553 </span>
554 </span>
555 )
556 </div>
557 </em>
558 </dt>
559 <dd>Rules that were registered, the optional parameters are filled wit h values.</dd>
560 <!-- OBJECT PROPERTIES -->
561 <!-- OBJECT METHODS -->
562 <!-- OBJECT EVENT FIELDS -->
563 <!-- FUNCTION PARAMETERS -->
564 </div>
565 </div>
566 </dl>
567 </div>
568 </div>
569 <!-- MIN_VERSION -->
570 </div> <!-- /description -->
571 </div><div class="apiItem">
572 <a name="method-Event-getRules"></a> <!-- method-anchor -->
573 <h4>getRules</h4>
574 <div class="summary">
575 <!-- Note: intentionally longer 80 columns -->
576 <span>event.getRules</span>(<span class="optional"><span>array of string</span>
577 <var><span>ruleIdentifiers</span></var></span><span class= "null"><span>, </span><span>function</span>
578 <var><span>callback</span></var></span>)</div>
579 <div class="description">
580 <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>
581 <!-- PARAMETERS -->
582 <h4>Parameters</h4>
583 <dl>
584 <div>
585 <div>
586 <dt>
587 <var>ruleIdentifiers</var>
588 <em>
589 <!-- TYPE -->
590 <div style="display:inline">
591 (
592 <span class="optional">optional</span>
593 <span id="typeTemplate">
594 <span>
595 <span>
596 array of <span><span>
597 <span>
598 <span>string</span>
599 </span>
600 </span></span>
601 </span>
602 </span>
603 </span>
604 )
605 </div>
606 </em>
607 </dt>
608 <dd>If an array is passed, only rules with identifiers contained in th is array are returned.</dd>
609 <!-- OBJECT PROPERTIES -->
610 <!-- OBJECT METHODS -->
611 <!-- OBJECT EVENT FIELDS -->
612 <!-- FUNCTION PARAMETERS -->
613 </div>
614 </div><div>
615 <div>
616 <dt>
617 <var>callback</var>
618 <em>
619 <!-- TYPE -->
620 <div style="display:inline">
621 (
622 <span id="typeTemplate">
623 <span>
624 <span>function</span>
625 </span>
626 </span>
627 )
628 </div>
629 </em>
630 </dt>
631 <dd>Called with registered rules.</dd>
632 <!-- OBJECT PROPERTIES -->
633 <!-- OBJECT METHODS -->
634 <!-- OBJECT EVENT FIELDS -->
635 <!-- FUNCTION PARAMETERS -->
636 </div>
637 </div>
638 </dl>
639 <!-- RETURNS -->
640 <dl>
641 </dl>
642 <!-- CALLBACK -->
643 <div>
644 <div>
645 <h4>Callback function</h4>
646 <p>
647 The callback <em>parameter</em> should specify a function
648 that looks like this:
649 </p>
650 <!-- Note: intentionally longer 80 columns -->
651 <pre>function(<span>array of Rule rules</span>) <span class="s ubdued">{...}</span>;</pre>
652 <dl>
653 <div>
654 <div>
655 <dt>
656 <var>rules</var>
657 <em>
658 <!-- TYPE -->
659 <div style="display:inline">
660 (
661 <span id="typeTemplate">
662 <span>
663 <span>
664 array of <span><span>
665 <span>
666 <a href="events.html#type-Rule">Rule</a>
667 </span>
668 </span></span>
669 </span>
670 </span>
671 </span>
672 )
673 </div>
674 </em>
675 </dt>
676 <dd>Rules that were registered, the optional parameters are filled wit h values.</dd>
677 <!-- OBJECT PROPERTIES -->
678 <!-- OBJECT METHODS -->
679 <!-- OBJECT EVENT FIELDS -->
680 <!-- FUNCTION PARAMETERS -->
681 </div>
682 </div>
683 </dl>
684 </div>
685 </div>
686 <!-- MIN_VERSION -->
687 </div> <!-- /description -->
688 </div><div class="apiItem">
689 <a name="method-Event-hasListener"></a> <!-- method-anchor -->
690 <h4>hasListener</h4>
691 <div class="summary">
692 <!-- Note: intentionally longer 80 columns -->
693 <span>event.hasListener</span>()</div>
694 <div class="description">
695 <!-- PARAMETERS -->
696 <dl>
697 </dl>
698 <!-- RETURNS -->
699 <dl>
700 </dl>
701 <!-- CALLBACK -->
702 <!-- MIN_VERSION -->
703 </div> <!-- /description -->
704 </div><div class="apiItem">
705 <a name="method-Event-hasListeners"></a> <!-- method-anchor -->
706 <h4>hasListeners</h4>
707 <div class="summary">
708 <!-- Note: intentionally longer 80 columns -->
709 <span>event.hasListeners</span>()</div>
710 <div class="description">
711 <!-- PARAMETERS -->
712 <dl>
713 </dl>
714 <!-- RETURNS -->
715 <dl>
716 </dl>
717 <!-- CALLBACK -->
718 <!-- MIN_VERSION -->
719 </div> <!-- /description -->
720 </div><div class="apiItem">
721 <a name="method-Event-removeListener"></a> <!-- method-anchor -->
722 <h4>removeListener</h4>
723 <div class="summary">
724 <!-- Note: intentionally longer 80 columns -->
725 <span>event.removeListener</span>()</div>
726 <div class="description">
727 <!-- PARAMETERS -->
728 <dl>
729 </dl>
730 <!-- RETURNS -->
731 <dl>
732 </dl>
733 <!-- CALLBACK -->
734 <!-- MIN_VERSION -->
735 </div> <!-- /description -->
736 </div><div class="apiItem">
737 <a name="method-Event-removeRules"></a> <!-- method-anchor -->
738 <h4>removeRules</h4>
739 <div class="summary">
740 <!-- Note: intentionally longer 80 columns -->
741 <span>event.removeRules</span>(<span class="optional"><span>ar ray of string</span>
742 <var><span>ruleIdentifiers</span></var></span><span class= "optional"><span>, </span><span>function</span>
743 <var><span>callback</span></var></span>)</div>
744 <div class="description">
745 <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>
746 <!-- PARAMETERS -->
747 <h4>Parameters</h4>
748 <dl>
749 <div>
750 <div>
751 <dt>
752 <var>ruleIdentifiers</var>
753 <em>
754 <!-- TYPE -->
755 <div style="display:inline">
756 (
757 <span class="optional">optional</span>
758 <span id="typeTemplate">
759 <span>
760 <span>
761 array of <span><span>
762 <span>
763 <span>string</span>
764 </span>
765 </span></span>
766 </span>
767 </span>
768 </span>
769 )
770 </div>
771 </em>
772 </dt>
773 <dd>If an array is passed, only rules with identifiers contained in th is array are unregistered.</dd>
774 <!-- OBJECT PROPERTIES -->
775 <!-- OBJECT METHODS -->
776 <!-- OBJECT EVENT FIELDS -->
777 <!-- FUNCTION PARAMETERS -->
778 </div>
779 </div><div>
780 <div>
781 <dt>
782 <var>callback</var>
783 <em>
784 <!-- TYPE -->
785 <div style="display:inline">
786 (
787 <span class="optional">optional</span>
788 <span id="typeTemplate">
789 <span>
790 <span>function</span>
791 </span>
792 </span>
793 )
794 </div>
795 </em>
796 </dt>
797 <dd>Called when rules were unregistered.</dd>
798 <!-- OBJECT PROPERTIES -->
799 <!-- OBJECT METHODS -->
800 <!-- OBJECT EVENT FIELDS -->
801 <!-- FUNCTION PARAMETERS -->
802 </div>
803 </div>
804 </dl>
805 <!-- RETURNS -->
806 <dl>
807 </dl>
808 <!-- CALLBACK -->
809 <div>
810 <div>
811 <h4>Callback function</h4>
812 <p>
813 If you specify the <em>callback</em> parameter, it should
814 specify a function that looks like this:
815 </p>
816 <!-- Note: intentionally longer 80 columns -->
817 <pre>function(<span></span>) <span class="subdued">{...}</span >;</pre>
818 <dl>
819 </dl>
820 </div>
821 </div>
822 <!-- MIN_VERSION -->
823 </div> <!-- /description -->
824 </div> <!-- /apiItem -->
825 </div>
826 </dd>
827 <!-- OBJECT EVENT FIELDS -->
828 <!-- FUNCTION PARAMETERS -->
829 </div>
830 </div><div class="apiItem">
831 <a name="type-Rule"></a>
832 <h4>Rule</h4>
833 <div>
834 <dt>
835 <em>
836 <!-- TYPE -->
837 <div style="display:inline">
838 (
839 <span id="typeTemplate">
840 <span>
841 <span>object</span>
842 </span>
843 </span>
844 )
845 </div>
846 </em>
847 </dt>
848 <dd>Description of a declarative rule for handling events.</dd>
849 <!-- OBJECT PROPERTIES -->
850 <dd>
851 <dl>
852 <div>
853 <div>
854 <dt>
855 <var>id</var>
856 <em>
857 <!-- TYPE -->
858 <div style="display:inline">
859 (
860 <span class="optional">optional</span>
861 <span id="typeTemplate">
862 <span>
863 <span>string</span>
864 </span>
865 </span>
866 )
867 </div>
868 </em>
869 </dt>
870 <dd>Optional identifier that allows referencing this rule.</dd>
871 <!-- OBJECT PROPERTIES -->
872 <!-- OBJECT METHODS -->
873 <!-- OBJECT EVENT FIELDS -->
874 <!-- FUNCTION PARAMETERS -->
875 </div>
876 </div><div>
877 <div>
878 <dt>
879 <var>conditions</var>
880 <em>
881 <!-- TYPE -->
882 <div style="display:inline">
883 (
884 <span id="typeTemplate">
885 <span>
886 <span>
887 array of <span><span>
888 <span>
889 <span>any</span>
890 </span>
891 </span></span>
892 </span>
893 </span>
894 </span>
895 )
896 </div>
897 </em>
898 </dt>
899 <dd>List of conditions that can trigger the actions.</dd>
900 <!-- OBJECT PROPERTIES -->
901 <!-- OBJECT METHODS -->
902 <!-- OBJECT EVENT FIELDS -->
903 <!-- FUNCTION PARAMETERS -->
904 </div>
905 </div><div>
906 <div>
907 <dt>
908 <var>actions</var>
909 <em>
910 <!-- TYPE -->
911 <div style="display:inline">
912 (
913 <span id="typeTemplate">
914 <span>
915 <span>
916 array of <span><span>
917 <span>
918 <span>any</span>
919 </span>
920 </span></span>
921 </span>
922 </span>
923 </span>
924 )
925 </div>
926 </em>
927 </dt>
928 <dd>List of actions that are triggered if one of the condtions is fulf illed.</dd>
929 <!-- OBJECT PROPERTIES -->
930 <!-- OBJECT METHODS -->
931 <!-- OBJECT EVENT FIELDS -->
932 <!-- FUNCTION PARAMETERS -->
933 </div>
934 </div><div>
935 <div>
936 <dt>
937 <var>priority</var>
938 <em>
939 <!-- TYPE -->
940 <div style="display:inline">
941 (
942 <span class="optional">optional</span>
943 <span id="typeTemplate">
944 <span>
945 <span>integer</span>
946 </span>
947 </span>
948 )
949 </div>
950 </em>
951 </dt>
952 <dd>Optional priority of this rule. Defaults to 100.</dd>
953 <!-- OBJECT PROPERTIES -->
954 <!-- OBJECT METHODS -->
955 <!-- OBJECT EVENT FIELDS -->
956 <!-- FUNCTION PARAMETERS -->
957 </div>
958 </div>
959 </dl>
960 </dd>
961 <!-- OBJECT METHODS -->
962 <!-- OBJECT EVENT FIELDS -->
963 <!-- FUNCTION PARAMETERS -->
964 </div>
965 </div><div class="apiItem">
966 <a name="type-UrlFilter"></a>
967 <h4>UrlFilter</h4>
968 <div>
969 <dt>
970 <em>
971 <!-- TYPE -->
972 <div style="display:inline">
973 (
974 <span id="typeTemplate">
975 <span>
976 <span>object</span>
977 </span>
978 </span>
979 )
980 </div>
981 </em>
982 </dt>
983 <dd>Filters URLs for various criteria</dd>
984 <!-- OBJECT PROPERTIES -->
985 <dd>
986 <dl>
987 <div>
988 <div>
989 <dt>
990 <var>hostContains</var>
991 <em>
992 <!-- TYPE -->
993 <div style="display:inline">
994 (
995 <span class="optional">optional</span>
996 <span id="typeTemplate">
997 <span>
998 <span>string</span>
999 </span>
1000 </span>
1001 )
1002 </div>
1003 </em>
1004 </dt>
1005 <dd>Matches if the host name of the URL contains a specified string.</ dd>
1006 <!-- OBJECT PROPERTIES -->
1007 <!-- OBJECT METHODS -->
1008 <!-- OBJECT EVENT FIELDS -->
1009 <!-- FUNCTION PARAMETERS -->
1010 </div>
1011 </div><div>
1012 <div>
1013 <dt>
1014 <var>hostEquals</var>
1015 <em>
1016 <!-- TYPE -->
1017 <div style="display:inline">
1018 (
1019 <span class="optional">optional</span>
1020 <span id="typeTemplate">
1021 <span>
1022 <span>string</span>
1023 </span>
1024 </span>
1025 )
1026 </div>
1027 </em>
1028 </dt>
1029 <dd>Matches if the host name of the URL is equal to a specified string .</dd>
1030 <!-- OBJECT PROPERTIES -->
1031 <!-- OBJECT METHODS -->
1032 <!-- OBJECT EVENT FIELDS -->
1033 <!-- FUNCTION PARAMETERS -->
1034 </div>
1035 </div><div>
1036 <div>
1037 <dt>
1038 <var>hostPrefix</var>
1039 <em>
1040 <!-- TYPE -->
1041 <div style="display:inline">
1042 (
1043 <span class="optional">optional</span>
1044 <span id="typeTemplate">
1045 <span>
1046 <span>string</span>
1047 </span>
1048 </span>
1049 )
1050 </div>
1051 </em>
1052 </dt>
1053 <dd>Matches if the host name of the URL starts with a specified string .</dd>
1054 <!-- OBJECT PROPERTIES -->
1055 <!-- OBJECT METHODS -->
1056 <!-- OBJECT EVENT FIELDS -->
1057 <!-- FUNCTION PARAMETERS -->
1058 </div>
1059 </div><div>
1060 <div>
1061 <dt>
1062 <var>hostSuffix</var>
1063 <em>
1064 <!-- TYPE -->
1065 <div style="display:inline">
1066 (
1067 <span class="optional">optional</span>
1068 <span id="typeTemplate">
1069 <span>
1070 <span>string</span>
1071 </span>
1072 </span>
1073 )
1074 </div>
1075 </em>
1076 </dt>
1077 <dd>Matches if the host name of the URL ends with a specified string.< /dd>
1078 <!-- OBJECT PROPERTIES -->
1079 <!-- OBJECT METHODS -->
1080 <!-- OBJECT EVENT FIELDS -->
1081 <!-- FUNCTION PARAMETERS -->
1082 </div>
1083 </div><div>
1084 <div>
1085 <dt>
1086 <var>pathContains</var>
1087 <em>
1088 <!-- TYPE -->
1089 <div style="display:inline">
1090 (
1091 <span class="optional">optional</span>
1092 <span id="typeTemplate">
1093 <span>
1094 <span>string</span>
1095 </span>
1096 </span>
1097 )
1098 </div>
1099 </em>
1100 </dt>
1101 <dd>Matches if the path segment of the URL contains a specified string .</dd>
1102 <!-- OBJECT PROPERTIES -->
1103 <!-- OBJECT METHODS -->
1104 <!-- OBJECT EVENT FIELDS -->
1105 <!-- FUNCTION PARAMETERS -->
1106 </div>
1107 </div><div>
1108 <div>
1109 <dt>
1110 <var>pathEquals</var>
1111 <em>
1112 <!-- TYPE -->
1113 <div style="display:inline">
1114 (
1115 <span class="optional">optional</span>
1116 <span id="typeTemplate">
1117 <span>
1118 <span>string</span>
1119 </span>
1120 </span>
1121 )
1122 </div>
1123 </em>
1124 </dt>
1125 <dd>Matches if the path segment of the URL is equal to a specified str ing.</dd>
1126 <!-- OBJECT PROPERTIES -->
1127 <!-- OBJECT METHODS -->
1128 <!-- OBJECT EVENT FIELDS -->
1129 <!-- FUNCTION PARAMETERS -->
1130 </div>
1131 </div><div>
1132 <div>
1133 <dt>
1134 <var>pathPrefix</var>
1135 <em>
1136 <!-- TYPE -->
1137 <div style="display:inline">
1138 (
1139 <span class="optional">optional</span>
1140 <span id="typeTemplate">
1141 <span>
1142 <span>string</span>
1143 </span>
1144 </span>
1145 )
1146 </div>
1147 </em>
1148 </dt>
1149 <dd>Matches if the path segment of the URL starts with a specified str ing.</dd>
1150 <!-- OBJECT PROPERTIES -->
1151 <!-- OBJECT METHODS -->
1152 <!-- OBJECT EVENT FIELDS -->
1153 <!-- FUNCTION PARAMETERS -->
1154 </div>
1155 </div><div>
1156 <div>
1157 <dt>
1158 <var>pathSuffix</var>
1159 <em>
1160 <!-- TYPE -->
1161 <div style="display:inline">
1162 (
1163 <span class="optional">optional</span>
1164 <span id="typeTemplate">
1165 <span>
1166 <span>string</span>
1167 </span>
1168 </span>
1169 )
1170 </div>
1171 </em>
1172 </dt>
1173 <dd>Matches if the path segment of the URL ends with a specified strin g.</dd>
1174 <!-- OBJECT PROPERTIES -->
1175 <!-- OBJECT METHODS -->
1176 <!-- OBJECT EVENT FIELDS -->
1177 <!-- FUNCTION PARAMETERS -->
1178 </div>
1179 </div><div>
1180 <div>
1181 <dt>
1182 <var>queryEquals</var>
1183 <em>
1184 <!-- TYPE -->
1185 <div style="display:inline">
1186 (
1187 <span class="optional">optional</span>
1188 <span id="typeTemplate">
1189 <span>
1190 <span>string</span>
1191 </span>
1192 </span>
1193 )
1194 </div>
1195 </em>
1196 </dt>
1197 <dd>Matches if the query segment of the URL is equal to a specified st ring.</dd>
1198 <!-- OBJECT PROPERTIES -->
1199 <!-- OBJECT METHODS -->
1200 <!-- OBJECT EVENT FIELDS -->
1201 <!-- FUNCTION PARAMETERS -->
1202 </div>
1203 </div><div>
1204 <div>
1205 <dt>
1206 <var>queryPrefix</var>
1207 <em>
1208 <!-- TYPE -->
1209 <div style="display:inline">
1210 (
1211 <span class="optional">optional</span>
1212 <span id="typeTemplate">
1213 <span>
1214 <span>string</span>
1215 </span>
1216 </span>
1217 )
1218 </div>
1219 </em>
1220 </dt>
1221 <dd>Matches if the query segment of the URL starts with a specified st ring.</dd>
1222 <!-- OBJECT PROPERTIES -->
1223 <!-- OBJECT METHODS -->
1224 <!-- OBJECT EVENT FIELDS -->
1225 <!-- FUNCTION PARAMETERS -->
1226 </div>
1227 </div><div>
1228 <div>
1229 <dt>
1230 <var>querySuffix</var>
1231 <em>
1232 <!-- TYPE -->
1233 <div style="display:inline">
1234 (
1235 <span class="optional">optional</span>
1236 <span id="typeTemplate">
1237 <span>
1238 <span>string</span>
1239 </span>
1240 </span>
1241 )
1242 </div>
1243 </em>
1244 </dt>
1245 <dd>Matches if the query segment of the URL ends with a specified stri ng.</dd>
1246 <!-- OBJECT PROPERTIES -->
1247 <!-- OBJECT METHODS -->
1248 <!-- OBJECT EVENT FIELDS -->
1249 <!-- FUNCTION PARAMETERS -->
1250 </div>
1251 </div><div>
1252 <div>
1253 <dt>
1254 <var>urlSuffix</var>
1255 <em>
1256 <!-- TYPE -->
1257 <div style="display:inline">
1258 (
1259 <span class="optional">optional</span>
1260 <span id="typeTemplate">
1261 <span>
1262 <span>string</span>
1263 </span>
1264 </span>
1265 )
1266 </div>
1267 </em>
1268 </dt>
1269 <dd>Matches if the URL ends with a specified string.</dd>
1270 <!-- OBJECT PROPERTIES -->
1271 <!-- OBJECT METHODS -->
1272 <!-- OBJECT EVENT FIELDS -->
1273 <!-- FUNCTION PARAMETERS -->
1274 </div>
1275 </div><div>
1276 <div>
1277 <dt>
1278 <var>urlEquals</var>
1279 <em>
1280 <!-- TYPE -->
1281 <div style="display:inline">
1282 (
1283 <span class="optional">optional</span>
1284 <span id="typeTemplate">
1285 <span>
1286 <span>string</span>
1287 </span>
1288 </span>
1289 )
1290 </div>
1291 </em>
1292 </dt>
1293 <dd>Matches if the URL is equal to a specified string.</dd>
1294 <!-- OBJECT PROPERTIES -->
1295 <!-- OBJECT METHODS -->
1296 <!-- OBJECT EVENT FIELDS -->
1297 <!-- FUNCTION PARAMETERS -->
1298 </div>
1299 </div><div>
1300 <div>
1301 <dt>
1302 <var>urlPrefix</var>
1303 <em>
1304 <!-- TYPE -->
1305 <div style="display:inline">
1306 (
1307 <span class="optional">optional</span>
1308 <span id="typeTemplate">
1309 <span>
1310 <span>string</span>
1311 </span>
1312 </span>
1313 )
1314 </div>
1315 </em>
1316 </dt>
1317 <dd>Matches if the URL starts with a specified string.</dd>
1318 <!-- OBJECT PROPERTIES -->
1319 <!-- OBJECT METHODS -->
1320 <!-- OBJECT EVENT FIELDS -->
1321 <!-- FUNCTION PARAMETERS -->
1322 </div>
1323 </div><div>
1324 <div>
1325 <dt>
1326 <var>schemes</var>
1327 <em>
1328 <!-- TYPE -->
1329 <div style="display:inline">
1330 (
1331 <span class="optional">optional</span>
1332 <span id="typeTemplate">
1333 <span>
1334 <span>
1335 array of <span><span>
1336 <span>
1337 <span>string</span>
1338 </span>
1339 </span></span>
1340 </span>
1341 </span>
1342 </span>
1343 )
1344 </div>
1345 </em>
1346 </dt>
1347 <dd>Matches if the scheme of the URL is equal to any of the schemes sp ecified in the array.</dd>
1348 <!-- OBJECT PROPERTIES -->
1349 <!-- OBJECT METHODS -->
1350 <!-- OBJECT EVENT FIELDS -->
1351 <!-- FUNCTION PARAMETERS -->
1352 </div>
1353 </div><div>
1354 <div>
1355 <dt>
1356 <var>ports</var>
1357 <em>
1358 <!-- TYPE -->
1359 <div style="display:inline">
1360 (
1361 <span class="optional">optional</span>
1362 <span id="typeTemplate">
1363 <span>
1364 <span>
1365 array of <span><span>
1366 <span>
1367 <span>integer or array of integer</span>
1368 </span>
1369 </span></span>
1370 </span>
1371 </span>
1372 </span>
1373 )
1374 </div>
1375 </em>
1376 </dt>
1377 <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>
1378 <!-- OBJECT PROPERTIES -->
1379 <!-- OBJECT METHODS -->
1380 <!-- OBJECT EVENT FIELDS -->
1381 <!-- FUNCTION PARAMETERS -->
1382 </div>
1383 </div>
1384 </dl>
1385 </dd>
1386 <!-- OBJECT METHODS -->
1387 <!-- OBJECT EVENT FIELDS -->
1388 <!-- FUNCTION PARAMETERS -->
1389 </div>
1390 </div> <!-- /apiItem -->
1391 </div> <!-- /apiGroup -->
1392 </div> <!-- /apiPage -->
237 </div> <!-- /gc-pagecontent --> 1393 </div> <!-- /gc-pagecontent -->
238 </div> <!-- /g-section --> 1394 </div> <!-- /g-section -->
239 </div> <!-- /codesiteContent --> 1395 </div> <!-- /codesiteContent -->
240 <div id="gc-footer" --=""> 1396 <div id="gc-footer" --="">
241 <div class="text"> 1397 <div class="text">
242 <p> 1398 <p>
243 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>, 1399 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>,
244 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons 1400 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons
245 Attribution 3.0 License</a>, and code samples are licensed under the 1401 Attribution 3.0 License</a>, and code samples are licensed under the
246 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>. 1402 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>.
(...skipping 17 matching lines...) Expand all
264 _uff=0; 1420 _uff=0;
265 urchinTracker(); 1421 urchinTracker();
266 } 1422 }
267 catch(e) {/* urchinTracker not available. */} 1423 catch(e) {/* urchinTracker not available. */}
268 </script> 1424 </script>
269 <!-- end analytics --> 1425 <!-- end analytics -->
270 </div> 1426 </div>
271 </div> <!-- /gc-footer --> 1427 </div> <!-- /gc-footer -->
272 </div> <!-- /gc-container --> 1428 </div> <!-- /gc-container -->
273 </body></html> 1429 </body></html>
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/declarativeWebRequest.html ('k') | chrome/common/extensions/docs/extension.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698