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

Unified Diff: chrome/test/data/extensions/samples/subscribe_page_action/feed_finder.js

Issue 115536: Add the RSS page action extension.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
Index: chrome/test/data/extensions/samples/subscribe_page_action/feed_finder.js
===================================================================
--- chrome/test/data/extensions/samples/subscribe_page_action/feed_finder.js (revision 0)
+++ chrome/test/data/extensions/samples/subscribe_page_action/feed_finder.js (revision 0)
@@ -0,0 +1,24 @@
+// 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.
+
+if (window == top) {
+ findFeeds();
+ window.addEventListener("focus", findFeeds);
+}
+
+function findFeeds() {
+ // Find all the RSS link elements.
+ var result = document.evaluate(
+ '//link[@rel="alternate"][contains(@type, "rss") or ' +
+ 'contains(@type, "atom") or contains(@type, "rdf")]',
+ document, null, 0, null);
+
+ var feeds = [];
+ var item;
+ while (item = result.iterateNext())
+ feeds.push(item.href);
+
+ // Notify the extension of the feed URLs we found.
+ chrome.extension.connect().postMessage(feeds);
+}

Powered by Google App Engine
This is Rietveld 408576698