summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 22:18:14 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 22:18:14 +0000
commit23fa003f2eefd24ca32ba82421c86e59bd82810f (patch)
treed590c68a92acd00cff3e6278aa51ccbb0d6321e8 /chrome
parent87f64395650476d57d7a845efef083503cab6225 (diff)
downloadchromium_src-23fa003f2eefd24ca32ba82421c86e59bd82810f.zip
chromium_src-23fa003f2eefd24ca32ba82421c86e59bd82810f.tar.gz
chromium_src-23fa003f2eefd24ca32ba82421c86e59bd82810f.tar.bz2
Switch to using sendRequest instead of postMessage.
Fix a bug causing the page action onClick handler not to work (only affects certain Linux builds that don't have PageAction popup support, all other builds use the Popup). Added copyright header. BUG=None TEST=None Review URL: http://codereview.chromium.org/500024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/background.html30
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/feed_finder.js2
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/iframe.js5
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/manifest.json2
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/popup.html5
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/subscribe.html5
-rw-r--r--chrome/test/data/extensions/subscribe_page_action/subscribe.js4
7 files changed, 38 insertions, 15 deletions
diff --git a/chrome/test/data/extensions/subscribe_page_action/background.html b/chrome/test/data/extensions/subscribe_page_action/background.html
index 2c22882..c97d48f 100644
--- a/chrome/test/data/extensions/subscribe_page_action/background.html
+++ b/chrome/test/data/extensions/subscribe_page_action/background.html
@@ -1,3 +1,8 @@
+<!--
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
<html>
<head>
<script>
@@ -5,19 +10,18 @@
// 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.
- port.onMessage.addListener(function(feedUrls) {
- feedData[tab.id] = feedUrls;
- chrome.pageAction.setTitle({ tabId: tab.id,
- title: "Click to subscribe..."
- });
- chrome.pageAction.show(tab.id);
+ chrome.extension.onRequest.addListener(
+ function(request, sender) {
+ if (request.msg == "feedIcon") {
+ // We have received a list of feed urls found on the page.
+ // Enable the page action icon.
+ feedData[sender.tab.id] = request.feeds;
+ chrome.pageAction.setTitle({ tabId: sender.tab.id,
+ title: "Click to subscribe..."
+ });
+ chrome.pageAction.show(sender.tab.id);
+ }
});
- });
chrome.tabs.onRemoved.addListener(function(tabId) {
delete feedData[tabId];
@@ -34,7 +38,7 @@
// Create a new tab showing the subscription page with the right
// feed URL.
var url = "subscribe.html?" +
- encodeURIComponent(feedData[tab.id].feedUrl);
+ encodeURIComponent(feedData[tab.id][0].href);
chrome.tabs.create({url: url, windowId: window.id});
}
});
diff --git a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js
index c7f7735..218bcd0 100644
--- a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js
+++ b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js
@@ -22,6 +22,6 @@ function findFeeds() {
if (count > 0) {
// Notify the extension of the feed URLs we found.
- chrome.extension.connect().postMessage(feeds);
+ chrome.extension.sendRequest({msg: "feedIcon", feeds: feeds});
}
}
diff --git a/chrome/test/data/extensions/subscribe_page_action/iframe.js b/chrome/test/data/extensions/subscribe_page_action/iframe.js
index 475ce52..c1a80f1 100644
--- a/chrome/test/data/extensions/subscribe_page_action/iframe.js
+++ b/chrome/test/data/extensions/subscribe_page_action/iframe.js
@@ -1,3 +1,8 @@
+/* Copyright (c) 2009 The Chromium Authors. All rights reserved.
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+*/
+
/* Use only multi-line comments in this file, since during testing
its contents will get read from disk and stuffed into the
iframe .src tag, which is a process that doesn't preserve line
diff --git a/chrome/test/data/extensions/subscribe_page_action/manifest.json b/chrome/test/data/extensions/subscribe_page_action/manifest.json
index 6ce326c..ee54f55 100644
--- a/chrome/test/data/extensions/subscribe_page_action/manifest.json
+++ b/chrome/test/data/extensions/subscribe_page_action/manifest.json
@@ -1,7 +1,7 @@
{
"name": "RSS Subscription Extension (by Google)",
"description": "Adds one-click subscription to your toolbar.",
- "version": "1.8.1",
+ "version": "1.8.2",
"permissions": [
"tabs",
"http://*/*",
diff --git a/chrome/test/data/extensions/subscribe_page_action/popup.html b/chrome/test/data/extensions/subscribe_page_action/popup.html
index 67b9339..a67de0e 100644
--- a/chrome/test/data/extensions/subscribe_page_action/popup.html
+++ b/chrome/test/data/extensions/subscribe_page_action/popup.html
@@ -1,3 +1,8 @@
+<!--
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
<html>
<head>
<style>
diff --git a/chrome/test/data/extensions/subscribe_page_action/subscribe.html b/chrome/test/data/extensions/subscribe_page_action/subscribe.html
index d696a67..b51dd5c 100644
--- a/chrome/test/data/extensions/subscribe_page_action/subscribe.html
+++ b/chrome/test/data/extensions/subscribe_page_action/subscribe.html
@@ -1,3 +1,8 @@
+<!--
+ * Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+ * source code is governed by a BSD-style license that can be found in the
+ * LICENSE file.
+-->
<html>
<head>
<title>Subscribe to feed</title>
diff --git a/chrome/test/data/extensions/subscribe_page_action/subscribe.js b/chrome/test/data/extensions/subscribe_page_action/subscribe.js
index 8d9ee1c..1205d10 100644
--- a/chrome/test/data/extensions/subscribe_page_action/subscribe.js
+++ b/chrome/test/data/extensions/subscribe_page_action/subscribe.js
@@ -1,3 +1,7 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
// Grab the querystring, removing question mark at the front and splitting on
// the ampersand.
var queryString = location.search.substring(1).split("&");