__onStateChange(state) {
    if (state != this.state) {
      if (this.state === State.PRESENTING || this.state === State.PRESENTING_FULLSCREEN) {
        this.emit('exit');
      }
      this.state = state;

      switch (state) {
        case State.READY_TO_PRESENT:
          this.show();
          this.setTitle(this.options.textEnterVRTitle);
          if (this.manager.defaultDisplay) {
            this.setTooltip('Enter VR using ' + this.manager.defaultDisplay.displayName);
          }
          this.__setDisabledAttribute(false);
          this.emit('ready');
          break;

        case State.PRESENTING:
        case State.PRESENTING_FULLSCREEN:
          if (!this.manager.defaultDisplay ||
            !this.manager.defaultDisplay.capabilities.hasExternalDisplay ||
            state == State.PRESENTING_FULLSCREEN) {
            this.hide();
          }
          this.setTitle(this.options.textExitVRTitle);
          this.__setDisabledAttribute(false);
          this.emit('enter');
          break;

        // Error states
        case State.ERROR_BROWSER_NOT_SUPPORTED:
          this.show();
          this.setTitle(this.options.textVRNotFoundTitle);
          this.setTooltip('Browser not supported');
          this.__setDisabledAttribute(true);
          this.emit('error', new Error(state));
          break;

        case State.ERROR_NO_PRESENTABLE_DISPLAYS:
          this.show();
          this.setTitle(this.options.textVRNotFoundTitle);
          this.setTooltip('No VR headset found.');
          this.__setDisabledAttribute(true);
          this.emit('error', new Error(state));
          break;

        case State.ERROR_REQUEST_TO_PRESENT_REJECTED:
          this.show();
          this.setTitle(this.options.textVRNotFoundTitle);
          this.setTooltip('Something went wrong trying to start presenting to your headset.');
          this.__setDisabledAttribute(true);
          this.emit('error', new Error(state));
          break;

        case State.ERROR_EXIT_PRESENT_REJECTED:
        default:
          this.show();
          this.setTitle(this.options.textVRNotFoundTitle);
          this.setTooltip('Unknown error.');
          this.__setDisabledAttribute(true);
          this.emit('error', new Error(state));
      }
    }
  }
@param {State} state the state that its transitioning to
@private