OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 const Ci = Components.interfaces; | 5 const Ci = Components.interfaces; |
6 const Cc = Components.classes; | 6 const Cc = Components.classes; |
7 const Cr = Components.results; | 7 const Cr = Components.results; |
8 const Cu = Components.utils; | 8 const Cu = Components.utils; |
9 | 9 |
10 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | 10 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3934 LOG("getEngines: getting all engines"); | 3934 LOG("getEngines: getting all engines"); |
3935 var engines = this._getSortedEngines(true); | 3935 var engines = this._getSortedEngines(true); |
3936 aCount.value = engines.length; | 3936 aCount.value = engines.length; |
3937 return engines; | 3937 return engines; |
3938 }, | 3938 }, |
3939 | 3939 |
3940 getVisibleEngines: function SRCH_SVC_getVisible(aCount) { | 3940 getVisibleEngines: function SRCH_SVC_getVisible(aCount) { |
3941 this._ensureInitialized(); | 3941 this._ensureInitialized(); |
3942 LOG("getVisibleEngines: getting all visible engines"); | 3942 LOG("getVisibleEngines: getting all visible engines"); |
3943 var engines = this._getSortedEngines(false); | 3943 var engines = this._getSortedEngines(false); |
3944 // Capped visible engine count at 5 according to https://issues.adblockplus.
org/ticket/3128 | |
3945 engines = engines.slice(0, Math.min(engines.length, 5)); | |
3946 aCount.value = engines.length; | 3944 aCount.value = engines.length; |
3947 return engines; | 3945 return engines; |
3948 }, | 3946 }, |
3949 | 3947 |
3950 getDefaultEngines: function SRCH_SVC_getDefault(aCount) { | 3948 getDefaultEngines: function SRCH_SVC_getDefault(aCount) { |
3951 this._ensureInitialized(); | 3949 this._ensureInitialized(); |
3952 function isDefault(engine) { | 3950 function isDefault(engine) { |
3953 return engine._isDefault; | 3951 return engine._isDefault; |
3954 } | 3952 } |
3955 var engines = this._sortedEngines.filter(isDefault); | 3953 var engines = this._sortedEngines.filter(isDefault); |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4789 | 4787 |
4790 if (engine._iconUpdateURL) { | 4788 if (engine._iconUpdateURL) { |
4791 // If we're updating the engine too, use the new engine object, | 4789 // If we're updating the engine too, use the new engine object, |
4792 // otherwise use the existing engine object. | 4790 // otherwise use the existing engine object. |
4793 (testEngine || engine)._setIcon(engine._iconUpdateURL, true); | 4791 (testEngine || engine)._setIcon(engine._iconUpdateURL, true); |
4794 } | 4792 } |
4795 } | 4793 } |
4796 }; | 4794 }; |
4797 | 4795 |
4798 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SearchService]); | 4796 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SearchService]); |
OLD | NEW |