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

Side by Side Diff: webrequest.js

Issue 6182748523855872: Issue 1518 - Got rid of deprecated code using webkitNotifications (Closed)
Patch Set: Use addEventListener() Created Jan. 13, 2015, 12:29 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 | « metadata.common ('k') | no next file » | 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-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(), 59 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(),
60 docDomain, 60 docDomain,
61 isThirdParty(extractHostFromURL(url), docDomain), 61 isThirdParty(extractHostFromURL(url), docDomain),
62 key 62 key
63 ); 63 );
64 64
65 // We can't listen to onHeadersReceived in Safari so we need to 65 // We can't listen to onHeadersReceived in Safari so we need to
66 // check for notifications here 66 // check for notifications here
67 if (platform != "chromium" && type == "sub_frame") 67 if (platform != "chromium" && type == "sub_frame")
68 { 68 {
69 var notificationToShow = Notification.getNextToShow(url); 69 var notificationToShow = NotificationStorage.getNextToShow(url);
70 if (notificationToShow) 70 if (notificationToShow)
71 showNotification(notificationToShow); 71 showNotification(notificationToShow);
72 } 72 }
73 73
74 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page); 74 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page);
75 return !(filter instanceof BlockingFilter); 75 return !(filter instanceof BlockingFilter);
76 } 76 }
77 77
78 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest); 78 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest);
79 79
(...skipping 13 matching lines...) Expand all
93 if (!frame || frame.url != details.url) 93 if (!frame || frame.url != details.url)
94 return; 94 return;
95 95
96 for (var i = 0; i < details.responseHeaders.length; i++) 96 for (var i = 0; i < details.responseHeaders.length; i++)
97 { 97 {
98 var header = details.responseHeaders[i]; 98 var header = details.responseHeaders[i];
99 if (header.name.toLowerCase() == "x-adblock-key" && header.value) 99 if (header.name.toLowerCase() == "x-adblock-key" && header.value)
100 processKey(header.value, page, frame); 100 processKey(header.value, page, frame);
101 } 101 }
102 102
103 var notificationToShow = Notification.getNextToShow(details.url); 103 var notificationToShow = NotificationStorage.getNextToShow(details.url);
104 if (notificationToShow) 104 if (notificationToShow)
105 showNotification(notificationToShow); 105 showNotification(notificationToShow);
106 } 106 }
107 107
108 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]); 108 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]);
109 } 109 }
OLDNEW
« no previous file with comments | « metadata.common ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld