goog.userAgent.flash.init_ = function()

in asdoc/library/closure/goog/useragent/flash.js [55:120]


goog.userAgent.flash.init_ = function() {
  if (navigator.plugins && navigator.plugins.length) {
    var plugin = navigator.plugins['Shockwave Flash'];
    if (plugin) {
      goog.userAgent.flash.detectedFlash_ = true;
      if (plugin.description) {
        goog.userAgent.flash.detectedFlashVersion_ =
            goog.userAgent.flash.getVersion_(plugin.description);
        return;
      }
    }

    if (navigator.plugins['Shockwave Flash 2.0']) {
      goog.userAgent.flash.detectedFlash_ = true;
      goog.userAgent.flash.detectedFlashVersion_ = '2.0.0.11';
      return;
    }
  }

  if (navigator.mimeTypes && navigator.mimeTypes.length) {
    var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
    goog.userAgent.flash.detectedFlash_ =
        !!(mimeType && mimeType.enabledPlugin);
    if (goog.userAgent.flash.detectedFlash_) {
      goog.userAgent.flash.detectedFlashVersion_ =
          goog.userAgent.flash.getVersion_(mimeType.enabledPlugin.description);
      return;
    }
  }


  try {
    // Try 7 first, since we know we can use GetVariable with it
    var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
    goog.userAgent.flash.detectedFlash_ = true;
    goog.userAgent.flash.detectedFlashVersion_ =
        goog.userAgent.flash.getVersion_(ax.GetVariable('$version'));
    return;
  } catch (e) {
    /* Fall through */
  }

  // Try 6 next, some versions are known to crash with GetVariable calls

  try {
    var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
    goog.userAgent.flash.detectedFlash_ = true;
    // First public version of Flash 6
    goog.userAgent.flash.detectedFlashVersion_ = '6.0.21';
    return;
  } catch (e) {
    /* Fall through */
  }


  try {
    // Try the default activeX
    var ax = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
    goog.userAgent.flash.detectedFlash_ = true;
    goog.userAgent.flash.detectedFlashVersion_ =
        goog.userAgent.flash.getVersion_(ax.GetVariable('$version'));
    return;
  } catch (e) {
    // No flash
  }
};