/* global AppWindow, focusManager */
'use strict';
(function(exports) {
/**
* AttentionWindow is a special opened window with specific
* permission: 'attention'. It would show in front of any
* existing app windows to get users' attention.
*
* ##### Flow chart
*
*
*
*
* @example
* var attention = new AttentionWindow({
* url: 'app://clock.gaiamobile.org:8080/alarm.html',
* manifestURL: 'http://gallery.gaiamobile.org:8080/manifest.webapp',
* iframe: iframe
* });
*
* @class AttentionWindow
* @param {Object} config The configuration object of this attention.
* @extends AppWindow
*/
/**
* Fired when the attention window is created.
* @event AttentionWindow#attentioncreated
*/
/**
* Fired when the attention window is removed.
* @event AttentionWindow#attentionterminated
*/
/**
* Fired when the attention window is opening.
* @event AttentionWindow#attentionopening
*/
/**
* Fired when the attention window is opened.
* @event AttentionWindow#attentionopened
*/
/**
* Fired when the attention window is closing.
* @event AttentionWindow#attentionclosing
*/
/**
* Fired when the attention window is closed.
* @event AttentionWindow#attentionclosed
*/
/**
* Fired before the attention window will be rendered.
* @event AttentionWindow#attentionwillrender
*/
/**
* Fired when the attention window is rendered to the DOM tree.
* @event AttentionWindow#attentionrendered
*/
var AttentionWindow = function AttentionWindow(config) {
this.isAttentionWindow = true;
this.reConfig(config);
this.render();
if (this._DEBUG) {
AttentionWindow[this.instanceID] = this;
}
focusManager.addUI(this);
this.publish('created');
};
AttentionWindow.prototype = Object.create(AppWindow.prototype);
AttentionWindow.prototype.constructor = AttentionWindow;
AttentionWindow.prototype.eventPrefix = 'attention';
AttentionWindow.prototype.CLASS_NAME = 'AttentionWindow';
AttentionWindow.prototype.CLASS_LIST = 'appWindow attentionWindow';
/**
* Turn on this flag to dump debugging messages for all attention windows.
* @type {Boolean}
*/
AttentionWindow.prototype._DEBUG = false;
AttentionWindow.prototype.closedHeight = 40;
AttentionWindow.prototype.openAnimation = 'immediate';
AttentionWindow.prototype.closeAnimation = 'immediate';
AttentionWindow.prototype.view = function attw_view() {
this.debug('intance id: ' + this.instanceID);
return '