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

Side by Side Diff: chrome/background.js

Issue 5133183649579008: Fixed: Popup blocking functionality broken (Closed)
Patch Set: Created Dec. 20, 2013, 3:08 p.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 | popupBlocker.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 details.parentFrameId 184 details.parentFrameId
185 ) === false}; 185 ) === false};
186 }; 186 };
187 }, 187 },
188 _prepareExtraArguments: function(urls) 188 _prepareExtraArguments: function(urls)
189 { 189 {
190 return [urls ? {urls: urls} : {}, ["blocking"]]; 190 return [urls ? {urls: urls} : {}, ["blocking"]];
191 } 191 }
192 }; 192 };
193 193
194 var CreatedNavigationEventTarget = function()
195 {
196 WrappedEventTarget.call(this, chrome.webNavigation.onCreatedNavigationTarget );
197 };
198 CreatedNavigationEventTarget.prototype = {
199 __proto__: WrappedEventTarget.prototype,
200 _wrapListener: function(listener)
201 {
202 return function(details)
203 {
204 var tab = null;
205 var sourceTab = null;
206
207 if (details.tabId != -1)
208 tab = new Tab({id: details.tabId, url: details.url});
209
210 if (details.sourceTabId != -1)
211 sourceTab = new Tab({id: details.sourceTabId});
212
213 listener({
214 tab: tab,
215 sourceTab: sourceTab,
216 sourceFrameId: details.sourceFrameId
217 });
218 }
219 }
220 };
221
194 222
195 /* Tabs */ 223 /* Tabs */
196 224
197 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest; 225 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest;
198 226
199 var BrowserAction = function(tabId) 227 var BrowserAction = function(tabId)
200 { 228 {
201 this._tabId = tabId; 229 this._tabId = tabId;
202 }; 230 };
203 BrowserAction.prototype = { 231 BrowserAction.prototype = {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 onCompleted: new CompletedTabEventTarget(), 391 onCompleted: new CompletedTabEventTarget(),
364 onActivated: new ActivatedTabEventTarget(), 392 onActivated: new ActivatedTabEventTarget(),
365 onRemoved: new RemovedTabEventTarget() 393 onRemoved: new RemovedTabEventTarget()
366 }; 394 };
367 395
368 ext.webRequest = { 396 ext.webRequest = {
369 onBeforeRequest: new BeforeRequestEventTarget(), 397 onBeforeRequest: new BeforeRequestEventTarget(),
370 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged 398 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged
371 }; 399 };
372 400
401 ext.webNavigation = {
402 onCreatedNavigationTarget: new CreatedNavigationEventTarget()
403 };
404
373 ext.contextMenus = { 405 ext.contextMenus = {
374 create: function(title, contexts, onclick) 406 create: function(title, contexts, onclick)
375 { 407 {
376 chrome.contextMenus.create({ 408 chrome.contextMenus.create({
377 title: title, 409 title: title,
378 contexts: contexts, 410 contexts: contexts,
379 onclick: function(info, tab) 411 onclick: function(info, tab)
380 { 412 {
381 onclick(info.srcUrl, new Tab(tab)); 413 onclick(info.srcUrl, new Tab(tab));
382 } 414 }
383 }); 415 });
384 }, 416 },
385 removeAll: function(callback) 417 removeAll: function(callback)
386 { 418 {
387 chrome.contextMenus.removeAll(callback); 419 chrome.contextMenus.removeAll(callback);
388 } 420 }
389 }; 421 };
390 })(); 422 })();
OLDNEW
« no previous file with comments | « no previous file | popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld