this.sandbox = [];
this.webContents = null;
this.addonPkgs = [];
- this.isTVProfile = (wrt.getPlatformType() === 'product_tv');
var _this = this;
app.on('before-quit', function(event) {
});
app.on('web-contents-created', function(event, webContents) {
console.log('web-contents-created');
- if (_this.isTVProfile)
+ if (wrt.tv)
_this.setCookiePath();
_this.webContents = webContents;
_this.webContents.on('before-input-event', function(event, input) {
if (!options.noAddons) {
_this.addonManager.build();
}
- if (_this.isTVProfile) {
- wrt.importCertificate('');
- wrt.optimizeCache();
+ if (wrt.tv) {
+ wrt.tv.importCertificate('');
+ wrt.tv.optimizeCache();
}
});
wrt.on('app-control', function(event, appControl) {
_this.webApplication = new WebApplication(options);
_this.webApplication.addonEmitter =
_this.addonManager.evt_emitter_;
- _this.inspectorEnabledByVconf = wrt.needUseInspector();
- if (_this.inspectorEnabledByVconf && launchMode != 'backgroundExecution') {
- _this.webApplication.inspectorSrc = src;
- src = "about:blank";
+ if (wrt.tv) {
+ _this.inspectorEnabledByVconf = wrt.tv.needUseInspector();
+ if (_this.inspectorEnabledByVconf && launchMode != 'backgroundExecution') {
+ _this.webApplication.inspectorSrc = src;
+ src = "about:blank";
+ }
}
_this.webApplication.mainWindow.loadURL(src);
_this.webApplication.prelaunch(src);
let reload = loadInfo.getReload() || _this.webApplication.isAlwaysReload;
if (!reload) {
- if (_this.isTVProfile) {
+ if (wrt.tv) {
console.log(`src = ${src}, app-control uri = ${_this.webApplication.mainWindow.getURL()}`);
const url = require('url');
let appcontrolUrl = url.parse(src);
this.windowList = [];
this.firstRendered = false;
this.backgroundSupport = wrt.getBackgroundSupport();
- this.multitaskingSupport = wrt.getMultitaskingSupport();
this.debugPort = 0;
this.inspectorSrc = '';
if (options.launchMode == 'backgroundAtStartup') {
} else {
this.backgroundExecution = false;
}
- this.accessiblePath = wrt.getAccessiblePath();
- this.isAlwaysReload = wrt.isAlwaysReload();
+ this.accessiblePath = (wrt.tv ? wrt.tv.getAccessiblePath() : null);
+ this.isAlwaysReload = (wrt.tv ? wrt.tv.isAlwaysReload() : false);
+ this.multitaskingSupport = (wrt.tv ? wrt.tv.getMultitaskingSupport() : true);
+ this.defaultBackgroundColor = (wrt.tv ? '#000' : '#FFF');
+ this.defaultTransparent = (wrt.tv ? true : false);
this.suspended = false;
this.loadFinished = false;
this.runningStatus = 'none';
- this.isTVProfile = (wrt.getPlatformType() === "product_tv");
- this.defaultBackgroundColor = (this.isTVProfile ? '#000' : '#FFF');
- this.defaultTransparent = (this.isTVProfile ? true : false);
this.addonEmitter = null;
let self = this;
event.preventDefault();
let usrname = '';
let passwd = '';
- if (self.isTVProfile && authInfo.isProxy) {
- let vconfProxy = wrt.getProxy();
+ if (wrt.tv && authInfo.isProxy) {
+ let vconfProxy = wrt.tv.getProxy();
if (vconfProxy) {
let proxyInfo = new URL(vconfProxy);
usrname = proxyInfo.username;
wrt.handleAuthRequest(id, webContents);
}
});
- if (this.isTVProfile) {
+ if (wrt.tv) {
// TODO. This logic in only for QA verification
// Current TV default client cert will be expired.
// So that detecting apps which use TV client certificate,
event.preventDefault();
if (list.length > 0 && list[0].subjectName == 'Samsung TV,BDP certificate') {
setTimeout(() => {
- wrt.showDialog(webContents, 'Samsung TV,BDP certificate');
+ wrt.tv.showDialog(webContents, 'Samsung TV,BDP certificate');
}, 7000);
}
callback(list[0]);
});
wrt.on('app-status-changed', function(event, status) {
console.log(`runningStatus: ${status}, ${self.loadFinished}`);
- if (!self.isTVProfile) {
+ if (!wrt.tv) {
return;
}
self.runningStatus = status;
});
}
let self = this;
- if (!self.isTVProfile) {
+ if (!wrt.tv) {
self.showTimer = setTimeout(() => {
if (!self.suspended) {
console.log('FrameRendered not obtained from engine. To show window, timer fired');
wrt.hideSplashScreen(2);
if (wrt.isIMEWebApp()) {
self.activateIMEWebHelperClient();
- } else if (self.isTVProfile) {
+ } else if (wrt.tv) {
if (self.inspectorSrc) {
self.showInspectorGuide();
} else {
// TODO : Need to care this situation and decide to pass the addon event emitter to suspend()
this.suspend();
if (this.runningStatus !== 'behind')
- wrt.notifyAppStatus('preload');
+ wrt.tv.notifyAppStatus('preload');
}
}
showInspectorGuide() {
"network log from the initial loading.\r\nPlease click Record button " +
"in Timeline panel in PC before click OK button,\r\nThen you can get " +
"profile log from the initial loading."
- wrt.showDialog(this.mainWindow.webContents, message);
+ wrt.tv.showDialog(this.mainWindow.webContents, message);
}
suspend() {
console.log('WebApplication : suspend');
console.log('WebApplication : suspend - Invalid event emitter');
}
this.suspended = true;
- if (this.isTVProfile) {
- wrt.flushCookie();
+ if (wrt.tv) {
+ wrt.tv.flushCookie();
this.windowList.forEach((window) => window.webContents.session.flushStorageData());
}
if (!this.backgroundRunnable()) {
}
finalize() {
console.log('WebApplication : finalize');
- this.inspectorSrc = '';
- wrt.cancelDialogs(this.mainWindow.webContents);
+ if (wrt.tv) {
+ this.inspectorSrc = '';
+ wrt.tv.cancelDialogs(this.mainWindow.webContents);
+ }
if (this.debugPort) {
console.log('stop inspector server');
this.debugPort = 0;
}
lowMemory() {
console.log('WebApplication : lowMemory to clearcache');
- if (this.isTVProfile) {
+ if (wrt.tv) {
this.windowList.forEach((window) => {
//clear webframe cache
- wrt.clearWebCache(window.webContents);
+ wrt.tv.clearWebCache(window.webContents);
window.webContents.session.clearCache(function() {
console.log('clear session Cache complete');
})