|
@@ -1,14 +1,14 @@
|
|
|
-import { app, ipcMain, session, deprecate } from 'electron';
|
|
|
-import type { MenuItem, MenuItemConstructorOptions, WebContentsInternal } from 'electron';
|
|
|
+import { app, ipcMain, session, deprecate } from 'electron/main';
|
|
|
+import type { MenuItem, MenuItemConstructorOptions } from 'electron/main';
|
|
|
|
|
|
import * as url from 'url';
|
|
|
import * as path from 'path';
|
|
|
-import { internalWindowOpen } from '../guest-window-manager';
|
|
|
-import { NavigationController } from '../navigation-controller';
|
|
|
-import { ipcMainInternal } from '../ipc-main-internal';
|
|
|
-import * as ipcMainUtils from '../ipc-main-internal-utils';
|
|
|
-import { parseFeatures } from '../../common/parse-features-string';
|
|
|
-import { MessagePortMain } from '../message-port-main';
|
|
|
+import { internalWindowOpen } from '@electron/internal/browser/guest-window-manager';
|
|
|
+import { NavigationController } from '@electron/internal/browser/navigation-controller';
|
|
|
+import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal';
|
|
|
+import * as ipcMainUtils from '@electron/internal/browser/ipc-main-internal-utils';
|
|
|
+import { parseFeatures } from '@electron/internal/common/parse-features-string';
|
|
|
+import { MessagePortMain } from '@electron/internal/browser/message-port-main';
|
|
|
import { EventEmitter } from 'events';
|
|
|
|
|
|
// session is not used here, the purpose is to make sure session is initalized
|
|
@@ -122,7 +122,7 @@ const defaultPrintingSetting = {
|
|
|
|
|
|
// JavaScript implementations of WebContents.
|
|
|
const binding = process._linkedBinding('electron_browser_web_contents');
|
|
|
-const { WebContents } = binding as { WebContents: { prototype: WebContentsInternal } };
|
|
|
+const { WebContents } = binding as { WebContents: { prototype: Electron.WebContentsInternal } };
|
|
|
|
|
|
Object.setPrototypeOf(WebContents.prototype, EventEmitter.prototype);
|
|
|
|
|
@@ -203,7 +203,7 @@ for (const method of webFrameMethods) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-const waitTillCanExecuteJavaScript = async (webContents: WebContentsInternal) => {
|
|
|
+const waitTillCanExecuteJavaScript = async (webContents: Electron.WebContentsInternal) => {
|
|
|
if (webContents.getURL() && !webContents.isLoadingMainFrame()) return;
|
|
|
|
|
|
return new Promise((resolve) => {
|
|
@@ -483,7 +483,7 @@ WebContents.prototype._init = function () {
|
|
|
this.setMaxListeners(0);
|
|
|
|
|
|
// Dispatch IPC messages to the ipc module.
|
|
|
- this.on('-ipc-message' as any, function (this: WebContentsInternal, event: any, internal: boolean, channel: string, args: any[]) {
|
|
|
+ this.on('-ipc-message' as any, function (this: Electron.WebContentsInternal, event: any, internal: boolean, channel: string, args: any[]) {
|
|
|
if (internal) {
|
|
|
addReplyInternalToEvent(event);
|
|
|
ipcMainInternal.emit(channel, event, ...args);
|
|
@@ -508,7 +508,7 @@ WebContents.prototype._init = function () {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- this.on('-ipc-message-sync' as any, function (this: WebContentsInternal, event: any, internal: boolean, channel: string, args: any[]) {
|
|
|
+ this.on('-ipc-message-sync' as any, function (this: Electron.WebContentsInternal, event: any, internal: boolean, channel: string, args: any[]) {
|
|
|
addReturnValueToEvent(event);
|
|
|
if (internal) {
|
|
|
addReplyInternalToEvent(event);
|
|
@@ -546,7 +546,7 @@ WebContents.prototype._init = function () {
|
|
|
});
|
|
|
|
|
|
// The devtools requests the webContents to reload.
|
|
|
- this.on('devtools-reload-page', function (this: WebContentsInternal) {
|
|
|
+ this.on('devtools-reload-page', function (this: Electron.WebContentsInternal) {
|
|
|
this.reload();
|
|
|
});
|
|
|
|
|
@@ -569,7 +569,7 @@ WebContents.prototype._init = function () {
|
|
|
|
|
|
// Create a new browser window for the native implementation of
|
|
|
// "window.open", used in sandbox and nativeWindowOpen mode.
|
|
|
- this.on('-add-new-contents' as any, (event: any, webContents: WebContentsInternal, disposition: string,
|
|
|
+ this.on('-add-new-contents' as any, (event: any, webContents: Electron.WebContentsInternal, disposition: string,
|
|
|
userGesture: boolean, left: number, top: number, width: number, height: number, url: string, frameName: string,
|
|
|
referrer: string, rawFeatures: string, postData: string) => {
|
|
|
if ((disposition !== 'foreground-tab' && disposition !== 'new-window' &&
|