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

Side by Side Diff: chrome/test/data/extensions/subscribe_page_action/background.js

Issue 12843037: Convert the RSS extension to event pages to avoid a dedicated background process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/test/data/extensions/subscribe_page_action/doc_start.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A dictionary keyed off of tabId that keeps track of data per tab (for 5 // A dictionary keyed off of tabId that keeps track of data per tab (for
6 // example what feedUrl was detected in the tab). 6 // example what feedUrl was detected in the tab).
7 var feedData = {}; 7 var feedData = {};
not at google - send to devlin 2013/03/26 15:25:38 when the event page unloads this will be lost, but
8 8
9 chrome.extension.onRequest.addListener(function(request, sender) { 9 chrome.extension.onMessage.addListener(function(request, sender) {
10 if (request.msg == "feedIcon") { 10 if (request.msg == "feedIcon") {
11 // First validate that all the URLs have the right schema. 11 // First validate that all the URLs have the right schema.
12 var input = []; 12 var input = [];
13 for (var i = 0; i < request.feeds.length; ++i) { 13 for (var i = 0; i < request.feeds.length; ++i) {
14 var a = document.createElement('a'); 14 var a = document.createElement('a');
15 a.href = request.feeds[i].href; 15 a.href = request.feeds[i].href;
16 if (a.protocol == "http:" || a.protocol == "https:") { 16 if (a.protocol == "http:" || a.protocol == "https:") {
17 input.push(request.feeds[i]); 17 input.push(request.feeds[i]);
18 } else { 18 } else {
19 console.log('Warning: feed source rejected (wrong protocol): ' + 19 console.log('Warning: feed source rejected (wrong protocol): ' +
(...skipping 27 matching lines...) Expand all
47 }); 47 });
48 var url = "subscribe.html?" + encodeURIComponent(request.href); 48 var url = "subscribe.html?" + encodeURIComponent(request.href);
49 url = chrome.extension.getURL(url); 49 url = chrome.extension.getURL(url);
50 chrome.tabs.create({ url: url, index: sender.tab.index }); 50 chrome.tabs.create({ url: url, index: sender.tab.index });
51 } 51 }
52 }); 52 });
53 53
54 chrome.tabs.onRemoved.addListener(function(tabId) { 54 chrome.tabs.onRemoved.addListener(function(tabId) {
55 delete feedData[tabId]; 55 delete feedData[tabId];
56 }); 56 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/subscribe_page_action/doc_start.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698