Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Front end work of view certificate
Browse files Browse the repository at this point in the history
Hide view certificate button until muon support linux

fix #6157

Auditors: @bridiver, @bbondy
  • Loading branch information
darkdh committed Mar 13, 2017
1 parent 84e624a commit 399be44
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ dismissDenyRunInsecureContent=Stay Insecure
denyRunInsecureContent=Stop Loading Unsafe Scripts
runInsecureContentWarning=This page is trying to load scripts from insecure sources. If you allow this content to run, it may transmit unencrypted data to other sites.
denyRunInsecureContentWarning=Your connection is not private. This page is currently loading scripts from insecure sources.
viewCertificate=View Certificate
windowCaptionButtonMinimize=Minimize
windowCaptionButtonMaximize=Maximize
windowCaptionButtonRestore=Restore Down
Expand Down
10 changes: 10 additions & 0 deletions js/actions/webviewActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ const webviewActions = {
}
},

/**
* Shows the certificate infomation
*/
showCertificate: function () {
const webview = getWebview()
if (webview) {
webview.showCertificate()
}
},

/**
* Shows the definition of the selected text in a pop-up window (macOS only)
*/
Expand Down
19 changes: 19 additions & 0 deletions js/components/siteInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ const cx = require('../lib/classSet')
const Dialog = require('./dialog')
const Button = require('./button')
const appActions = require('../actions/appActions')
const webviewActions = require('../actions/webviewActions')
const messages = require('../constants/messages')
const siteUtil = require('../state/siteUtil')
const platformUtil = require('../../app/common/lib/platformUtil')

class SiteInfo extends ImmutableComponent {
constructor () {
super()
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),
Expand All @@ -30,6 +33,10 @@ class SiteInfo extends ImmutableComponent {
ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_LOAD_URL, {}, this.location)
this.props.onHide()
}
onViewCertificate () {
this.props.onHide()
webviewActions.showCertificate()
}
get isExtendedValidation () {
return this.props.frameProps.getIn(['security', 'isExtendedValidation'])
}
Expand Down Expand Up @@ -80,6 +87,12 @@ class SiteInfo extends ImmutableComponent {
}

let connectionInfo = null
let viewCertificateButton = null
// TODO(Anthony): Hide it until muon support linux
if (!platformUtil.isLinux()) {
viewCertificateButton =
<Button l10nId='viewCertificate' className='primaryButton viewCertificate' onClick={this.onViewCertificate} />
}
if (this.isBlockedRunInsecureContent) {
connectionInfo =
<li>
Expand All @@ -104,10 +117,16 @@ class SiteInfo extends ImmutableComponent {
</li>
} else if (this.isSecure === true) {
connectionInfo =
<div>
<div className='connectionInfo' data-l10n-id='secureConnectionInfo' />
{viewCertificateButton}
</div>
} else if (this.isSecure === 1) {
connectionInfo =
<div>
<div className='connectionInfo' data-l10n-id='partiallySecureConnectionInfo' />
{viewCertificateButton}
</div>
} else {
connectionInfo =
<div className='connectionInfo' data-l10n-id='insecureConnectionInfo' />
Expand Down

0 comments on commit 399be44

Please sign in to comment.