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

Commit

Permalink
Fix merge problem with registering dispatcher
Browse files Browse the repository at this point in the history
Related to #10866 merge
  • Loading branch information
bbondy committed Sep 19, 2017
1 parent c7d38fe commit 1bf4cba
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/browser/reducers/windowsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const getSetting = require('../../../js/settings').getSetting
const {zoomLevel} = require('../../common/constants/toolbarUserInterfaceScale')
const platformUtil = require('../../common/lib/platformUtil')
const {initWindowCacheState} = require('../../sessionStoreShutdown')
const appDispatcher = require('../../../js/dispatcher/appDispatcher')

const isDarwin = platformUtil.isDarwin()
const isWindows = platformUtil.isWindows()
Expand Down Expand Up @@ -238,9 +239,9 @@ const createWindow = (state, action) => {
const toolbarUserInterfaceScale = getSetting(settings.TOOLBAR_UI_SCALE)

setImmediate(() => {
let mainWindow = new BrowserWindow(Object.assign(windowProps, browserOpts, {disposition: frameOpts.disposition}))
const win = new BrowserWindow(Object.assign(windowProps, browserOpts, {disposition: frameOpts.disposition}))
let restoredImmutableWindowState = action.get('restoredState')
initWindowCacheState(mainWindow.id, restoredImmutableWindowState)
initWindowCacheState(win.id, restoredImmutableWindowState)

// initialize frames state
let frames = Immutable.List()
Expand Down Expand Up @@ -269,17 +270,18 @@ const createWindow = (state, action) => {
}

if (isMaximized) {
mainWindow.maximize()
win.maximize()
}

mainWindow.webContents.on('did-finish-load', (e) => {
appDispatcher.registerWindow(win, win.webContents)
win.webContents.on('did-finish-load', (e) => {
const appStore = require('../../../js/stores/appStore')
mainWindow.webContents.setZoomLevel(zoomLevel[toolbarUserInterfaceScale] || 0.0)
win.webContents.setZoomLevel(zoomLevel[toolbarUserInterfaceScale] || 0.0)

const mem = muon.shared_memory.create({
windowValue: {
disposition: frameOpts.disposition,
id: mainWindow.id
id: win.id
},
appState: appStore.getLastEmittedState().toJS(),
frames: frames.toJS(),
Expand All @@ -291,11 +293,11 @@ const createWindow = (state, action) => {
}
})

mainWindow.on('ready-to-show', () => {
mainWindow.show()
win.on('ready-to-show', () => {
win.show()
})

mainWindow.loadURL(appUrlUtil.getBraveExtIndexHTML())
win.loadURL(appUrlUtil.getBraveExtIndexHTML())
})

return state
Expand Down

0 comments on commit 1bf4cba

Please sign in to comment.