Fix browser plugin API changes
This commit is contained in:
parent
a9072049ea
commit
882a08f61a
9 changed files with 66 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
|||
ipc = require 'ipc'
|
||||
webFrame = require 'web-frame'
|
||||
|
||||
requestId = 0
|
||||
|
||||
|
@ -36,7 +37,12 @@ module.exports =
|
|||
createGuest: (type, params, callback) ->
|
||||
requestId++
|
||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_CREATE_GUEST', type, params, requestId
|
||||
ipc.on "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
||||
ipc.once "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
||||
|
||||
attachGuest: (elementInstanceId, guestInstanceId, params, callback) ->
|
||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_ATTACH_GUEST', elementInstanceId, guestInstanceId, params
|
||||
ipc.once "ATOM_SHELL_RESPONSE_#{requestId}", callback
|
||||
webFrame.attachGuest elementInstanceId
|
||||
|
||||
destroyGuest: (guestInstanceId) ->
|
||||
ipc.send 'ATOM_SHELL_GUEST_VIEW_MANAGER_DESTROY_GUEST', guestInstanceId
|
||||
|
|
0
atom/renderer/lib/web-view/web-view-constants.coffee
Normal file
0
atom/renderer/lib/web-view/web-view-constants.coffee
Normal file
|
@ -7,10 +7,6 @@ remote = require 'remote'
|
|||
nextId = 0
|
||||
getNextId = -> ++nextId
|
||||
|
||||
# FIXME
|
||||
# Discarded after Chrome 39
|
||||
PLUGIN_METHOD_ATTACH = '-internal-attach'
|
||||
|
||||
# Attributes.
|
||||
WEB_VIEW_ATTRIBUTE_ALLOWTRANSPARENCY = 'allowtransparency'
|
||||
WEB_VIEW_ATTRIBUTE_AUTOSIZE = 'autosize'
|
||||
|
@ -103,6 +99,8 @@ class WebView
|
|||
@setupWebviewNodeProperties()
|
||||
|
||||
@viewInstanceId = getNextId()
|
||||
|
||||
# UPSTREAM: new WebViewEvents(this, this.viewInstanceId);
|
||||
guestViewInternal.registerEvents this, @viewInstanceId
|
||||
|
||||
shadowRoot.appendChild @browserPluginNode
|
||||
|
@ -126,6 +124,7 @@ class WebView
|
|||
# heard back from createGuest yet. We will not reset the flag in this case so
|
||||
# that we don't end up allocating a second guest.
|
||||
if @guestInstanceId
|
||||
# FIXME
|
||||
guestViewInternal.destroyGuest @guestInstanceId
|
||||
@guestInstanceId = undefined
|
||||
@beforeFirstNavigation = true
|
||||
|
@ -295,23 +294,14 @@ class WebView
|
|||
@partition.fromAttribute newValue, @hasNavigated()
|
||||
|
||||
handleBrowserPluginAttributeMutation: (name, oldValue, newValue) ->
|
||||
# FIXME
|
||||
# internalbindings => internalInstanceid after Chrome 39
|
||||
if name is 'internalbindings' and !oldValue and !!newValue
|
||||
@browserPluginNode.removeAttribute 'internalbindings'
|
||||
# FIXME
|
||||
# @internalInstanceId = parseInt newValue
|
||||
if name is 'internalinstanceid' and !oldValue and !!newValue
|
||||
@browserPluginNode.removeAttribute 'internalinstanceid'
|
||||
@internalInstanceId = parseInt newValue
|
||||
|
||||
if !!@guestInstanceId and @guestInstanceId != 0
|
||||
isNewWindow = if @deferredAttachState then @deferredAttachState.isNewWindow else false
|
||||
params = @buildAttachParams isNewWindow
|
||||
# FIXME
|
||||
# guestViewInternalNatives.AttachGuest
|
||||
# @internalInstanceId,
|
||||
# @guestInstanceId,
|
||||
# params,
|
||||
# (w) => @contentWindow = w
|
||||
@browserPluginNode[PLUGIN_METHOD_ATTACH] @guestInstanceId, params
|
||||
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, params, (w) => @contentWindow = w
|
||||
|
||||
onSizeChanged: (webViewEvent) ->
|
||||
newWidth = webViewEvent.newWidth
|
||||
|
@ -363,9 +353,7 @@ class WebView
|
|||
|
||||
# Returns if <object> is in the render tree.
|
||||
isPluginInRenderTree: ->
|
||||
# FIXME
|
||||
# !!@internalInstanceId && @internalInstanceId != 0
|
||||
'function' == typeof this.browserPluginNode[PLUGIN_METHOD_ATTACH]
|
||||
!!@internalInstanceId && @internalInstanceId != 0
|
||||
|
||||
hasNavigated: ->
|
||||
not @beforeFirstNavigation
|
||||
|
@ -480,9 +468,7 @@ class WebView
|
|||
return true
|
||||
|
||||
@deferredAttachState = null
|
||||
# FIXME
|
||||
# guestViewInternalNatives.AttachGuest @internalInstanceId, @guestInstanceId, params, (w) => @contentWindow = w
|
||||
@browserPluginNode[PLUGIN_METHOD_ATTACH] @guestInstanceId, params
|
||||
guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, params, (w) => @contentWindow = w
|
||||
|
||||
# Registers browser plugin <object> custom element.
|
||||
registerBrowserPluginElement = ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue