This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
/
popup_window.js
97 lines (83 loc) · 2.52 KB
/
popup_window.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
/* global AppWindow */
(function(exports) {
/**
* This window is inherit the AppWindow, and modifies some properties
* different from the later.
*
* @constructor PopupWindow
* @augments AppWindow
*/
var PopupWindow = function(configs) {
if (configs && configs.rearWindow) {
// Render inside its opener.
this.containerElement = configs.rearWindow.element;
}
configs.chrome = {
bar: true
};
AppWindow.call(this, configs);
};
/**
* @borrows AppWindow.prototype as PopupWindow.prototype
* @memberof PopupWindow
*/
PopupWindow.prototype = Object.create(AppWindow.prototype);
PopupWindow.REGISTERED_EVENTS =
['mozbrowserclose', 'mozbrowsererror', 'mozbrowservisibilitychange',
'mozbrowserloadend', 'mozbrowseractivitydone', 'mozbrowserloadstart',
'mozbrowsertitlechange', 'mozbrowserlocationchange',
'mozbrowsericonchange'];
PopupWindow.SUB_COMPONENTS = {
'transitionController': window.AppTransitionController,
'modalDialog': window.AppModalDialog,
'valueSelector': window.ValueSelector,
'authDialog': window.AppAuthenticationDialog,
'contextmenu': window.BrowserContextMenu,
'childWindowFactory': window.ChildWindowFactory,
'statusbar': window.AppStatusbar
};
/**
* We would maintain our own events by other components.
*
* @type String
* @memberof PopupWindow
*/
PopupWindow.prototype.eventPrefix = 'popup';
/**
* Default opening animation.
*
* @type String
* @memberof PopupWindow
*/
PopupWindow.prototype.openAnimation = 'slide-from-bottom';
/**
* Default closing animation.
*
* @type String
* @memberof PopupWindow
*/
PopupWindow.prototype.closeAnimation = 'slide-to-bottom';
PopupWindow.prototype.CLASS_LIST = 'appWindow popupWindow';
PopupWindow.prototype._DEBUG = false;
PopupWindow.prototype.CLASS_NAME = 'PopupWindow';
/**
* We don't need to request to open because:
* We are always overlapping above an app window or
* another popup window instance which is not sent to
* background. This behavior may change later but in
* current stage we don't care.
*/
PopupWindow.prototype.requestOpen = function() {
this.open();
};
PopupWindow.prototype.requestClose = function() {
this.close();
};
/**
* @exports PopupWindow
*/
exports.PopupWindow = PopupWindow;
})(window);