From e0bccbae8ef62584a91407e2eebc3cecdddced2a Mon Sep 17 00:00:00 2001 From: "asargent@chromium.org" Date: Thu, 17 Sep 2009 22:41:43 +0000 Subject: Two extensions doc cleanups. -Note presence of tab property on message ports in background pages and toolstrips -Fix pageActions listener callback reference BUG=none TEST=none Review URL: http://codereview.chromium.org/208003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26517 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/extensions/api/extension_api.json | 3 +- chrome/common/extensions/docs/extension.html | 43 +++++++++++++++++++++- chrome/common/extensions/docs/pageActions.html | 19 +++++----- .../common/extensions/docs/static/pageActions.html | 19 +++++----- 4 files changed, 64 insertions(+), 20 deletions(-) diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 76fee6a..558b22f 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -10,7 +10,8 @@ "name": {"type": "string"}, "onDisconnect": {"type": "object"}, "onMessage": {"type": "object"}, - "postMessage": {"type": "function"} + "postMessage": {"type": "function"}, + "tab": {"$ref": "Tab", "optional": true, "description":"This property will only be present on ports passed to onConnect listeners when the connection was opened from a tab or content script."} } } ], diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html index a8025d1..41dfc60 100755 --- a/chrome/common/extensions/docs/extension.html +++ b/chrome/common/extensions/docs/extension.html @@ -1369,7 +1369,7 @@ For details, see -
+
postMessage @@ -1412,6 +1412,47 @@ For details, see
+
+
+
+ tab + + + +
+ ( + optional + + + Tab + + + + array of + + paramType + + + ) +
+ +
+
+ +
This property will only be present on ports passed to onConnect listeners when the connection was opened from a tab or content script.
+ + +
+
+
+
+
+
+
+
+
diff --git a/chrome/common/extensions/docs/pageActions.html b/chrome/common/extensions/docs/pageActions.html index aff591c..c189d45 100755 --- a/chrome/common/extensions/docs/pageActions.html +++ b/chrome/common/extensions/docs/pageActions.html @@ -237,24 +237,25 @@ the RSS feed for the current page.

Page action events are created dynamically using the id of the page action declared in the manifest. For example, a page action with id 'foo' will setup an event called chrome.pageActions["foo"]. An extension would then register listeners like so:

-
chrome.pageActions["foo"].addListener(function(object reply) {
-  console.log(reply.pageActionId);  // Display the id of the page action.
-  console.log(reply.data.tabId);    // Display the id of the tab for which the page action event applies.
-  console.log(reply.data.tabUrl);   // Display the URL of the page for which the page action event applies.
+
chrome.pageActions["foo"].addListener(function(pageActionId, info) {
+  console.log(pageActionId);  // Display the id of the page action.
+  console.log(info.tabId);    // Display the id of the tab for which the page action event applies.
+  console.log(info.tabUrl);   // Display the URL of the page for which the page action event applies.
+  console.log(info.button);   // Display the number of the button which the user clicked with.
 });

Parameters

-

reply ( object )
-   An object containing the information about the event. Contains the following properties:

-

pageActionId ( string )
+

pageActionId ( string )
   The id of the page action that triggered the event.

-

data ( object )
-   An object specifying what tab and which page the event applies to. Contains the following properties:

+

info ( object )
+   An object containing information about the event and what tab and page the event applies to. Contains the following properties:

tabId ( string )
   The id of the tab that was active when the event was triggered.

tabUrl ( string )
   The url of the page for which the page action applies to.

+

button ( integer )
+   The mouse button which was pressed. The left button is 1, middle button is 2, and right button is 3.

diff --git a/chrome/common/extensions/docs/static/pageActions.html b/chrome/common/extensions/docs/static/pageActions.html index b63a49c..1902738 100755 --- a/chrome/common/extensions/docs/static/pageActions.html +++ b/chrome/common/extensions/docs/static/pageActions.html @@ -34,22 +34,23 @@ the RSS feed for the current page.

Page action events are created dynamically using the id of the page action declared in the manifest. For example, a page action with id 'foo' will setup an event called chrome.pageActions["foo"]. An extension would then register listeners like so:

-
chrome.pageActions["foo"].addListener(function(object reply) {
-  console.log(reply.pageActionId);  // Display the id of the page action.
-  console.log(reply.data.tabId);    // Display the id of the tab for which the page action event applies.
-  console.log(reply.data.tabUrl);   // Display the URL of the page for which the page action event applies.
+
chrome.pageActions["foo"].addListener(function(pageActionId, info) {
+  console.log(pageActionId);  // Display the id of the page action.
+  console.log(info.tabId);    // Display the id of the tab for which the page action event applies.
+  console.log(info.tabUrl);   // Display the URL of the page for which the page action event applies.
+  console.log(info.button);   // Display the number of the button which the user clicked with.
 });

Parameters

-

reply ( object )
-   An object containing the information about the event. Contains the following properties:

-

pageActionId ( string )
+

pageActionId ( string )
   The id of the page action that triggered the event.

-

data ( object )
-   An object specifying what tab and which page the event applies to. Contains the following properties:

+

info ( object )
+   An object containing information about the event and what tab and page the event applies to. Contains the following properties:

tabId ( string )
   The id of the tab that was active when the event was triggered.

tabUrl ( string )
   The url of the page for which the page action applies to.

+

button ( integer )
+   The mouse button which was pressed. The left button is 1, middle button is 2, and right button is 3.

-- cgit v1.1