this.webApplication = webApplication;
}
- backgroundExecutableLaunchMode() { return false; }
beforeQuit() { }
canIgnoreSuspend() { return false; }
clearCache() { }
handleAppControlEvent(appControl: any) { return true; }
handleProxyInfo(authInfo: any, callback: any) { return false; }
initialize(options: RuntimeOption) { }
- isPreloading() { return false; }
+ isBackgroundLaunch() { return false; }
needInpectorGuide() { return false; }
needReload(src: string) {
let originalUrl = this.webApplication.mainWindow.webContents.getURL();
import { WebApplicationDelegate } from '../../common/web_application_delegate';
export class WebApplicationDelegateTV extends WebApplicationDelegate {
- backgroundExecutionLaunchMode: boolean = false;
backgroundExecutionMetaData: string = 'false';
inspectorSrc: string = '';
isAlwaysReload: boolean = false;
initialize(options: RuntimeOption) {
this.launchMode = options.launchMode;
- if (options.launchMode == 'backgroundAtStartup') {
- console.log('backgroundAtStartup');
+ console.log(`launch mode is ${this.launchMode}`);
+ if (options.launchMode === 'backgroundAtStartup') {
this.preloadStatus = 'preload';
} else {
this.preloadStatus = 'none';
}
- if (options.launchMode == 'backgroundExecution') {
- console.log('launch mode is backgroundExecution');
- this.backgroundExecutionLaunchMode = true;
- } else {
- this.backgroundExecutionLaunchMode = false;
- }
this.isAlwaysReload = this.tv.isAlwaysReload();
this.webApplication.multitaskingSupport = this.tv.getMultitaskingSupport();
this.webApplication.defaultBackgroundColor = '#0000';
}
private showInspectorGuide() {
+ if (this.isBackgroundLaunch())
+ return;
+
console.log('WebApplication : showInspectorGuide');
this.showInspectorGuide = () => { }; // call once
const message = `${this.webApplication.debugPort.toString()}
Then you can get profile log from the initial loading.`;
let webContents = this.webApplication.mainWindow.webContents;
this.tv.showDialog(webContents, message);
- if (this.preloadStatus !== 'none') {
- setTimeout(() => {
- this.tv.cancelDialogs(webContents);
- }, 5000);
- }
}
private needSuspend() {
}
}
- backgroundExecutableLaunchMode() {
- return this.backgroundExecutionLaunchMode;
- }
-
- isPreloading() {
- if (this.preloadStatus === 'preload' ||
- this.launchMode === 'runningAsBackground') {
- console.log(`preloadStatus is ${this.preloadStatus} or ${this.launchMode}, show is skipped`);
- return true;
- }
- return false;
+ isBackgroundLaunch() {
+ return (this.preloadStatus === 'preload' ||
+ this.launchMode === 'runningAsBackground' ||
+ this.launchMode === 'backgroundExecution');
}
canIgnoreSuspend() {
- if (this.launchMode === 'runningAsForeground' ||
- this.launchMode === 'runningAsBackground') {
- console.log('WebApplication : view_suspend & multitasking feature is skipped!');
- return true;
- }
- return false;
+ return (this.launchMode === 'runningAsForeground' ||
+ this.launchMode === 'runningAsBackground' ||
+ this.launchMode === 'backgroundExecution');
}
beforeQuit() {
}
needInpectorGuide() {
- let inspectorEnabledByVconf = this.tv.needUseInspector();
- if (inspectorEnabledByVconf && !this.backgroundExecutionLaunchMode) {
+ if (this.isBackgroundLaunch()) {
+ return false;
+ }
+ if (this.tv.needUseInspector()) {
this.inspectorSrc = this.webApplication.contentSrc;
this.webApplication.contentSrc = 'about:blank';
return true;
return false;
}
}
-
- if ('true' === this.backgroundExecutionMetaData) {
- console.log(`handle AppControl background exectution app to show`);
- this.webApplication.mainWindow.show();
- }
return true;
}
// TODO: On 6.0, this causes a black screen on relaunch
if (this.showTimer)
clearTimeout(this.showTimer);
- if (!this.backgroundRunnable())
- this.mainWindow.setEnabled(true);
+ this.mainWindow.setEnabled(true);
}
private initDisplayDelay() {
- if (this.profileDelegate.isPreloading())
+ if (this.profileDelegate.isBackgroundLaunch())
return;
this.splashShown = wrt.showSplashScreen();
}, 2000);
}
- private backgroundRunnable() {
- return this.backgroundSupport || this.profileDelegate.backgroundExecutableLaunchMode();
- }
-
handleAppControlEvent(appControl: any) {
if (!this.profileDelegate.handleAppControlEvent(appControl)) {
return;
}
private isPausable() {
- return !this.profileDelegate.canIgnoreSuspend() && !this.backgroundRunnable();
+ return !this.backgroundSupport && !this.profileDelegate.canIgnoreSuspend();
}
suspend() {
}
if (this.isPausable()) {
this.windowList.forEach((window) => window.setEnabled(false));
- if (!this.multitaskingSupport && !this.profileDelegate.isPreloading()) {
+ if (!this.multitaskingSupport && !this.profileDelegate.isBackgroundLaunch()) {
setTimeout(() => {
console.log('multitasking is not supported; quitting app')
app.quit();
addonManager.emit('lcResume', this.mainWindow.id, this.reload);
this.reload = false;
- if (!this.backgroundRunnable())
- this.windowList.forEach((window) => window.setEnabled(true));
+ this.windowList.forEach((window) => window.setEnabled(true));
this.windowList[this.windowList.length - 1].show();
}
}
show() {
- if (this.profileDelegate.isPreloading()) {
+ if (this.profileDelegate.isBackgroundLaunch()) {
+ console.log('show() will be skipped by background launch');
return;
}
console.log('WebApplication : show');
- if (this.profileDelegate.backgroundExecutableLaunchMode()) {
- console.log('skip showing while backgroundExecutionLaunchMode mode');
- } else if (!this.mainWindow.isVisible()) {
+ if (!this.mainWindow.isVisible()) {
console.log(`show this.windowList.length : ${this.windowList.length}`);
this.mainWindow.show();
if (this.windowList.length > 1) {