<commit_before>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

<include src="../uber/uber_utils.js">
<include src="more_info_overlay.js">

cr.define('help', function() {
  var localStrings = new LocalStrings();

  /**
   * Encapsulated handling of the help page.
   */
  function HelpPage() {}

  cr.addSingletonGetter(HelpPage);

  HelpPage.prototype = {
    __proto__: HTMLDivElement.prototype,

    /**
     * Perform initial setup.
     */
    initialize: function() {
      uber.onContentFrameLoaded();

      // Set the title.
      var title = localStrings.getString('helpTitle');
      uber.invokeMethodOnParent('setTitle', {title: title});

      $('product-license').innerHTML = localStrings.getString('productLicense');

      var productTOS = $('product-tos');
      if (productTOS)
        productTOS.innerHTML = localStrings.getString('productTOS');

      var moreInfoOverlay = help.MoreInfoOverlay.getInstance();
      moreInfoOverlay.initializePage();

      var self = this;
      var moreInfo = $('more-info');
      if (moreInfo) {
        moreInfo.onclick = function() {
          self.showOverlay_($('more-info-overlay'));
        };
      }

      var reportIssue = $('report-issue');
      if (reportIssue)
        reportIssue.onclick = this.reportAnIssue_.bind(this);

      var promote = $('promote');
      if (promote) {
        promote.onclick = function() {
          chrome.send('promoteUpdater');
        };
      }

      var relaunch = $('relaunch');
      if (relaunch) {
        relaunch.onclick = function() {
          chrome.send('relaunchNow');
        };
      }

      // Attempt to update.
      chrome.send('onPageLoaded');
    },

    /**
     * @private
     */
    reportAnIssue_: function() {
      chrome.send('openFeedbackDialog');
    },

    /**
     * @private
     */
    setUpdateImage_: function(state) {
      $('update-status-icon').className = 'update-icon ' + state;
    },

    /**
     * @private
     */
    setUpdateStatus_: function(status, message) {
      if (status == 'checking') {
        this.setUpdateImage_('working');
        $('update-status').innerHTML =
            localStrings.getString('updateCheckStarted');
      } else if (status == 'updating') {
        this.setUpdateImage_('working');
        $('update-status').innerHTML = localStrings.getString('updating');
      } else if (status == 'nearly_updated') {
        this.setUpdateImage_('up-to-date');
        $('update-status').innerHTML =
            localStrings.getString('updateAlmostDone');
      } else if (status == 'updated') {
        this.setUpdateImage_('up-to-date');
        $('update-status').innerHTML = localStrings.getString('upToDate');
      } else if (status == 'failed') {
        this.setUpdateImage_('failed');
        $('update-status').innerHTML = message;
      } else if (status == 'disabled') {
        $('update-status-container').hidden = true;
        return;
      }

      if (!cr.isMac)
        $('update-percentage').hidden = status != 'updating';

      $('relaunch').hidden = status != 'nearly_updated';
    },

    /**
     * @private
     */
    setProgress_: function(progress) {
      $('update-percentage').innerHTML = progress + "%";
    },

    /**
     * @private
     */
    setPromotionState_: function(state) {<commit_msg>[uber page] Eliminate js exception on Chromium builds.<commit_after>// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

<include src="../uber/uber_utils.js">
<include src="more_info_overlay.js">

cr.define('help', function() {
  var localStrings = new LocalStrings();

  /**
   * Encapsulated handling of the help page.
   */
  function HelpPage() {}

  cr.addSingletonGetter(HelpPage);

  HelpPage.prototype = {
    __proto__: HTMLDivElement.prototype,

    /**
     * Perform initial setup.
     */
    initialize: function() {
      uber.onContentFrameLoaded();

      // Set the title.
      var title = localStrings.getString('helpTitle');
      uber.invokeMethodOnParent('setTitle', {title: title});

      $('product-license').innerHTML = localStrings.getString('productLicense');

      var productTOS = $('product-tos');
      if (productTOS)
        productTOS.innerHTML = localStrings.getString('productTOS');

      var moreInfoOverlay = help.MoreInfoOverlay.getInstance();
      moreInfoOverlay.initializePage();

      var self = this;
      var moreInfo = $('more-info');
      if (moreInfo) {
        moreInfo.onclick = function() {
          self.showOverlay_($('more-info-overlay'));
        };
      }

      var reportIssue = $('report-issue');
      if (reportIssue)
        reportIssue.onclick = this.reportAnIssue_.bind(this);

      var promote = $('promote');
      if (promote) {
        promote.onclick = function() {
          chrome.send('promoteUpdater');
        };
      }

      var relaunch = $('relaunch');
      if (relaunch) {
        relaunch.onclick = function() {
          chrome.send('relaunchNow');
        };
      }

      // Attempt to update.
      chrome.send('onPageLoaded');
    },

    /**
     * @private
     */
    reportAnIssue_: function() {
      chrome.send('openFeedbackDialog');
    },

    /**
     * @private
     */
    setUpdateImage_: function(state) {
      $('update-status-icon').className = 'update-icon ' + state;
    },

    /**
     * @private
     */
    setUpdateStatus_: function(status, message) {
      if (status == 'checking') {
        this.setUpdateImage_('working');
        $('update-status').innerHTML =
            localStrings.getString('updateCheckStarted');
      } else if (status == 'updating') {
        this.setUpdateImage_('working');
        $('update-status').innerHTML = localStrings.getString('updating');
      } else if (status == 'nearly_updated') {
        this.setUpdateImage_('up-to-date');
        $('update-status').innerHTML =
            localStrings.getString('updateAlmostDone');
      } else if (status == 'updated') {
        this.setUpdateImage_('up-to-date');
        $('update-status').innerHTML = localStrings.getString('upToDate');
      } else if (status == 'failed') {
        this.setUpdateImage_('failed');
        $('update-status').innerHTML = message;
      } else if (status == 'disabled') {
        var container = $('update-status-container');
        if (container)
          container.hidden = true;
        return;
      }

      if (!cr.isMac)
        $('update-percentage').hidden = status != 'updating';

      $('relaunch').hidden = status != 'nearly_updated';
    },

    /**
     * @private
     */
    setProgress_: function(progress) {
      $('update-percentage').innerHTML = progress + "%";
    },

    /**
     * @private
     */
    setPromotionState_: function(state) {
{'fraction_non_alphanumeric': 0.1542331464711801, 'fraction_numerical': 0.001149920942935173, 'mean_word_length': 2.4394463667820068, 'pattern_counts': {'":': 0, '<': 7, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3382757', 'n_tokens_mistral': 2065, 'n_tokens_neox': 1979, 'n_words': 388}