lib/browser/chrome-extension.js
function (webContents) {
  const tabId = webContents.id

  sendToBackgroundPages('CHROME_TABS_ONCREATED')

  webContents.on('will-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.on('did-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONCOMPLETED', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.once('destroyed', () => {
    sendToBackgroundPages('CHROME_TABS_ONREMOVED', tabId)
  })
}
function (webContents) {
  const tabId = webContents.id

  sendToBackgroundPages('CHROME_TABS_ONCREATED')

  webContents.on('will-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONBEFORENAVIGATE', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.on('did-navigate', (event, url) => {
    sendToBackgroundPages('CHROME_WEBNAVIGATION_ONCOMPLETED', {
      frameId: 0,
      parentFrameId: -1,
      processId: webContents.getProcessId(),
      tabId: tabId,
      timeStamp: Date.now(),
      url: url
    })
  })

  webContents.once('destroyed', () => {
    sendToBackgroundPages('CHROME_TABS_ONREMOVED', tabId)
  })
}
function ( webContents ) { const tabId = webContents . id sendToBackgroundPages ( 'CHROME_TABS_ONCREATED' ) webContents . on ( 'will-navigate' , ( event , url ) => { sendToBackgroundPages ( 'CHROME_WEBNAVIGATION_ONBEFORENAVIGATE' , { frameId : 0 , parentFrameId : - 1 , processId : webContents . getProcessId ( ) , tabId : tabId , timeStamp : Date . now ( ) , url : url } ) } ) webContents . on ( 'did-navigate' , ( event , url ) => { sendToBackgroundPages ( 'CHROME_WEBNAVIGATION_ONCOMPLETED' , { frameId : 0 , parentFrameId : - 1 , processId : webContents . getProcessId ( ) , tabId : tabId , timeStamp : Date . now ( ) , url : url } ) } ) webContents . once ( 'destroyed' , ( ) => { sendToBackgroundPages ( 'CHROME_TABS_ONREMOVED' , tabId ) } ) }
Dispatch web contents events to Chrome APIs
Dispatch web contents events to Chrome APIs