Permalink
Browse files

wip

  • Loading branch information...
alivedise committed Feb 24, 2014
1 parent ce69c98 commit beee95717b5af037ca60100352e38b0889b2ced8
View
@@ -47,6 +47,7 @@
<!-- System -->
<link rel="stylesheet" type="text/css" href="style/system/system.css">
<link rel="stylesheet" type="text/css" href="style/app_task_manager/app_task_manager.css">
<link rel="stylesheet" type="text/css" href="style/system/keyboard.css">
<link rel="stylesheet" type="text/css" href="style/sound_manager/sound_manager.css">
@@ -295,6 +296,7 @@
<script defer src="js/child_window_factory.js"></script>
<script defer src="js/app_modal_dialog.js"></script>
<script defer src="js/app_chrome.js"></script>
<script defer src="js/window_resizer.js"></script>
<script defer src="js/app_transition_controller.js"></script>
<script defer src="js/app_authentication_dialog.js"></script>
<script defer src="js/app_window.js"></script>
@@ -307,6 +309,8 @@
<script defer src="js/activity_window.js"></script>
<script defer src="js/activity_window_factory.js"></script>
<script defer src="js/app_window_factory.js"></script>
<script defer src="js/app_hierachy_manager.js"></script>
<script defer src="js/app_task_manager.js"></script>
<script defer src="js/app_window_manager.js"></script>
<script defer src="js/secure_window.js"></script>
<script defer src="js/secure_window_factory.js"></script>
@@ -0,0 +1,20 @@
'use strict';
(function(exports) {
var AppHierachyManager = function() {
};
AppHierachyManager.prototype.start = function() {
window.addEventListener('apprequestfocus', this);
};
AppHierachyManager.prototype.handleEvent = function(evt) {
console.log(evt);
switch (evt.type) {
case 'apprequestfocus':
var app = evt.detail;
app.toFront();
break;
}
};
exports.appHierachyManager = new AppHierachyManager();
exports.appHierachyManager.start();
}(window));
@@ -0,0 +1,35 @@
'use strict';
(function(exports) {
var AppTaskManager = function(stackManager) {
this.stackManager = stackManager;
this.render();
this._fetchElements();
this._registerEvents();
};
AppTaskManager.prototype.__proto__ = window.BaseUI.prototype;
AppTaskManager.prototype.containerElement = document.getElementById('screen');
AppTaskManager.prototype.view = function() {
return '<div class="app-task-manager" ' +
' data-z-index-level="app-task-manager"></div>';
};
AppTaskManager.prototype._registerEvents = function() {
window.addEventListener('stackchanged', this);
};
AppTaskManager.prototype._fetchElements = function() {
this.element = document.querySelector('.app-task-manager');
};
AppTaskManager.prototype.handleEvent = function(evt) {
switch (evt.type) {
case 'stackchanged':
this.element.innerHTML = '';
var html = '';
for (var id in this.stackManager._stack) {
html += '<button>' + this.stackManager._stack[id].name + '</button>';
}
this.element.innerHTML = html;
break;
}
};
exports.AppTaskManager = AppTaskManager;
}(window));
@@ -41,7 +41,7 @@
*/
var AppWindow = function AppWindow(configuration) {
this.reConfig(configuration);
this.render();
this.requestRender();
/**
* This is fired when the app window is instantiated.
* @event AppWindow#appcreated
@@ -57,6 +57,10 @@
return this;
};
AppWindow.prototype.requestRender = function() {
this.publish('requestrender');
};
/**
* When this option is set to true,
* an app would not be removed while it's crashed.
@@ -479,7 +483,7 @@
* Render the mozbrowser iframe and some overlays.
* @inner
*/
AppWindow.prototype._render = function aw__render() {
AppWindow.prototype._render = function aw__render(x, y, w, h) {
if (this.element) {
return;
}
@@ -512,6 +516,12 @@
if (this.isFullScreen()) {
this.element.classList.add('fullscreen-app');
}
if (w && h) {
this.element.style.top = x + 'px';
this.element.style.left = y + 'px';
this.element.style.width = w + 'px';
this.element.style.height = h + 'px';
}
this.element.appendChild(this.browser.element);
this.screenshotOverlay = this.element.querySelector('.screenshot-overlay');
@@ -532,7 +542,7 @@
};
AppWindow.prototype.render = function aw_render() {
this._render();
this._render.apply(this, arguments);
this._registerEvents();
this.installSubComponents();
// Pre determine the rotation degree.
@@ -559,14 +569,15 @@
'mozbrowserloadend', 'mozbrowseractivitydone', 'mozbrowserloadstart',
'mozbrowsertitlechange', 'mozbrowserlocationchange',
'mozbrowsericonchange',
'_localized', '_swipein', '_swipeout', '_kill_suspended'];
'_localized', '_swipein', '_swipeout', '_kill_suspended', '_toback'];
AppWindow.SUB_COMPONENTS = {
'transitionController': window.AppTransitionController,
'modalDialog': window.AppModalDialog,
'authDialog': window.AppAuthenticationDialog,
'contextmenu': window.BrowserContextMenu,
'childWindowFactory': window.ChildWindowFactory
'childWindowFactory': window.ChildWindowFactory,
'resizer': window.WindowResizer
};
AppWindow.prototype.openAnimation = 'enlarge';
@@ -1529,5 +1540,19 @@
return app;
};
AppWindow.prototype.toFront = function() {
this.publish('tofront');
this.element.classList.add('focus');
this.setVisible(true);
};
AppWindow.prototype._handle__toback = function() {
this.toBack();
};
AppWindow.prototype.toBack = function() {
this.element.classList.remove('focus');
};
exports.AppWindow = AppWindow;
}(window));
@@ -15,6 +15,8 @@
* @module AppWindowManager
*/
window.AppWindowManager = {
multiWindow: true,
continuousTransition: false,
element: document.getElementById('windows'),
@@ -171,8 +173,9 @@
}
appNext.open(immediateTranstion ? 'immediate' :
((switching === true) ? 'invoked' : openAnimation));
if (appCurrent) {
((switching === true && !this.multiWindow) ?
'invoked' : openAnimation));
if (appCurrent && !this.multiWindow) {
appCurrent.close(immediateTranstion ? 'immediate' :
((switching === true) ? 'invoking' : closeAnimation));
} else {
@@ -231,6 +234,7 @@
window.addEventListener('homegesture-enabled', this);
window.addEventListener('homegesture-disabled', this);
window.addEventListener('system-resize', this);
window.addEventListener('apptofront', this);
// update app name when language setting changes
SettingsListener.observe('language.current', null,
@@ -429,6 +433,10 @@
this.debug('launching' + config.origin);
this.launch(config);
break;
case 'apptofront':
this.broadcastMessage('toback');
break;
}
},
@@ -80,7 +80,7 @@
case 'appopened':
// XXX: Remove the dependency in trustedUI rework.
if (!TrustedUIManager.hasTrustedUI(evt.detail.origin)) {
this.getHomescreen().fadeOut();
//this.getHomescreen().fadeOut();
}
break;
}
Oops, something went wrong.

0 comments on commit beee957

Please sign in to comment.