LEFT | RIGHT |
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 28 matching lines...) Expand all Loading... |
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 equals: function(page) | |
50 { | |
51 return this._id == page._id; | |
52 }, | |
53 activate: function() | 49 activate: function() |
54 { | 50 { |
55 chrome.tabs.update(this._id, {selected: true}); | 51 chrome.tabs.update(this._id, {selected: true}); |
56 }, | 52 }, |
57 sendMessage: function(message, responseCallback) | 53 sendMessage: function(message, responseCallback) |
58 { | 54 { |
59 chrome.tabs.sendMessage(this._id, message, responseCallback); | 55 chrome.tabs.sendMessage(this._id, message, responseCallback); |
60 } | 56 } |
| 57 }; |
| 58 |
| 59 ext._getPage = function(id) |
| 60 { |
| 61 return new Page({id: parseInt(id, 10)}); |
61 }; | 62 }; |
62 | 63 |
63 ext.pages = { | 64 ext.pages = { |
64 open: function(url, callback) | 65 open: function(url, callback) |
65 { | 66 { |
66 if (callback) | 67 if (callback) |
67 { | 68 { |
68 chrome.tabs.create({url: url}, function(openedTab) | 69 chrome.tabs.create({url: url}, function(openedTab) |
69 { | 70 { |
70 var onUpdated = function(tabId, changeInfo, tab) | 71 var onUpdated = function(tabId, changeInfo, tab) |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 callback(new Page(tab)); | 411 callback(new Page(tab)); |
411 } | 412 } |
412 else | 413 else |
413 { | 414 { |
414 ext.pages.open(optionsUrl, callback); | 415 ext.pages.open(optionsUrl, callback); |
415 } | 416 } |
416 }); | 417 }); |
417 }); | 418 }); |
418 }; | 419 }; |
419 })(); | 420 })(); |
LEFT | RIGHT |