diff --git a/app/renderer/components/main/main.js b/app/renderer/components/main/main.js index 258f3a548cc..4b215c8a0f6 100644 --- a/app/renderer/components/main/main.js +++ b/app/renderer/components/main/main.js @@ -68,7 +68,7 @@ const siteSettings = require('../../../../js/state/siteSettings') const debounce = require('../../../../js/lib/debounce') const {isSourceAboutUrl} = require('../../../../js/lib/appUrlUtil') const {getCurrentWindowId, isMaximized, isFocused, isFullScreen} = require('../../currentWindow') -const {isDarwin, isWindows} = require('../../../common/lib/platformUtil') +const {isDarwin, isWindows, isLinux} = require('../../../common/lib/platformUtil') class Main extends ImmutableComponent { constructor () { @@ -78,7 +78,6 @@ class Main extends ImmutableComponent { this.onHideSiteInfo = this.onHideSiteInfo.bind(this) this.onHideBraveryPanel = this.onHideBraveryPanel.bind(this) this.onHideClearBrowsingDataPanel = this.onHideClearBrowsingDataPanel.bind(this) - this.onHideWidevinePanel = this.onHideWidevinePanel.bind(this) this.onHideAutofillAddressPanel = this.onHideAutofillAddressPanel.bind(this) this.onHideAutofillCreditCardPanel = this.onHideAutofillCreditCardPanel.bind(this) this.onHideReleaseNotes = this.onHideReleaseNotes.bind(this) @@ -539,12 +538,6 @@ class Main extends ImmutableComponent { windowActions.setClearBrowsingDataPanelVisible(false) } - onHideWidevinePanel () { - windowActions.widevinePanelDetailChanged({ - shown: false - }) - } - onHideAutofillAddressPanel () { windowActions.setAutofillAddressDetail() } @@ -661,7 +654,7 @@ class Main extends ImmutableComponent { this.props.windowState.get('braveryPanelDetail') const clearBrowsingDataPanelIsVisible = this.props.windowState.getIn(['ui', 'isClearBrowsingDataPanelVisible']) const importBrowserDataPanelIsVisible = this.props.windowState.get('importBrowserDataDetail') - const widevinePanelIsVisible = this.props.windowState.getIn(['widevinePanelDetail', 'shown']) + const widevinePanelIsVisible = this.props.windowState.getIn(['widevinePanelDetail', 'shown']) && !isLinux() const autofillAddressPanelIsVisible = this.props.windowState.get('autofillAddressDetail') const autofillCreditCardPanelIsVisible = this.props.windowState.get('autofillCreditCardDetail') const noScriptIsVisible = this.props.windowState.getIn(['ui', 'noScriptInfo', 'isVisible']) && @@ -732,8 +725,7 @@ class Main extends ImmutableComponent { { widevinePanelIsVisible ? : null } diff --git a/app/renderer/components/main/widevinePanel.js b/app/renderer/components/main/widevinePanel.js index 35ee6ede896..23f47b75150 100644 --- a/app/renderer/components/main/widevinePanel.js +++ b/app/renderer/components/main/widevinePanel.js @@ -6,7 +6,7 @@ const React = require('react') 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') const WidevineInfo = require('./widevineInfo') @@ -32,31 +32,44 @@ const siteUtil = require('../../../../js/state/siteUtil') // Styles const commonStyles = require('../styles/commonStyles') -class WidevinePanel extends ImmutableComponent { - constructor () { - super() +class WidevinePanel extends React.Component { + constructor (props) { + super(props) this.onInstallAndAllow = this.onInstallAndAllow.bind(this) this.onClickRememberForNetflix = this.onClickRememberForNetflix.bind(this) } - get origin () { - return siteUtil.getOrigin(this.props.widevinePanelDetail.get('location')) - } + onInstallAndAllow () { appActions.setResourceEnabled(appConfig.resourceNames.WIDEVINE, true) - this.props.onHide() + this.onHide() // The site permissions that is set if this.props.widevinePanelDetail.get('alsoAddRememberSiteSetting') is handled once the resource is ready // in main.js. This is so that the reload doesn't happen until it is ready. } + onClickRememberForNetflix (e) { windowActions.widevinePanelDetailChanged({ alsoAddRememberSiteSetting: e.target.value }) } + + onHide () { + windowActions.widevinePanelDetailChanged({ + shown: false + }) + } + + mergeProps (state, ownProps) { + const currentWindow = state.get('currentWindow') + const widevinePanelDetail = currentWindow.get('widevinePanelDetail') + + const props = {} + props.origin = siteUtil.getOrigin(widevinePanelDetail.get('location')) + props.alsoAddRememberSiteSetting = widevinePanelDetail.get('alsoAddRememberSiteSetting') + + return props + } + render () { - const isLinux = process.platform === 'linux' - if (isLinux) { - return null - } /* Removed 'isClickDismiss' from Dialog. Installing Widevine influences globally, not specific to a tab, @@ -64,7 +77,7 @@ class WidevinePanel extends ImmutableComponent { the third party software which we discourage from using is going to be installed on the computer. */ - return + return e.stopPropagation()}> @@ -74,7 +87,7 @@ class WidevinePanel extends ImmutableComponent {