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

Commit

Permalink
Converts Main into redux component
Browse files Browse the repository at this point in the history
Resolves #9452

Auditors: @bbondy @bridiver @bsclifton

Test Plan:
  • Loading branch information
NejcZdovc committed Jun 24, 2017
1 parent 4f4a0b9 commit b36cd12
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 223 deletions.
2 changes: 1 addition & 1 deletion app/browser/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ const doAction = (action) => {
switch (action.actionType) {
case windowConstants.WINDOW_SET_FOCUSED_FRAME:
// Update the checkbox next to "Bookmark Page" (Bookmarks menu)
currentLocation = action.frameProps.get('location')
currentLocation = action.location
setMenuItemChecked(locale.translation('bookmarkPage'), isCurrentLocationBookmarked())
break
case appConstants.APP_CHANGE_SETTING:
Expand Down
20 changes: 10 additions & 10 deletions app/renderer/components/frame/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ class Frame extends React.Component {
}
}

onPropsChanged (prevProps = {}) {
onPropsChanged () {
if (this.props.isActive && isFocused()) {
windowActions.setFocusedFrame(this.frame)
windowActions.setFocusedFrame(this.props.location, this.props.tabId)
}
}

Expand Down Expand Up @@ -270,7 +270,7 @@ class Frame extends React.Component {
this.lastFrame = this.frame.delete('lastAccessedTime')

const cb = (prevProps = {}) => {
this.onPropsChanged(prevProps)
this.onPropsChanged()
if (this.props.isActive && !prevProps.isActive && !this.props.urlBarFocused) {
this.webview.focus()
}
Expand Down Expand Up @@ -469,7 +469,7 @@ class Frame extends React.Component {
return
}
if (e.details[0] === 'javascript' && e.details[1]) {
windowActions.setBlockedBy(this.frame, 'noScript', e.details[1])
windowActions.setBlockedBy(this.props.frameKey, 'noScript', e.details[1])
}
if (e.details[0] === 'autoplay') {
appActions.autoplayBlocked(this.props.tabId)
Expand Down Expand Up @@ -550,7 +550,7 @@ class Frame extends React.Component {
}
method = (detail) => {
const description = [detail.type, detail.scriptUrl || this.props.provisionalLocation].join(': ')
windowActions.setBlockedBy(this.frame, 'fingerprintingProtection', description)
windowActions.setBlockedBy(this.props.frameKey, 'fingerprintingProtection', description)
}
break
case messages.THEME_COLOR_COMPUTED:
Expand Down Expand Up @@ -648,7 +648,7 @@ class Frame extends React.Component {

if (url.startsWith(pdfjsOrigin)) {
let displayLocation = UrlUtil.getLocationIfPDF(url)
windowActions.setSecurityState(this.frame, {
windowActions.setSecurityState(this.props.frameKey, {
secure: urlParse(displayLocation).protocol === 'https:',
runInsecureContent: false
})
Expand Down Expand Up @@ -714,7 +714,7 @@ class Frame extends React.Component {
// connection.
isSecure = 1
}
windowActions.setSecurityState(this.frame, {
windowActions.setSecurityState(this.props.frameKey, {
secure: runInsecureContent ? false : isSecure,
runInsecureContent
})
Expand Down Expand Up @@ -786,15 +786,15 @@ class Frame extends React.Component {
if (this.frame.isEmpty()) {
return
}
windowActions.setFullScreen(this.frame, true, true)
windowActions.setFullScreen(this.props.frameKey, true, true)
// disable the fullscreen warning after 5 seconds
setTimeout(windowActions.setFullScreen.bind(this, this.frame, undefined, false), 5000)
setTimeout(windowActions.setFullScreen.bind(this, this.props.frameKey, undefined, false), 5000)
})
this.webview.addEventListener('leave-html-full-screen', () => {
if (this.frame.isEmpty()) {
return
}
windowActions.setFullScreen(this.frame, false)
windowActions.setFullScreen(this.props.frameKey, false)
})
this.webview.addEventListener('media-started-playing', ({title}) => {
if (this.frame.isEmpty()) {
Expand Down
Loading

0 comments on commit b36cd12

Please sign in to comment.