Forward webview visibility change events from browser process

This commit is contained in:
Kevin Sawicki 2017-02-24 10:18:09 -08:00
parent 7564a9973b
commit 1d84d83fd4
4 changed files with 16 additions and 10 deletions

View file

@ -33,11 +33,6 @@ class WebViewImpl {
this.setupFocusPropagation()
this.viewInstanceId = getNextId()
shadowRoot.appendChild(this.browserPluginNode)
// Forward window visibility changes to guest contents
this.onVisibilityChanged = (event, visibilityState) => {
this.webviewNode.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', visibilityState)
}
}
createBrowserPluginNode () {
@ -50,8 +45,6 @@ class WebViewImpl {
// Resets some state upon reattaching <webview> element to the DOM.
reset () {
ipcRenderer.removeListener('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', this.onVisibilityChanged)
// If guestInstanceId is defined then the <webview> has navigated and has
// already picked up a partition ID. Thus, we need to reset the initialization
// state. However, it may be the case that beforeFirstNavigation is false BUT
@ -311,7 +304,6 @@ const registerWebViewElement = function () {
return
}
if (!internal.elementAttached) {
ipcRenderer.on('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', internal.onVisibilityChanged)
guestViewInternal.registerEvents(internal, internal.viewInstanceId)
internal.elementAttached = true
const instance = internal.attributes[webViewConstants.ATTRIBUTE_GUESTINSTANCE].getValue()