Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/ext/background.js

Issue 6276084194607104: Issue 338 - Updated minimum version to Chrome 28 and got rid of legacy compatibility code (Closed)
Patch Set: Created April 16, 2014, 9:54 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/ext/common.js » ('j') | popupBlocker.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -19,8 +19,6 @@
{
/* Pages */
- var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest;
-
var Page = ext.Page = function(tab)
{
this._id = tab.id;
@@ -53,7 +51,7 @@
},
sendMessage: function(message, responseCallback)
{
- sendMessage(this._id, message, responseCallback);
+ chrome.tabs.sendMessage(this._id, message, responseCallback);
}
};
@@ -317,22 +315,22 @@
/* Message passing */
- ext._setupMessageListener(function(sender)
+ chrome.runtime.onMessage.addListener(function(message, rawSender, sendResponse)
{
- return {
- page: new Page(sender.tab),
+ var sender = {
+ page: new Page(rawSender.tab),
frame: {
- url: sender.url,
+ url: rawSender.url,
get parent()
{
- var frames = framesOfTabs[sender.tab.id];
+ var frames = framesOfTabs[rawSender.tab.id];
if (!frames)
return null;
for (var frameId in frames)
{
- if (frames[frameId].url == sender.url)
+ if (frames[frameId].url == rawSender.url)
return frames[frameId].parent;
}
@@ -340,6 +338,8 @@
}
}
};
+
+ return ext.onMessage._dispatch(message, sender, sendResponse);
});
« no previous file with comments | « no previous file | chrome/ext/common.js » ('j') | popupBlocker.js » ('J')

Powered by Google App Engine
This is Rietveld