| Index: lib/typoAppIntegration.js | 
| =================================================================== | 
| --- a/lib/typoAppIntegration.js | 
| +++ b/lib/typoAppIntegration.js | 
| @@ -16,6 +16,8 @@ | 
| */ | 
|  | 
| let {hook} = require("hooks"); | 
| +let {application, addonName} = require("info"); | 
| + | 
| let functionHooks = new WeakMap(); | 
|  | 
| exports.removeFromWindow = function(window) | 
| @@ -28,7 +30,76 @@ | 
| } | 
| }; | 
|  | 
| -let {application} = require("info"); | 
| +switch (addonName) | 
| +{ | 
| +  case "url-fixer": | 
| +  { | 
| +    // URL Fixer | 
| +    exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) true; | 
| + | 
| +    break; | 
| +  } | 
| +  case "adblockplus": | 
| +  { | 
| +    // Adblock Plus | 
| +    let {Prefs} = require("prefs"); | 
| + | 
| +    // Do not ask to opt-in if user found setting | 
| +    if (!Prefs.correctTyposAsked) | 
| +    { | 
| +      let onPrefChange = function(name) | 
| +      { | 
| +        if (name == "correctTypos") | 
| +        { | 
| +          Prefs.correctTyposAsked = true; | 
| +          Prefs.removeListener(onPrefChange); | 
| +        } | 
| +      } | 
| + | 
| +      Prefs.addListener(onPrefChange); | 
| +    } | 
| + | 
| +    exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) | 
| +    { | 
| +      if (!Prefs.correctTyposAsked && !Prefs.correctTypos) | 
| +      { | 
| +        let {Utils} = require("utils"); | 
| +        let message = Utils.getString("typo_optin_message").replace(/\?1\?/, domain); | 
| +        let yes = Utils.getString("typo_optin_yes"); | 
| +        let no = Utils.getString("typo_optin_no"); | 
| +        let buttons = [ | 
| +          { | 
| +            label:      yes, | 
| +            accessKey:  null, | 
| +            callback:   function() | 
| +            { | 
| +              // Yes: Enable typo correction | 
| +              Prefs.correctTypos = true; | 
| +              exports.loadURI(window, prefix + domain + suffix); | 
| +              Prefs.correctTyposAsked = true; | 
| +            } | 
| +          }, | 
| +          { | 
| +            label:      no, | 
| +            accessKey:  null, | 
| +            callback:   function() | 
| +            { | 
| +              // No: Do nothing | 
| +              Prefs.correctTyposAsked = true; | 
| +            } | 
| +          } | 
| +        ]; | 
| +        // We need to have persistence being set to 1 due to redirect which happens afterwards | 
| +        exports.openInfobar(window, "adblockplus-infobar-correct-typos-ask", message, buttons, 1); | 
| +      } | 
| + | 
| +      return Prefs.correctTypos; | 
| +    }; | 
| + | 
| +    break; | 
| +  } | 
| +} | 
| + | 
| switch (application) | 
| { | 
| case "firefox": | 
| @@ -66,11 +137,10 @@ | 
| { | 
| infobar.removeNotification(notification); | 
| } | 
| - | 
| notification = infobar.appendNotification( | 
| message, | 
| id, | 
| -        require("info").addonRoot + "icon64.png", | 
| +        "chrome://" + addonName + "/skin/icon16.png", | 
| infobar.PRIORITY_INFO_HIGH, | 
| buttons | 
| ); | 
| @@ -156,7 +226,7 @@ | 
| notification = infobar.appendNotification( | 
| message, | 
| id, | 
| -        require("info").addonRoot + "icon64.png", | 
| +        "chrome://" + addonName + "/skin/icon16.png", | 
| infobar.PRIORITY_INFO_HIGH, | 
| buttons | 
| ); | 
| @@ -213,7 +283,7 @@ | 
| notification = infobar.appendNotification( | 
| message, | 
| id, | 
| -          require("info").addonRoot + "icon64.png", | 
| +          "chrome://" + addonName + "/skin/icon16.png", | 
| infobar.PRIORITY_INFO_HIGH, | 
| buttons | 
| ); | 
| @@ -286,9 +356,7 @@ | 
| { | 
| window.NativeWindow.doorhanger.show(message, id, buttons, window.BrowserApp.selectedTab.id, | 
| { | 
| -            // No navigation is happening after doorhanger is shown | 
| -            // so persistence needs to be reduced by one | 
| -            persistence: persistence - 1 | 
| +            persistence: persistence | 
| } | 
| ); | 
| } | 
|  |