From 10ec924f8b4fa7354eb5144e19ac0b7e616e8793 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Tue, 13 Jun 2017 09:07:49 +0200 Subject: [PATCH] Converts SiteInfo into redux component Resolves #9412 Auditors: @bsclifton @bridiver Test Plan: --- app/renderer/components/main/siteInfo.js | 37 +++++++++++++----------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/app/renderer/components/main/siteInfo.js b/app/renderer/components/main/siteInfo.js index f23bedaf4a5..274ba2ddc34 100644 --- a/app/renderer/components/main/siteInfo.js +++ b/app/renderer/components/main/siteInfo.js @@ -3,17 +3,17 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') -const PropTypes = require('prop-types') const {StyleSheet, css} = require('aphrodite/no-important') // Components -const ImmutableComponent = require('../immutableComponent') +const ReduxComponent = require('../reduxComponent') const Dialog = require('../common/dialog') const Button = require('../common/button') // Actions const appActions = require('../../../../js/actions/appActions') const webviewActions = require('../../../../js/actions/webviewActions') +const windowActions = require('../../../../js/actions/windowActions') // Utils const cx = require('../../../../js/lib/classSet') @@ -26,29 +26,37 @@ const platformUtil = require('../../../common/lib/platformUtil') const globalStyles = require('../styles/global') const commonStyles = require('../styles/commonStyles') -class SiteInfo extends ImmutableComponent { - constructor () { - super() +class SiteInfo extends React.Component { + constructor (props) { + super(props) this.onAllowRunInsecureContent = this.onAllowRunInsecureContent.bind(this) this.onDenyRunInsecureContent = this.onDenyRunInsecureContent.bind(this) this.onViewCertificate = this.onViewCertificate.bind(this) } + onAllowRunInsecureContent () { appActions.changeSiteSetting(siteUtil.getOrigin(this.location), 'runInsecureContent', true, this.isPrivate) appActions.loadURLRequested(this.props.frameProps.get('tabId'), this.location) - this.props.onHide() + this.onHide() } + onDenyRunInsecureContent () { appActions.removeSiteSetting(siteUtil.getOrigin(this.location), 'runInsecureContent', this.isPrivate) appActions.loadURLRequested(this.props.frameProps.get('tabId'), this.location) - this.props.onHide() + this.onHide() } + onViewCertificate () { - this.props.onHide() + this.onHide() webviewActions.showCertificate() } + + onHide () { + windowActions.setSiteInfoVisible(false) + } + get isExtendedValidation () { return this.props.frameProps.getIn(['security', 'isExtendedValidation']) } @@ -183,7 +191,7 @@ class SiteInfo extends ImmutableComponent {