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

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

Issue 398005: Changes to follow the codesite L&F.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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="js/api_page_generator.js"></script> 16 <script type="text/javascript" src="js/api_page_generator.js"></script>
17 <script type="text/javascript" src="js/bootstrap.js"></script> 17 <script type="text/javascript" src="js/bootstrap.js"></script>
18 <title>Message Passing</title></head><body> <div id="container"> 18 <title>Message Passing</title></head><body> <div id="gc-container" class="lab s">
19 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION --> 19 <!-- SUBTEMPLATES: DO NOT MOVE FROM THIS LOCATION -->
20 <!-- In particular, sub-templates that recurse, must be used by allowing 20 <!-- In particular, sub-templates that recurse, must be used by allowing
21 jstemplate to make a copy of the template in this section which 21 jstemplate to make a copy of the template in this section which
22 are not operated on by way of the jsskip="true" --> 22 are not operated on by way of the jsskip="true" -->
23 <div style="display:none"> 23 <div style="display:none">
24 24
25 <!-- VALUE --> 25 <!-- VALUE -->
26 <div id="valueTemplate"> 26 <div id="valueTemplate">
27 <dt> 27 <dt>
28 <var>paramName</var> 28 <var>paramName</var>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 <div> 61 <div>
62 <div> 62 <div>
63 </div> 63 </div>
64 </div> 64 </div>
65 </dl> 65 </dl>
66 </dd> 66 </dd>
67 </div> <!-- /VALUE --> 67 </div> <!-- /VALUE -->
68 68
69 </div> <!-- /SUBTEMPLATES --> 69 </div> <!-- /SUBTEMPLATES -->
70 70
71 <a name="top"> </a> 71 <a id="top"></a>
72 <div id="skipto">
73 <a href="#gc-pagecontent">Skip to page content</a>
74 <a href="#gc-toc">Skip to main navigation</a>
75 </div>
72 <!-- API HEADER --> 76 <!-- API HEADER -->
73 <div id="pageHeader"> 77 <div id="gc-header">
74 <div id="searchbox"> 78 <div id="logo">
75 <form action="http://www.google.com/cse" id="cse-search-box"> 79
76 <div> 80
81 <img src="images/code_labs_logo.gif" height="43" width="161" alt="Googl e Code Labs" style="border:0;">
82
83
84 </div>
85 <div id="search">
86 <div id="searchForm" class="searchForm">
87 <form action="http://www.google.com/cse" id="cse">
88 <div id="gsc-search-box">
77 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfq tno"> 89 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfq tno">
78 <input type="hidden" name="ie" value="UTF-8"> 90 <input type="hidden" name="ie" value="UTF-8">
79 <input type="text" name="q" size="31"> 91 <input type="text" name="q" size="31">
80 <input type="submit" name="sa" value="Search"> 92 <input class="gsc-search-button" type="submit" name="sa" value="Sear ch">
81 </div> 93 </div>
82 </form> 94 </form>
95 <p>&nbsp;</p>
96 </div> <!-- end searchForm -->
83 97
84 <script type="text/javascript" src="http://www.google.com/jsapi"></scrip t> 98 <script type="text/javascript" src="http://www.google.com/jsapi"></scrip t>
85 <script type="text/javascript">google.load("elements", "1", {packages: " transliteration"});</script> 99 <script type="text/javascript">google.load("elements", "1", {packages: " transliteration"});</script>
86 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n? form=cse-search-box&amp;t13n_langs=en"></script> 100 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n? form=cse&amp;t13n_langs=en"></script>
87 <script type="text/javascript" src="http://www.google.com/coop/cse/brand ?form=cse-search-box&amp;lang=en"></script> 101 <script type="text/javascript" src="http://www.google.com/coop/cse/brand ?form=cse&amp;lang=en"></script>
88 </div> 102 </div> <!-- end search -->
89 <div id="pageTitle"> 103 </div> <!-- end gc-header -->
90 <h1>Message Passing</h1>
91 </div>
92 </div> <!-- /pageHeader -->
93 104
94 <div id="pageContent"> 105 <div id="codesiteContent">
106
107 <a id="gc-topnav-anchor"></a>
108 <div id="gc-topnav">
109 <h1>Google Chrome Extensions (<a href="/labs/">Labs</a>)</h1>
110 <ul id="home" class="gc-topnav-tabs">
111 <li id="home_link">
112 <a href="index.html" class="selected" title="Google Chrome Extension s documentation home page">Home</a>
113 </li>
114 <li id="blog_link">
115 <a href="http://blog.chromium.org/" title="Chromium blog">Blog</a>
116 </li>
117 <li id="faq_link">
118 <a href="faq.html" title="Google Chrome Extensions FAQ">FAQ</a>
119 </li>
120 <li id="group_link">
121 <a href="http://groups.google.com/group/chromium-extensions" title=" Chromium-Extensions group">Group</a>
122 </li>
123 <li id="terms_link">
124 Terms
125 </li>
126 </ul>
127 </div> <!-- end gc-topnav -->
128
129 <div class="g-section g-tpl-170">
95 <!-- SIDENAV --> 130 <!-- SIDENAV -->
96 <div id="leftNav"> 131 <div class="g-unit g-first" id="gc-toc">
97 <ul> 132 <ul>
98 <li> <a href="index.html">Home</a></li> 133 <li><a href="index.html">Home</a></li>
99 <li> <a href="getstarted.html">Getting Started</a></li> 134 <li><a href="getstarted.html">Getting Started</a></li>
100 <li> <a href="overview.html">Overview</a></li> 135 <li><a href="overview.html">Overview</a></li>
101 <li> <a href="devguide.html"><div>Developer's Guide</div></a> 136 <li><h2><a href="devguide.html">Developer's Guide</a></h2>
102 <ul> 137 <ul>
103 <li> Browser UI 138 <li>Browser UI
104 <ul> 139 <ul>
105 <li><a href="browserAction.html">Browser Actions</a></li> 140 <li><a href="browserAction.html">Browser Actions</a></li>
106 <li><a href="options.html">Options Pages</a></li> 141 <li><a href="options.html">Options Pages</a></li>
107 <li><a href="override.html">Override Pages</a></li> 142 <li><a href="override.html">Override Pages</a></li>
108 <li><a href="pageAction.html">Page Actions</a></li> 143 <li><a href="pageAction.html">Page Actions</a></li>
109 <li><a href="themes.html">Themes</a></li> 144 <li><a href="themes.html">Themes</a></li>
110 </ul> 145 </ul>
111 </li> 146 </li>
112 <li> Browser Interaction 147 <li>Browser Interaction
113 <ul> 148 <ul>
114 <li><a href="bookmarks.html">Bookmarks</a></li> 149 <li><a href="bookmarks.html">Bookmarks</a></li>
115 <li><a href="events.html">Events</a></li> 150 <li><a href="events.html">Events</a></li>
116 <li><a href="tabs.html">Tabs</a></li> 151 <li><a href="tabs.html">Tabs</a></li>
117 <li><a href="windows.html">Windows</a></li> 152 <li><a href="windows.html">Windows</a></li>
118 </ul> 153 </ul>
119 </li> 154 </li>
120 <li> Implementation 155 <li>Implementation
121 <ul> 156 <ul>
122 <li><a href="background_pages.html">Background Pages</a></li> 157 <li><a href="background_pages.html">Background Pages</a></li>
123 <li><a href="content_scripts.html">Content Scripts</a></li> 158 <li><a href="content_scripts.html">Content Scripts</a></li>
124 <li><a href="xhr.html">Cross-Origin XHR</a></li> 159 <li><a href="xhr.html">Cross-Origin XHR</a></li>
125 <li class="leftNavSelected">Message Passing</li> 160 <li class="leftNavSelected">Message Passing</li>
126 <li><a href="npapi.html">NPAPI Plugins</a></li> 161 <li><a href="npapi.html">NPAPI Plugins</a></li>
127 </ul> 162 </ul>
128 </li> 163 </li>
129 <li> Finishing 164 <li>Finishing
130 <ul> 165 <ul>
131 <li><a href="autoupdate.html">Autoupdating</a></li> 166 <li><a href="autoupdate.html">Autoupdating</a></li>
132 <li><a href="packaging.html">Packaging</a></li> 167 <li><a href="packaging.html">Packaging</a></li>
133 </ul> 168 </ul>
134 </li> 169 </li>
135 </ul> 170 </ul>
136 </li> 171 </li>
137 <li><a href="tutorials.html"><div>Tutorials</div></a> 172 <li><h2><a href="tutorials.html">Tutorials</a></h2>
138 <ul> 173 <ul>
139 <li><a href="tut_debugging.html">Debugging</a></li> 174 <li><a href="tut_debugging.html">Debugging</a></li>
140 </ul> 175 </ul>
141 </li> 176 </li>
142 <li>Reference 177 <li><h2>Reference</h2>
143 <ul> 178 <ul>
144 <li> Formats 179 <li>Formats
145 <ul> 180 <ul>
146 <li><a href="manifest.html">Manifest Files</a></li> 181 <li><a href="manifest.html">Manifest Files</a></li>
147 <li><a href="match_patterns.html">Match Patterns</a></li> 182 <li><a href="match_patterns.html">Match Patterns</a></li>
148 <!-- <li>Packages (.crx)</li> --> 183 <!-- <li>Packages (.crx)</li> -->
149 </ul> 184 </ul>
150 </li> 185 </li>
151 <li> <a href="api_index.html">chrome.* APIs</a> </li> 186 <li><a href="api_index.html">chrome.* APIs</a></li>
152 <li> <a href="api_other.html">Other APIs</a> </li> 187 <li><a href="api_other.html">Other APIs</a></li>
153 </ul> 188 </ul>
154 </li> 189 </li>
155 <li><a href="samples.html">Samples</a></li> 190 <li><h2><a href="samples.html">Samples</a></h2></li>
156 </ul> 191 </ul>
157 </div> 192 </div>
158 193
159 <div id="mainColumn"> 194 <div class="g-unit" id="gc-pagecontent">
195 <div id="pageTitle">
196 <h1 class="page_title">Message Passing</h1>
197 </div>
160 <!-- TABLE OF CONTENTS --> 198 <!-- TABLE OF CONTENTS -->
161 <div id="toc"> 199 <div id="toc">
162 <p>Contents</p> 200 <h2>Contents</h2>
163 <ol> 201 <ol>
164 <li> 202 <li>
165 <a href="#simple">Simple one-time requests</a> 203 <a href="#simple">Simple one-time requests</a>
166 <ol> 204 <ol>
167 <li style="display: none; "> 205 <li style="display: none; ">
168 <a>h3Name</a> 206 <a>h3Name</a>
169 </li> 207 </li>
170 </ol> 208 </ol>
171 </li><li> 209 </li><li>
172 <a href="#connect">Long-lived connections</a> 210 <a href="#connect">Long-lived connections</a>
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 else 341 else
304 sendResponse({}); // snub them. 342 sendResponse({}); // snub them.
305 }); 343 });
306 </pre> 344 </pre>
307 345
308 346
309 <h2 id="connect">Long-lived connections</h2> 347 <h2 id="connect">Long-lived connections</h2>
310 <p> 348 <p>
311 Sometimes it's useful to have a conversation that lasts longer than a single 349 Sometimes it's useful to have a conversation that lasts longer than a single
312 request and response. In this case, you can open a long-lived channel from 350 request and response. In this case, you can open a long-lived channel from
313 your content script to an extension page, or vice versa, using 351 your content script to an extension page, or vice versa, using
314 <a href="extension.html#method-connect">chrome.extension.connect()</a> 352 <a href="extension.html#method-connect">chrome.extension.connect()</a>
315 or 353 or
316 <a href="tabs.html#method-connect">chrome.tabs.connect()</a> respectively. The 354 <a href="tabs.html#method-connect">chrome.tabs.connect()</a> respectively. The
317 channel can optionally have a name, allowing you to distinguish between 355 channel can optionally have a name, allowing you to distinguish between
318 different types of connections. 356 different types of connections.
319 357
320 </p><p> 358 </p><p>
321 One use case might be an automatic form fill extension. The content script 359 One use case might be an automatic form fill extension. The content script
322 could open a channel to the extension page for a particular login, and send a 360 could open a channel to the extension page for a particular login, and send a
323 message to the extension for each input element on the page to request the 361 message to the extension for each input element on the page to request the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 port.postMessage({question: "I don't get it."}); 410 port.postMessage({question: "I don't get it."});
373 }); 411 });
374 }); 412 });
375 </pre> 413 </pre>
376 414
377 <p> 415 <p>
378 You may want to find out when a connection is closed, for example if you are 416 You may want to find out when a connection is closed, for example if you are
379 maintaining separate state for each open port. For this you can listen to the 417 maintaining separate state for each open port. For this you can listen to the
380 <a href="extension.html#type-Port">Port.onDisconnect</a> 418 <a href="extension.html#type-Port">Port.onDisconnect</a>
381 event. This event is fired either when the other side of the channel manually 419 event. This event is fired either when the other side of the channel manually
382 calls 420 calls
383 <a href="extension.html#type-Port">Port.disconnect()</a>, or when the page 421 <a href="extension.html#type-Port">Port.disconnect()</a>, or when the page
384 containing the port is unloaded (for example if the tab is navigated). 422 containing the port is unloaded (for example if the tab is navigated).
385 onDisconnect is guaranteed to be fired only once for any given port. 423 onDisconnect is guaranteed to be fired only once for any given port.
386 424
387 425
388 </p><h2 id="external">Cross-extension messaging</h2> 426 </p><h2 id="external">Cross-extension messaging</h2>
389 <p> 427 <p>
390 In addition to sending messages between different components in your 428 In addition to sending messages between different components in your
391 extension, you can use the messaging API to communicate with other extensions. 429 extension, you can use the messaging API to communicate with other extensions.
392 This lets you expose a public API that other extensions can take advantage of. 430 This lets you expose a public API that other extensions can take advantage of.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 <h4>type name</h4> 612 <h4>type name</h4>
575 613
576 <div> 614 <div>
577 </div> 615 </div>
578 616
579 </div> <!-- /apiItem --> 617 </div> <!-- /apiItem -->
580 618
581 </div> <!-- /apiGroup --> 619 </div> <!-- /apiGroup -->
582 620
583 </div> <!-- /apiPage --> 621 </div> <!-- /apiPage -->
584 </div> <!-- /mainColumn --> 622 </div> <!-- /gc-pagecontent -->
585 </div> <!-- /pageContent --> 623 </div> <!-- /g-section -->
586 <div id="pageFooter" --=""> 624 </div> <!-- /codesiteContent -->
625 <div id="gc-footer" --="">
626 <div class="text">
587 <p> 627 <p>
588 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>, 628 Except as otherwise <a href="http://code.google.com/policies.html#restrictions ">noted</a>,
589 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons 629 the content of this page is licensed under the <a rel="license" href="http://c reativecommons.org/licenses/by/3.0/">Creative Commons
590 Attribution 3.0 License</a>, and code samples are licensed under the 630 Attribution 3.0 License</a>, and code samples are licensed under the
591 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>. 631 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic ense</a>.
592 </p> 632 </p>
593 <p> 633 <p>
594 ©2009 Google 634 ©2009 Google
595 </p> 635 </p>
596 636
(...skipping 11 matching lines...) Expand all
608 // code.google.com site-wide tracking 648 // code.google.com site-wide tracking
609 try { 649 try {
610 _uacct="UA-18071-1"; 650 _uacct="UA-18071-1";
611 _uanchor=1; 651 _uanchor=1;
612 _uff=0; 652 _uff=0;
613 urchinTracker(); 653 urchinTracker();
614 } 654 }
615 catch(e) {/* urchinTracker not available. */} 655 catch(e) {/* urchinTracker not available. */}
616 </script> 656 </script>
617 <!-- end analytics --> 657 <!-- end analytics -->
618 658 </div>
619 </div> <!-- /pageFooter --> 659 </div> <!-- /gc-footer -->
620 </div> <!-- /container --> 660 </div> <!-- /gc-container -->
621 </body></html> 661 </body></html>
622 662
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/match_patterns.html ('k') | chrome/common/extensions/docs/npapi.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698