diff options
Diffstat (limited to 'chrome/common')
-rwxr-xr-x | chrome/common/extensions/api/extension_api.json | 27 | ||||
-rw-r--r-- | chrome/common/extensions/docs/extension.html | 151 |
2 files changed, 157 insertions, 21 deletions
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 86e42d6..849ddbe6 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -3,6 +3,15 @@ "namespace": "extension", "types": [ { + "id": "MessageSender", + "type": "object", + "description": "An object containing information about the script context that sent a message or request.", + "properties": { + "tab": {"$ref": "Tab", "optional": true, "description":"This property will <b>only</b> be present when the connection was opened from a tab or content script."}, + "id": {"type": "string", "description": "The extension ID of the extension that opened the connection."} + } + }, + { "id": "Port", "type": "object", "description": "An object which allows two way communication with other pages.", @@ -12,13 +21,9 @@ "onMessage": {"type": "object"}, "postMessage": {"type": "function"}, "sender": { - "type": "object", + "$ref": "MessageSender", "optional": true, - "description": "This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.", - "properties": { - "tab": {"$ref": "Tab", "optional": true, "description":"This property will <b>only</b> be present when the connection was opened from a tab or content script."}, - "id": {"type": "string", "description": "The extension ID of the extension that opened the connection."} - } + "description": "This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners." } } } @@ -153,8 +158,9 @@ "type": "function", "description": "Fired when a request is sent from either an extension process or a content script.", "parameters": [ - { "type": "any", "name": "request" }, - { "type": "function", "name": "sendResponse", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." } + {"name": "request", "type": "any", "description": "The request sent by the calling script."}, + {"name": "sender", "$ref": "MessageSender" }, + {"name": "sendResponse", "type": "function", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." } ] }, { @@ -162,8 +168,9 @@ "type": "function", "description": "Fired when a request is sent from another extension.", "parameters": [ - { "type": "any", "name": "request" }, - { "type": "function", "name": "sendResponse", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." } + {"name": "request", "type": "any", "description": "The request sent by the calling script."}, + {"name": "sender", "$ref": "MessageSender" }, + {"name": "sendResponse", "type": "function", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." } ] } ] diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html index 3b55e9a..9c42063 100644 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -217,8 +217,10 @@ <li> <a href="#types">Types</a> <ol> - <li jsinstance="*0"> + <li jsinstance="0"> <a href="#type-Port">Port</a> + </li><li jsinstance="*1"> + <a href="#type-MessageSender">MessageSender</a> </li> </ol> </li> @@ -1511,7 +1513,7 @@ For details, see <div class="summary"> <!-- Note: intentionally longer 80 columns --> - <span class="subdued">chrome.extension.</span><span>onRequest</span><span class="subdued">.addListener</span>(function(<span>any request, function sendResponse</span>) <span class="subdued">{...}</span>); + <span class="subdued">chrome.extension.</span><span>onRequest</span><span class="subdued">.addListener</span>(function(<span>any request, MessageSender sender, function sendResponse</span>) <span class="subdued">{...}</span>); </div> <div class="description"> @@ -1547,6 +1549,47 @@ For details, see </em> </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The request sent by the calling script.</dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + </div> + </div><div jsinstance="1"> + <div> + <dt> + <var>sender</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span id="typeTemplate"> + <span> + <a href="extension.html#type-MessageSender">MessageSender</a> + </span> + <span style="display: none; "> + <span> + array of <span><span></span></span> + </span> + <span>paramType</span> + </span> + </span> + ) + </div> + + </em> + </dt> <dd class="todo"> Undocumented. </dd> @@ -1564,7 +1607,7 @@ For details, see </dl> </dd> </div> - </div><div jsinstance="*1"> + </div><div jsinstance="*2"> <div> <dt> <var>sendResponse</var> @@ -1616,7 +1659,7 @@ For details, see <div class="summary"> <!-- Note: intentionally longer 80 columns --> - <span class="subdued">chrome.extension.</span><span>onRequestExternal</span><span class="subdued">.addListener</span>(function(<span>any request, function sendResponse</span>) <span class="subdued">{...}</span>); + <span class="subdued">chrome.extension.</span><span>onRequestExternal</span><span class="subdued">.addListener</span>(function(<span>any request, MessageSender sender, function sendResponse</span>) <span class="subdued">{...}</span>); </div> <div class="description"> @@ -1652,6 +1695,47 @@ For details, see </em> </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The request sent by the calling script.</dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + </div> + </div><div jsinstance="1"> + <div> + <dt> + <var>sender</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span id="typeTemplate"> + <span> + <a href="extension.html#type-MessageSender">MessageSender</a> + </span> + <span style="display: none; "> + <span> + array of <span><span></span></span> + </span> + <span>paramType</span> + </span> + </span> + ) + </div> + + </em> + </dt> <dd class="todo"> Undocumented. </dd> @@ -1669,7 +1753,7 @@ For details, see </dl> </dd> </div> - </div><div jsinstance="*1"> + </div><div jsinstance="*2"> <div> <dt> <var>sendResponse</var> @@ -1725,7 +1809,7 @@ For details, see <h3 id="types">Types</h3> <!-- iterates over all types --> - <div class="apiItem" jsinstance="*0"> + <div class="apiItem" jsinstance="0"> <a name="type-Port"></a> <h4>Port</h4> @@ -1945,6 +2029,55 @@ For details, see ( <span class="optional">optional</span> <span id="typeTemplate"> + <span> + <a href="extension.html#type-MessageSender">MessageSender</a> + </span> + <span style="display: none; "> + <span> + array of <span><span></span></span> + </span> + <span>paramType</span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.</dd> + + <!-- OBJECT PROPERTIES --> + <dd style="display: none; "> + <dl> + <div> + <div> + </div> + </div> + </dl> + </dd> + </div> + </div> + </dl> + </dd> + </div> + + </div><div class="apiItem" jsinstance="*1"> + <a name="type-MessageSender"></a> + <h4>MessageSender</h4> + + <div> + <dt> + <var style="display: none; ">paramName</var> + <em> + + <!-- TYPE --> + <div style="display:inline"> + ( + <span class="optional" style="display: none; ">optional</span> + <span id="typeTemplate"> <span style="display: none; "> <a> Type</a> </span> @@ -1963,7 +2096,7 @@ For details, see <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.</dd> + <dd>An object containing information about the script context that sent a message or request.</dd> <!-- OBJECT PROPERTIES --> <dd> @@ -2054,10 +2187,6 @@ For details, see </dl> </dd> </div> - </div> - </dl> - </dd> - </div> </div> <!-- /apiItem --> |