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

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

Issue 6574031: Merge 75894 - Fix typo in Message Passing sample code.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/648/src/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/messaging.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 Here is how you open a channel from a content script, and send and listen for 443 Here is how you open a channel from a content script, and send and listen for
444 messages: 444 messages:
445 </p><pre>contentscript.js 445 </p><pre>contentscript.js
446 ================ 446 ================
447 var port = chrome.extension.connect({name: "knockknock"}); 447 var port = chrome.extension.connect({name: "knockknock"});
448 port.postMessage({joke: "Knock knock"}); 448 port.postMessage({joke: "Knock knock"});
449 port.onMessage.addListener(function(msg) { 449 port.onMessage.addListener(function(msg) {
450 if (msg.question == "Who's there?") 450 if (msg.question == "Who's there?")
451 port.postMessage({answer: "Madame"}); 451 port.postMessage({answer: "Madame"});
452 else if (msg.question == "Madame who?") 452 else if (msg.question == "Madame who?")
453 port.postMessage({answer: "Madame... Bovary"); 453 port.postMessage({answer: "Madame... Bovary"});
454 }); 454 });
455 </pre> 455 </pre>
456 456
457 <p> 457 <p>
458 Sending a request from the extension to a content script looks very similar, 458 Sending a request from the extension to a content script looks very similar,
459 except that you need to specify which tab to connect to. Simply replace the 459 except that you need to specify which tab to connect to. Simply replace the
460 call to connect in the above example with 460 call to connect in the above example with
461 <a href="tabs.html#method-connect">chrome.tabs.connect(tabId, {name: 461 <a href="tabs.html#method-connect">chrome.tabs.connect(tabId, {name:
462 "knockknock"})</a>. 462 "knockknock"})</a>.
463 463
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 _uff=0; 789 _uff=0;
790 urchinTracker(); 790 urchinTracker();
791 } 791 }
792 catch(e) {/* urchinTracker not available. */} 792 catch(e) {/* urchinTracker not available. */}
793 </script> 793 </script>
794 <!-- end analytics --> 794 <!-- end analytics -->
795 </div> 795 </div>
796 </div> <!-- /gc-footer --> 796 </div> <!-- /gc-footer -->
797 </div> <!-- /gc-container --> 797 </div> <!-- /gc-container -->
798 </body></html> 798 </body></html>
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/static/messaging.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698