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

Delta Between Two Patch Sets: background.js

Issue 6098518317989888: Fix: Notification popup is broken (Closed)
Left Patch Set: Popup notification fix Created Feb. 26, 2014, 4:14 p.m.
Right Patch Set: Change back activeNotification unset Created Feb. 26, 2014, 6:31 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 | « _locales/en_US/messages.json ('k') | chrome/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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 }); 279 });
280 }); 280 });
281 }); 281 });
282 } 282 }
283 283
284 function prepareNotificationIconAndPopup() 284 function prepareNotificationIconAndPopup()
285 { 285 {
286 activeNotification.onClicked = function() 286 activeNotification.onClicked = function()
287 { 287 {
288 iconAnimation.stop(); 288 iconAnimation.stop();
289 activeNotification = null;
289 }; 290 };
290 291
Felix Dahlke 2014/02/26 17:22:58 Why did you change this logic?
Thomas Greiner 2014/02/26 17:37:35 @Felix The problem is that onClicked is never call
Felix Dahlke 2014/02/26 17:47:10 Ah I see. That event handler name is a bit confusi
saroyanm 2014/02/26 18:15:34 @Thomas but the current approach with createHTMLNo
saroyanm 2014/02/26 18:25:08 From My point of view, the logic should change: We
291 iconAnimation.update(activeNotification.severity); 292 iconAnimation.update(activeNotification.severity);
Felix Dahlke 2014/02/27 14:10:39 Nit: Probably whitespace differences, this shouldn
292 activeNotification = null;
293 } 293 }
294 294
295 function openNotificationLinks() 295 function openNotificationLinks()
296 { 296 {
297 if (activeNotification.links) 297 if (activeNotification.links)
298 { 298 {
299 activeNotification.links.forEach(function(link) 299 activeNotification.links.forEach(function(link)
300 { 300 {
301 ext.windows.getLastFocused(function(win) 301 ext.windows.getLastFocused(function(win)
302 { 302 {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 notification.show(); 365 notification.show();
366 notification.addEventListener("close", prepareNotificationIconAndPopup, fa lse); 366 notification.addEventListener("close", prepareNotificationIconAndPopup, fa lse);
367 notification.addEventListener("click", openNotificationLinks, false); 367 notification.addEventListener("click", openNotificationLinks, false);
368 } 368 }
369 else 369 else
370 { 370 {
371 var message = title + "\n" + message; 371 var message = title + "\n" + message;
372 if (hasLinks) 372 if (hasLinks)
373 message += "\n\n" + ext.i18n.getMessage("notification_with_buttons"); 373 message += "\n\n" + ext.i18n.getMessage("notification_with_buttons");
374 374
375 var notification = confirm(message); 375 if (confirm(message))
Thomas Greiner 2014/02/27 10:07:32 Nit: Change to… if (confirm(message)) openNotif
376 if (notification == true) 376 {
377 openNotificationLinks(); 377 openNotificationLinks();
378 prepareNotificationIconAndPopup();
379 }
378 else 380 else
379 prepareNotificationIconAndPopup(); 381 prepareNotificationIconAndPopup();
380 } 382 }
381 } 383 }
382 else 384 else
383 prepareNotificationIconAndPopup(); 385 prepareNotificationIconAndPopup();
384 } 386 }
385 387
386 ext.onMessage.addListener(function (msg, sender, sendResponse) 388 ext.onMessage.addListener(function (msg, sender, sendResponse)
387 { 389 {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 tab.sendMessage({type: "clickhide-deactivate"}); 497 tab.sendMessage({type: "clickhide-deactivate"});
496 refreshIconAndContextMenu(tab); 498 refreshIconAndContextMenu(tab);
497 }); 499 });
498 500
499 setTimeout(function() 501 setTimeout(function()
500 { 502 {
501 var notificationToShow = Notification.getNextToShow(); 503 var notificationToShow = Notification.getNextToShow();
502 if (notificationToShow) 504 if (notificationToShow)
503 showNotification(notificationToShow); 505 showNotification(notificationToShow);
504 }, 3 * 60 * 1000); 506 }, 3 * 60 * 1000);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld