diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:27:01 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 23:27:01 +0000 |
commit | 11a4b1bd05f3d419a2164ecbe0e2ec12726f523b (patch) | |
tree | 3f3ba4dc644dc42ccaa4c959b1276f30c404ceb7 /chrome/test | |
parent | 81a7e67a0dbb0133f5c016d3eb04ed1116ba6717 (diff) | |
download | chromium_src-11a4b1bd05f3d419a2164ecbe0e2ec12726f523b.zip chromium_src-11a4b1bd05f3d419a2164ecbe0e2ec12726f523b.tar.gz chromium_src-11a4b1bd05f3d419a2164ecbe0e2ec12726f523b.tar.bz2 |
Extension Installed InfoBubble
This creates UI feedback upon successful installation of an extension. An InfoBubble is shown containing the install icon and some information about how to manage extensions.
TEST=Install a packaged extension. Verify the InfoBubble is shown, with the install icon and some description. The InfoBubble should disappear when the bubble looses focus (click elsewhere). For a browserAction, the bubble should point to the browserAction icon. For a pageAction **that has a "default_icon" set in it's manifest (see the samples/subscribe_page_action in this CL)**, it should point to a temporarily shown pageAction icon that will be hidden when the bubble closes. Otherwise it should point to the wrench menu.
BUG=21412
Review URL: http://codereview.chromium.org/362022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/data/extensions/samples/subscribe_page_action/background.html | 47 | ||||
-rw-r--r-- | chrome/test/data/extensions/samples/subscribe_page_action/manifest.json | 7 |
2 files changed, 21 insertions, 33 deletions
diff --git a/chrome/test/data/extensions/samples/subscribe_page_action/background.html b/chrome/test/data/extensions/samples/subscribe_page_action/background.html index 9ab4f3f..a5d6772 100644 --- a/chrome/test/data/extensions/samples/subscribe_page_action/background.html +++ b/chrome/test/data/extensions/samples/subscribe_page_action/background.html @@ -1,17 +1,13 @@ <html> <head> <script> - // The Page Action ID. - var pageActionId = "RssPageAction"; - - // The icon to use. This corresponds to the icon listed in the manifest. - var subscribeId = 0; - // A dictionary keyed off of tabId that keeps track of data per tab (for // example what feedUrl was detected in the tab). var feedData = {}; chrome.extension.onConnect.addListener(function(port) { + var tab = port.sender.tab; + // This will get called from the content script using PostMessage. // |feedUrls| is a list of URL feeds found on the page. We only need 1 to // enable the PageAction icon in the Omnibox. @@ -20,34 +16,29 @@ // Let Chrome know that the PageAction needs to be enabled for this tabId // and for the url of this page. if (feedUrl) { - feedData[port.tab.id] = {pageUrl: port.tab.url, - feedUrl: feedUrl}; + feedData[tab.id] = { pageUrl: tab.url, + feedUrl: feedUrl }; - chrome.pageActions.enableForTab( - pageActionId, {tabId: port.tab.id, - url: port.tab.url, - title: "Click to subscribe...", - iconId: subscribeId}); + chrome.pageAction.setTitle({ tabId: tab.id, + title: "Click to subscribe..." }); + chrome.pageAction.show(tab.id); } }); }); // Chrome will call into us when the user clicks on the icon in the OmniBox. - chrome.pageActions["RssPageAction"].addListener(function(pageActionId, - pageActionInfo) { - chrome.windows.getCurrent(function(window) { - chrome.tabs.get(pageActionInfo.tabId, function(tab) { - // We need to know if we are the active window, because the tab may - // have moved to another window and we don't want to execute this - // action multiple times. - if (window.focused) { - // Create a new tab showing the subscription page with the right - // feed URL. - var url = "subscribe.html?" + - encodeURIComponent(feedData[pageActionInfo.tabId].feedUrl); - chrome.tabs.create({url: url, windowId: window.windowId}); - } - }); + chrome.pageAction.onClicked.addListener(function(tab) { + chrome.windows.get(tab.windowId, function(window) { + // We need to know if we are the active window, because the tab may + // have moved to another window and we don't want to execute this + // action multiple times. + if (window.focused) { + // Create a new tab showing the subscription page with the right + // feed URL. + var url = "subscribe.html?" + + encodeURIComponent(feedData[tab.id].feedUrl); + chrome.tabs.create({url: url, windowId: window.id}); + } }); }); diff --git a/chrome/test/data/extensions/samples/subscribe_page_action/manifest.json b/chrome/test/data/extensions/samples/subscribe_page_action/manifest.json index 84e84e9..ceb3bfe 100644 --- a/chrome/test/data/extensions/samples/subscribe_page_action/manifest.json +++ b/chrome/test/data/extensions/samples/subscribe_page_action/manifest.json @@ -16,11 +16,8 @@ "icons": { "128": "feed-icon-128x128.png" }, "page_actions": [ { - "id": "RssPageAction", - "name": "Subscribe to this feed", - "icons": [ - "feed-icon-16x16.png" - ] + "default_title": "Subscribe to this feed", + "default_icon": "feed-icon-16x16.png" } ] }
\ No newline at end of file |