<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const ImmutableComponent = require('../../../js/components/immutableComponent')
const windowActions = require('../../../js/actions/windowActions')
const cx = require('../../../js/lib/classSet')
const dragTypes = require('../../../js/constants/dragTypes')
const dndData = require('../../../js/dndData')
const {isSourceAboutUrl} = require('../../../js/lib/appUrlUtil')
const searchIconSize = 16

class UrlBarIcon extends ImmutableComponent {
  constructor () {
    super()
    this.onClick = this.onClick.bind(this)
    this.onDragStart = this.onDragStart.bind(this)
  }
  get isSecure () {
    return this.props.isHTTPPage &&
           this.props.isSecure &&
           !this.props.active
  }
  /**
   * insecure icon does not show when:
   * - loading
   * - in title mode
   * - urlbar is active (ex: you can type)
   */
  get isInsecure () {
    return this.props.isHTTPPage &&
           this.props.isSecure === false &&
           !this.props.active
  }
  /**
   * search icon:
   * - does not show when loading
   * - does not show when in title mode
   * - shows when urlbar is active (ex: you can type)
   * - is a catch-all for: about pages, files, etc
   */
  get isSearch () {
    const showSearch = this.props.active &&
                       this.props.loading === false

    const defaultToSearch = (!this.isSecure && !this.isInsecure && !showSearch) &&
                            !this.props.titleMode &&
                            this.props.loading === false &&
                            !this.isAboutPage

    return showSearch || defaultToSearch
  }
  get isAboutPage () {
    return isSourceAboutUrl(this.props.location) &&
      this.props.location !== 'about:newtab'
  }
  get iconClasses () {
    if (this.props.activateSearchEngine) {
      return cx({urlbarIcon: true})
    }

    return cx({
      urlbarIcon: true,
      'fa': true,<commit_msg>allow search icon to show while loading (#6532)<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

const React = require('react')
const ImmutableComponent = require('../../../js/components/immutableComponent')
const windowActions = require('../../../js/actions/windowActions')
const cx = require('../../../js/lib/classSet')
const dragTypes = require('../../../js/constants/dragTypes')
const dndData = require('../../../js/dndData')
const {isSourceAboutUrl} = require('../../../js/lib/appUrlUtil')
const searchIconSize = 16

class UrlBarIcon extends ImmutableComponent {
  constructor () {
    super()
    this.onClick = this.onClick.bind(this)
    this.onDragStart = this.onDragStart.bind(this)
  }
  get isSecure () {
    return this.props.isHTTPPage &&
           this.props.isSecure &&
           !this.props.active
  }
  /**
   * insecure icon does not show when:
   * - loading
   * - in title mode
   * - urlbar is active (ex: you can type)
   */
  get isInsecure () {
    return this.props.isHTTPPage &&
           this.props.isSecure === false &&
           !this.props.active
  }
  /**
   * search icon:
   * - does not show when in title mode
   * - shows when urlbar is active (ex: you can type)
   * - is a catch-all for: about pages, files, etc
   */
  get isSearch () {
    const showSearch = this.props.active

    const defaultToSearch = (!this.isSecure && !this.isInsecure && !showSearch) &&
                            !this.props.titleMode &&
                            !this.isAboutPage

    return showSearch || defaultToSearch
  }
  get isAboutPage () {
    return isSourceAboutUrl(this.props.location) &&
      this.props.location !== 'about:newtab'
  }
  get iconClasses () {
    if (this.props.activateSearchEngine) {
      return cx({urlbarIcon: true})
    }

    return cx({
      urlbarIcon: true,
      'fa': true,
{'fraction_non_alphanumeric': 0.1418216960618507, 'fraction_numerical': 0.003865668035757429, 'mean_word_length': 2.344103392568659, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2871935', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1239, 'n_words': 333}