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

Side by Side Diff: lib/appSupport.js

Issue 6228524553732096: Issue 1713 - (Disable/Enable on ...) not showing on FF Mobile (Closed)
Patch Set: Created Dec. 28, 2014, 7:26 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 | « no previous file | 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 695
696 exports.getBrowser = (window) => window.BrowserApp.selectedBrowser; 696 exports.getBrowser = (window) => window.BrowserApp.selectedBrowser;
697 697
698 exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {sele cted: true}); 698 exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {sele cted: true});
699 699
700 let BrowserChangeListener = function(window, callback) 700 let BrowserChangeListener = function(window, callback)
701 { 701 {
702 this.window = window; 702 this.window = window;
703 this.callback = callback; 703 this.callback = callback;
704 this.onSelect = this.onSelect.bind(this); 704 this.onSelect = this.onSelect.bind(this);
705 this.attach(); 705 this.attach = this.attach.bind(this);
706 if (window.BrowserApp.deck)
707 this.attach();
708 else
709 window.addEventListener("UIReady", this.attach, false);
706 }; 710 };
707 BrowserChangeListener.prototype = { 711 BrowserChangeListener.prototype = {
708 window: null, 712 window: null,
709 callback: null, 713 callback: null,
710 currentBrowser: null, 714 currentBrowser: null,
711 715
712 setBrowser: function(browser) 716 setBrowser: function(browser)
713 { 717 {
714 if (browser != this.currentBrowser) 718 if (browser != this.currentBrowser)
715 { 719 {
716 let oldBrowser = this.currentBrowser; 720 let oldBrowser = this.currentBrowser;
717 this.currentBrowser = browser; 721 this.currentBrowser = browser;
718 this.callback(oldBrowser, browser); 722 this.callback(oldBrowser, browser);
719 } 723 }
720 }, 724 },
721 725
722 onSelect: function() 726 onSelect: function()
723 { 727 {
724 let {Utils} = require("utils"); 728 let {Utils} = require("utils");
725 Utils.runAsync(function() 729 Utils.runAsync(function()
726 { 730 {
727 this.setBrowser(exports.getBrowser(this.window)); 731 this.setBrowser(exports.getBrowser(this.window));
728 }.bind(this)); 732 }.bind(this));
729 }, 733 },
730 734
731 attach: function() 735 attach: function()
732 { 736 {
737 this.window.removeEventListener("UIReady", this.attach, false);
733 this.onSelect(); 738 this.onSelect();
734
735 this.window.BrowserApp.deck.addEventListener("TabSelect", this.onSelect, false); 739 this.window.BrowserApp.deck.addEventListener("TabSelect", this.onSelect, false);
736 }, 740 },
737 detach: function() 741 detach: function()
738 { 742 {
739 this.window.BrowserApp.deck.removeEventListener("TabSelect", this.onSele ct, false); 743 this.window.BrowserApp.deck.removeEventListener("TabSelect", this.onSele ct, false);
740 744
741 this.setBrowser(null); 745 this.setBrowser(null);
742 } 746 }
743 }; 747 };
744 748
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 event.state = {id: require("info").addonID}; 951 event.state = {id: require("info").addonID};
948 browser._contentWindow.dispatchEvent(event); 952 browser._contentWindow.dispatchEvent(event);
949 }); 953 });
950 }); 954 });
951 }, true); 955 }, true);
952 }; 956 };
953 957
954 break; 958 break;
955 } 959 }
956 } 960 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld