const ExtensionManager = require('./extension_manager');
const rp_new_debug = require('debug')('RP_NEW');
const commonModuleManager = require('./manager');
-const {ipcRenderer} = require('electron');
const BrowserWindow = commonModuleManager.browserWindow;
const events = commonModuleManager.events;
+const app = commonModuleManager.app;
class WebWindow {
constructor(options) {
webwindow_debug('WebWindow : browserWindow show options is ',options.show);
self.show();
}
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FINISH_LOAD, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FINISH_LOAD, self.mainWindow.id);
});
this.mainWindow.webContents.on('did-fail-load', function(event, errorCode, errorDescription, validatedUrl) {
webwindow_debug('WebWindow : webContents did-fail-load');
params.errorCode = errorCode;
params.errorDescription = errorDescription;
params.validatedUrl = validatedUrl;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FAIL_LOAD, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FAIL_LOAD, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('did-frame-finish-load', function(event, isMainFrame) {
webwindow_debug('WebWindow : webContents did-frame-finish-load:');
var params = {};
params.isMainFrame = isMainFrame;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FRAME_FINISH_LOAD, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FRAME_FINISH_LOAD, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('did-start-loading', function() {
webwindow_debug('WebWindow : webContents did-start-loading');
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_START_LOADING, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_START_LOADING, self.mainWindow.id);
});
this.mainWindow.webContents.on('did-stop-loading', function() {
webwindow_debug('WebWindow : webContents did-stop-loading');
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_STOP_LOADING, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_STOP_LOADING, self.mainWindow.id);
});
this.mainWindow.webContents.on('did-get-response-details', function(event, status, newUrl, originalUrl, httpResponseCode, requestMethod, referrer, headers) {
webwindow_debug('WebWindow : webContents did-get-response-details');
params.requestMethod = requestMethod;
params.referrer = referrer;
params.headers = headers;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_GET_RESPONSE_DETAILS, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_GET_RESPONSE_DETAILS, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('did-get-redirect-request', function(event, oldUrl, newUrl, isMainFrame, httpResponseCode, requestMethod, referrer, headers) {
webwindow_debug('WebWindow : webContents did-get-redirect-request');
params.requestMethod = requestMethod;
params.referrer = referrer;
params.headers = headers;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_GET_REDIRECT_REQUEST, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DID_GET_REDIRECT_REQUEST, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('dom-ready', function(event) {
webwindow_debug('WebWindow : webContents dom-ready');
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DOM_READY, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DOM_READY, self.mainWindow.id);
});
this.mainWindow.webContents.on('page-favicon-updated', function(event, favicons) {
webwindow_debug('WebWindow : webContents page-favicon-updated');
var params = {};
params.favicons = favicons;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.PAGE_FAVICON_UPDATED, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.PAGE_FAVICON_UPDATED, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('new-window', function(event, url, frameName, disposition, options) {
webwindow_debug('WebWindow : webContents new-window');
params.frameName = frameName;
params.disposition = disposition;
params.options = options;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.NEW_WINDOW, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.NEW_WINDOW, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('will-navigate', function(event, url) {
webwindow_debug('WebWindow : webContents will-navigate');
});
this.mainWindow.webContents.on('crashed', function() {
webwindow_debug('WebWindow : webContents crashed');
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.CRASHED, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.CRASHED, self.mainWindow.id);
});
this.mainWindow.webContents.on('plugin-crashed', function(event, name, version) {
webwindow_debug('WebWindow : webContents plugin-crashed');
var params = {};
params.name = name;
params.version = version;
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.PLUGIN_CRASHED, 'web_window', self.mainWindow.id, params);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.PLUGIN_CRASHED, self.mainWindow.id, params);
});
this.mainWindow.webContents.on('destroyed', function() {
webwindow_debug('WebWindow : webContents destroyed');
- ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DESTROYED, 'web_window', self.mainWindow.id);
+ app.emit(IPC_MESSAGE.WEBCONTENTS.DESTROYED, self.mainWindow.id);
});
}
setUrl(path) {