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

Delta Between Two Patch Sets: background.js

Issue 5099207639695360: Made browser actions per tab on Safari (Closed)
Left Patch Set: Rebased, addressed comment and enabled to set global browser actions Created Jan. 15, 2014, 7:19 p.m.
Right Patch Set: Forgot to set tab in BrowserAction constructor Created Jan. 17, 2014, 2:19 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | safari/ext/background.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // sendResponse asynchronously 402 // sendResponse asynchronously
403 return true; 403 return true;
404 } 404 }
405 break; 405 break;
406 default: 406 default:
407 sendResponse({}); 407 sendResponse({});
408 break; 408 break;
409 } 409 }
410 }); 410 });
411 411
412 // Set icon title/tooltip globally
413 ext.browserAction.setTitle(ext.i18n.getMessage("name"));
Wladimir Palant 2014/01/16 09:10:05 If you take this route then there should also be a
Sebastian Noack 2014/01/16 12:45:02 I think it is fine as it is. the default icon is a
Wladimir Palant 2014/01/16 12:55:18 The difference however is: Chrome will reset the i
Sebastian Noack 2014/01/16 14:01:52 Yes, but we backup the default (which comes from I
Wladimir Palant 2014/01/17 07:54:36 Ok, I see - setting the image explicitly is indeed
414
415 // Show icon as browser action for all tabs that already exist 412 // Show icon as browser action for all tabs that already exist
416 ext.windows.getAll(function(windows) 413 ext.windows.getAll(function(windows)
417 { 414 {
418 for (var i = 0; i < windows.length; i++) 415 for (var i = 0; i < windows.length; i++)
419 { 416 {
420 windows[i].getAllTabs(function(tabs) 417 windows[i].getAllTabs(function(tabs)
421 { 418 {
422 tabs.forEach(refreshIconAndContextMenu); 419 tabs.forEach(refreshIconAndContextMenu);
423 }); 420 });
424 } 421 }
425 }); 422 });
426 423
427 // Update icon if a tab changes location 424 // Update icon if a tab changes location
428 ext.tabs.onLoading.addListener(function(tab) 425 ext.tabs.onLoading.addListener(function(tab)
429 { 426 {
430 tab.sendMessage({type: "clickhide-deactivate"}); 427 tab.sendMessage({type: "clickhide-deactivate"});
431 refreshIconAndContextMenu(tab); 428 refreshIconAndContextMenu(tab);
432 }); 429 });
433 430
434 setTimeout(function() 431 setTimeout(function()
435 { 432 {
436 var notificationToShow = Notification.getNextToShow(); 433 var notificationToShow = Notification.getNextToShow();
437 if (notificationToShow) 434 if (notificationToShow)
438 showNotification(notificationToShow); 435 showNotification(notificationToShow);
439 }, 3 * 60 * 1000); 436 }, 3 * 60 * 1000);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld