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

Side by Side Diff: chrome/ext/background.js

Issue 29370947: Issue 3138 - Improve how context menu "block element" handles iframes (Closed)
Patch Set: Addressed feedback Created Jan. 12, 2017, 7:14 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | composer.postload.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 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 28 matching lines...) Expand all
39 // In that case we get the url from top frame of the tab, recorded by 39 // In that case we get the url from top frame of the tab, recorded by
40 // the onBeforeRequest handler. 40 // the onBeforeRequest handler.
41 var frames = framesOfTabs[this.id]; 41 var frames = framesOfTabs[this.id];
42 if (frames) 42 if (frames)
43 { 43 {
44 var frame = frames[0]; 44 var frame = frames[0];
45 if (frame) 45 if (frame)
46 return frame.url; 46 return frame.url;
47 } 47 }
48 }, 48 },
49 sendMessage: function(message, responseCallback) 49 sendMessage: function(message, responseCallback, frameId)
50 { 50 {
51 chrome.tabs.sendMessage(this.id, message, responseCallback); 51 let options = {};
52 if (typeof frameId != "undefined")
53 options.frameId = frameId;
54 chrome.tabs.sendMessage(this.id, message, options, responseCallback);
52 } 55 }
53 }; 56 };
54 57
55 ext.getPage = function(id) 58 ext.getPage = function(id)
56 { 59 {
57 return new Page({id: parseInt(id, 10)}); 60 return new Page({id: parseInt(id, 10)});
58 }; 61 };
59 62
60 function afterTabLoaded(callback) 63 function afterTabLoaded(callback)
61 { 64 {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 if (!items) 324 if (!items)
322 return; 325 return;
323 326
324 items.forEach(function(item) 327 items.forEach(function(item)
325 { 328 {
326 chrome.contextMenus.create({ 329 chrome.contextMenus.create({
327 title: item.title, 330 title: item.title,
328 contexts: item.contexts, 331 contexts: item.contexts,
329 onclick: function(info, tab) 332 onclick: function(info, tab)
330 { 333 {
331 item.onclick(new Page(tab)); 334 item.onclick(new Page(tab), info);
332 } 335 }
333 }); 336 });
334 }); 337 });
335 }); 338 });
336 }); 339 });
337 }; 340 };
338 341
339 var ContextMenus = function(page) 342 var ContextMenus = function(page)
340 { 343 {
341 this._page = page; 344 this._page = page;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 ext.windows = { 584 ext.windows = {
582 create: function(createData, callback) 585 create: function(createData, callback)
583 { 586 {
584 chrome.windows.create(createData, function(createdWindow) 587 chrome.windows.create(createData, function(createdWindow)
585 { 588 {
586 afterTabLoaded(callback)(createdWindow.tabs[0]); 589 afterTabLoaded(callback)(createdWindow.tabs[0]);
587 }); 590 });
588 } 591 }
589 }; 592 };
590 })(); 593 })();
OLDNEW
« no previous file with comments | « no previous file | composer.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld