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

Unified Diff: chrome/common/extensions/docs/tabs.html

Issue 9965005: Deprecate chrome.extension.sendRequest in favor of sendMessage, with a safer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | chrome/renderer/resources/extensions/event.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/tabs.html
diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html
index dfab0959260a8b0c3a9aa81d6929c68a3cb17d90..3c4f7f8d2b97e86195e05eff7b08877b8283720d 100644
--- a/chrome/common/extensions/docs/tabs.html
+++ b/chrome/common/extensions/docs/tabs.html
@@ -233,6 +233,8 @@
</li><li>
<a href="#method-remove">remove</a>
</li><li>
+ <a href="#method-sendMessage">sendMessage</a>
+ </li><li>
<a href="#method-sendRequest">sendRequest</a>
</li><li>
<a href="#method-update">update</a>
@@ -2525,6 +2527,172 @@ For other examples and for help in viewing the source code, see
<!-- MIN_VERSION -->
</div> <!-- /description -->
</div><div class="apiItem">
+ <a name="method-sendMessage"></a> <!-- method-anchor -->
+ <h4>sendMessage</h4>
+ <div class="summary">
+ <!-- Note: intentionally longer 80 columns -->
+ <span>chrome.tabs.sendMessage</span>(<span class="null"><span>integer</span>
+ <var><span>tabId</span></var></span><span class="null"><span>, </span><span>any</span>
+ <var><span>message</span></var></span><span class="optional"><span>, </span><span>function</span>
+ <var><span>responseCallback</span></var></span>)</div>
+ <div class="description">
+ <p>Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The <a href="extension.html#event-onMessage">chrome.extension.onMessage</a> event is fired in each content script running in the specified tab for the current extension.</p>
+ <!-- PARAMETERS -->
+ <h4>Parameters</h4>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>tabId</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <span>
+ <span>integer</span>
+ </span>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>message</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <span>
+ <span>any</span>
+ </span>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>responseCallback</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional">optional</span>
+ <span id="typeTemplate">
+ <span>
+ <span>function</span>
+ </span>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd class="todo">
+ Undocumented.
+ </dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ <dd>
+ <div>
+ <h5>Parameters</h5>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>response</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <span>
+ <span>any</span>
+ </span>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href="extension.html#property-lastError">chrome.extension.lastError</a> will be set to the error message.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div>
+ </dl>
+ </div>
+ </dd>
+ </div>
+ </div>
+ </dl>
+ <!-- RETURNS -->
+ <dl>
+ </dl>
+ <!-- CALLBACK -->
+ <div>
+ <div>
+ <h4>Callback function</h4>
+ <p>
+ If you specify the <em>callback</em> parameter, it should
+ specify a function that looks like this:
+ </p>
+ <!-- Note: intentionally longer 80 columns -->
+ <pre>function(<span>any response</span>) <span class="subdued">{...}</span>;</pre>
+ <dl>
+ <div>
+ <div>
+ <dt>
+ <var>response</var>
+ <em>
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span id="typeTemplate">
+ <span>
+ <span>any</span>
+ </span>
+ </span>
+ )
+ </div>
+ </em>
+ </dt>
+ <dd>The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and <a href="extension.html#property-lastError">chrome.extension.lastError</a> will be set to the error message.</dd>
+ <!-- OBJECT PROPERTIES -->
+ <!-- OBJECT METHODS -->
+ <!-- OBJECT EVENT FIELDS -->
+ <!-- FUNCTION PARAMETERS -->
+ </div>
+ </div>
+ </dl>
+ </div>
+ </div>
+ <!-- MIN_VERSION -->
+ </div> <!-- /description -->
+ </div><div class="apiItem">
<a name="method-sendRequest"></a> <!-- method-anchor -->
<h4>sendRequest</h4>
<div class="summary">
@@ -2534,7 +2702,7 @@ For other examples and for help in viewing the source code, see
<var><span>request</span></var></span><span class="optional"><span>, </span><span>function</span>
<var><span>responseCallback</span></var></span>)</div>
<div class="description">
- <p>Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The <a href="extension.html#event-onRequest">chrome.extension.onRequest</a> event is fired in each content script running in the specified tab for the current extension.</p>
+ <p>Deprecated: Please use sendMessage.</p>
<!-- PARAMETERS -->
<h4>Parameters</h4>
<dl>
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | chrome/renderer/resources/extensions/event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698