B2G/gecko/accessible/src/jsat/AccessFu.jsm
/**
   * Initialize chrome-layer accessibility functionality.
   * If accessibility is enabled on the platform, then a special accessibility
   * mode is started.
   */
Initialize chrome-layer accessibility functionality.
If accessibility is enabled on the platform, then a special accessibility
mode is started.
Initialize chrome - layer accessibility functionality . If accessibility is enabled on the platform then a special accessibility mode is started .
function attach(aWindow) {
    if (this.chromeWin)
      throw new Error('Only one window could be attached to AccessFu');
    Logger.info('attach');
    this.chromeWin = aWindow;
    this.prefsBranch = Cc['@mozilla.org/preferences-service;1']
      .getService(Ci.nsIPrefService).getBranch('accessibility.accessfu.');
    this.prefsBranch.addObserver('activate', this, false);
    this.touchAdapter = TouchAdapter;
    switch (Utils.MozBuildApp) {
      case 'mobile/android':
        Services.obs.addObserver(this, 'Accessibility:Settings', false);
        Cc['@mozilla.org/android/bridge;1'].
          getService(Ci.nsIAndroidBridge).handleGeckoMessage(
            JSON.stringify({ gecko: { type: 'Accessibility:Ready' } }));
        this.touchAdapter = AndroidTouchAdapter;
        break;
      case 'b2g':
        aWindow.addEventListener(
          'ContentStart',
          (function(event) {
             let content = aWindow.shell.contentBrowser.contentWindow;
             content.addEventListener('mozContentEvent', this, false, true);
           }).bind(this), false);
        break;
      default:
        break;
    }
    try {
      this._activatePref = this.prefsBranch.getIntPref('activate');
    } catch (x) {
      this._activatePref = ACCESSFU_DISABLE;
    }
    this._enableOrDisable();
  }
function attach ( aWindow ) { if ( this . chromeWin ) throw new Error ( 'Only one window could be attached to AccessFu' ) ; Logger . info ( 'attach' ) ; this . chromeWin = aWindow ; this . prefsBranch = Cc [ '@mozilla.org/preferences-service;1' ] . getService ( Ci . nsIPrefService ) . getBranch ( 'accessibility.accessfu.' ) ; this . prefsBranch . addObserver ( 'activate' , this , false ) ; this . touchAdapter = TouchAdapter ; switch ( Utils . MozBuildApp ) { case 'mobile/android' : Services . obs . addObserver ( this , 'Accessibility:Settings' , false ) ; Cc [ '@mozilla.org/android/bridge;1' ] . getService ( Ci . nsIAndroidBridge ) . handleGeckoMessage ( JSON . stringify ( { gecko : { type : 'Accessibility:Ready' } } ) ) ; this . touchAdapter = AndroidTouchAdapter ; break ; case 'b2g' : aWindow . addEventListener ( 'ContentStart' , ( function ( event ) { let content = aWindow . shell . contentBrowser . contentWindow ; content . addEventListener ( 'mozContentEvent' , this , false , true ) ; } ) . bind ( this ) , false ) ; break ; default : break ; } try { this . _activatePref = this . prefsBranch . getIntPref ( 'activate' ) ; } catch ( x ) { this . _activatePref = ACCESSFU_DISABLE ; } this . _enableOrDisable ( ) ; }
Initialize chrome-layer accessibility functionality.
Initialize chrome - layer accessibility functionality .
// XXX: only supports attaching to one window now.