LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 if ("windows" in chrome) | 740 if ("windows" in chrome) |
741 { | 741 { |
742 chrome.windows.getLastFocused(win => | 742 chrome.windows.getLastFocused(win => |
743 { | 743 { |
744 let optionsUrl = "options.html"; | 744 let optionsUrl = "options.html"; |
745 let queryInfo = {url: optionsUrl}; | 745 let queryInfo = {url: optionsUrl}; |
746 | 746 |
747 // extension pages can't be accessed in incognito windows. In order to | 747 // extension pages can't be accessed in incognito windows. In order to |
748 // correctly mimic the way in which Chrome opens extension options, | 748 // correctly mimic the way in which Chrome opens extension options, |
749 // we have to focus the options page in any other window. | 749 // we have to focus the options page in any other window. |
750 if (!win.incognito) | 750 if (!win.incognito) |
751 queryInfo.windowId = win.id; | 751 queryInfo.windowId = win.id; |
752 | 752 |
753 chrome.tabs.query(queryInfo, tabs => | 753 chrome.tabs.query(queryInfo, tabs => |
754 { | 754 { |
755 if (tabs && tabs.length > 0) | 755 if (tabs.length > 0) |
756 { | 756 { |
757 let tab = tabs[0]; | 757 let tab = tabs[0]; |
758 | 758 |
759 if ("windows" in chrome) | 759 if ("windows" in chrome) |
760 chrome.windows.update(tab.windowId, {focused: true}); | 760 chrome.windows.update(tab.windowId, {focused: true}); |
761 | 761 |
762 chrome.tabs.update(tab.id, {active: true}); | 762 chrome.tabs.update(tab.id, {active: true}); |
763 | 763 |
764 if (callback) | 764 if (callback) |
765 callback(new Page(tab)); | 765 callback(new Page(tab)); |
(...skipping 19 matching lines...) Expand all Loading... |
785 ext.windows = { | 785 ext.windows = { |
786 create(createData, callback) | 786 create(createData, callback) |
787 { | 787 { |
788 chrome.windows.create(createData, createdWindow => | 788 chrome.windows.create(createData, createdWindow => |
789 { | 789 { |
790 afterTabLoaded(callback)(createdWindow.tabs[0]); | 790 afterTabLoaded(callback)(createdWindow.tabs[0]); |
791 }); | 791 }); |
792 } | 792 } |
793 }; | 793 }; |
794 }()); | 794 }()); |
LEFT | RIGHT |