<commit_before>// Copyright 2011 Google Inc. All Rights Reserved.

/**
 * @fileoverview This file provides a BrowserChecker Javascript class.
 * Users can create a BrowserChecker object, invoke checkBrowser(|version|),
 * and then use getIsValidBrowser() and getBrowserSupportMessage()
 * to determine if the browser version is greater than |version|
 * and if the Native Client plugin is found.
 */

// Create a namespace object
var browser_version = browser_version || {}


/**
 * Class to provide checking for version and NativeClient.
 * @param {integer} arg1 An argument that indicates major version of Chrome we
 *     require, such as 10.
 */

/**
 * Constructor for the BrowserChecker.  Sets the major version of
 * Chrome that is required to |requiredChromeVersion|.
 * @param requiredChromeVersion   The major version of chrome that
 *     is required.  If the Chrome browser version is less than
 *     |requiredChromeVersion| then |isValidBrowswer| will be set to false.
 * @param appVersion  The application version string.
 * @param plugins     The plugins that exist in the browser.
 * @constructor
 */
browser_version.BrowserChecker = function(requiredChromeVersion, appVersion,
                                          plugins) {

  /**
   * Version specified by the user. This class looks to see if the browser
   * version is >= |requiredChromeVersion_|.
   * @type {integer}
   * @private
   */
  this.requiredChromeVersion_ = requiredChromeVersion;

  /**
   * List of Browser plugin objects.
   * @type {Ojbect array}
   * @private
   */
  this.plugins_ = plugins;

  /**
   * Application version string from the Browser.
   * @type {integer}
   * @private
   */
  this.appVersion_ = appVersion;


  /**
   * Flag used to indicate if the browser has Native Client and is if the
   * browser version is recent enough.
   * @type {boolean}
   * @private
   */
  this.isValidBrowser_ = false;

  /**
   * Actual major version of Chrome -- found by querying the browser.
   * @type {integer}
   * @private
   */
  this.chromeVersion_ = null;

  /**
   * Message generated if Native Client is found and if 
   * there is not a version problem.
   * @type {string}
   * @private
   */
  this.browserSupportMessage_ = 'Unable to detect browser and/or'
                                + ' Native Client support.<br>';

  /**
   * Browser support status. This allows the user to get a detailed status
   * rather than using this.browserSupportMessage.
   */
  this.browserSupportStatus_ =
      browser_version.BrowserChecker.StatusValues.UNKNOWN;
}

/**
 * The values used for BrowserChecker status to indicate success or
 * a specific error. This can be used instead of this.browserSupportMessage_.
 * @enum {id}
 */
browser_version.BrowserChecker.StatusValues = {
  UNKNOWN: 0,  
  NACL_ENABLED: 1,
  NON_CHROME_BROWSER: 2,
  CHROME_VERSION_TOO_OLD: 3,
  NACL_NOT_ENABLED: 4,
  NOT_USING_SERVER: 5,
};

/**
 * Determines if the plugin with name |name| exists in the browser.
 * @param {string} name The name of the plugin.
 * @param {Object array} plugins The plugins in this browser.<commit_msg>Fix IE loading issue. Review URL: http://codereview.chromium.org/6460035<commit_after>// Copyright 2011 Google Inc. All Rights Reserved.

/**
 * @fileoverview This file provides a BrowserChecker Javascript class.
 * Users can create a BrowserChecker object, invoke checkBrowser(|version|),
 * and then use getIsValidBrowser() and getBrowserSupportMessage()
 * to determine if the browser version is greater than |version|
 * and if the Native Client plugin is found.
 */

// Create a namespace object
var browser_version = browser_version || {}


/**
 * Class to provide checking for version and NativeClient.
 * @param {integer} arg1 An argument that indicates major version of Chrome we
 *     require, such as 10.
 */

/**
 * Constructor for the BrowserChecker.  Sets the major version of
 * Chrome that is required to |requiredChromeVersion|.
 * @param requiredChromeVersion   The major version of chrome that
 *     is required.  If the Chrome browser version is less than
 *     |requiredChromeVersion| then |isValidBrowswer| will be set to false.
 * @param appVersion  The application version string.
 * @param plugins     The plugins that exist in the browser.
 * @constructor
 */
browser_version.BrowserChecker = function(requiredChromeVersion, appVersion,
                                          plugins) {

  /**
   * Version specified by the user. This class looks to see if the browser
   * version is >= |requiredChromeVersion_|.
   * @type {integer}
   * @private
   */
  this.requiredChromeVersion_ = requiredChromeVersion;

  /**
   * List of Browser plugin objects.
   * @type {Ojbect array}
   * @private
   */
  this.plugins_ = plugins;

  /**
   * Application version string from the Browser.
   * @type {integer}
   * @private
   */
  this.appVersion_ = appVersion;


  /**
   * Flag used to indicate if the browser has Native Client and is if the
   * browser version is recent enough.
   * @type {boolean}
   * @private
   */
  this.isValidBrowser_ = false;

  /**
   * Actual major version of Chrome -- found by querying the browser.
   * @type {integer}
   * @private
   */
  this.chromeVersion_ = null;

  /**
   * Message generated if Native Client is found and if 
   * there is not a version problem.
   * @type {string}
   * @private
   */
  this.browserSupportMessage_ = 'Unable to detect browser and/or'
                                + ' Native Client support.<br>';

  /**
   * Browser support status. This allows the user to get a detailed status
   * rather than using this.browserSupportMessage.
   */
  this.browserSupportStatus_ =
      browser_version.BrowserChecker.StatusValues.UNKNOWN;
}

/**
 * The values used for BrowserChecker status to indicate success or
 * a specific error. This can be used instead of this.browserSupportMessage_.
 * @enum {id}
 */
browser_version.BrowserChecker.StatusValues = {
  UNKNOWN: 0,  
  NACL_ENABLED: 1,
  NON_CHROME_BROWSER: 2,
  CHROME_VERSION_TOO_OLD: 3,
  NACL_NOT_ENABLED: 4,
  NOT_USING_SERVER: 5
};

/**
 * Determines if the plugin with name |name| exists in the browser.
 * @param {string} name The name of the plugin.
 * @param {Object array} plugins The plugins in this browser.
{'fraction_non_alphanumeric': 0.08704646721833227, 'fraction_numerical': 0.005251432208784214, 'mean_word_length': 3.0732339598185354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2325655', 'n_tokens_mistral': 1795, 'n_tokens_neox': 1734, 'n_words': 665}