OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Joseph Pecoraro | 2 * Copyright (C) 2009 Joseph Pecoraro |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
14 * its contributors may be used to endorse or promote products derived | 14 * its contributors may be used to endorse or promote products derived |
15 * from this software without specific prior written permission. | 15 * from this software without specific prior written permission. |
16 * | 16 * |
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
| 28 /** |
| 29 * @unrestricted |
| 30 */ |
| 31 WebInspector.ConsolePanel = class extends WebInspector.Panel { |
| 32 constructor() { |
| 33 super('console'); |
| 34 this._view = WebInspector.ConsoleView.instance(); |
| 35 } |
28 | 36 |
29 /** | 37 /** |
30 * @constructor | 38 * @return {!WebInspector.ConsolePanel} |
31 * @extends {WebInspector.Panel} | 39 */ |
32 */ | 40 static instance() { |
33 WebInspector.ConsolePanel = function() | 41 return /** @type {!WebInspector.ConsolePanel} */ (self.runtime.sharedInstanc
e(WebInspector.ConsolePanel)); |
34 { | 42 } |
35 WebInspector.Panel.call(this, "console"); | |
36 this._view = WebInspector.ConsoleView.instance(); | |
37 }; | |
38 | 43 |
39 WebInspector.ConsolePanel.prototype = { | 44 /** |
40 /** | 45 * @override |
41 * @override | 46 */ |
42 */ | 47 wasShown() { |
43 wasShown: function() | 48 super.wasShown(); |
44 { | 49 var wrapper = WebInspector.ConsolePanel.WrapperView._instance; |
45 WebInspector.Panel.prototype.wasShown.call(this); | 50 if (wrapper && wrapper.isShowing()) |
46 var wrapper = WebInspector.ConsolePanel.WrapperView._instance; | 51 WebInspector.inspectorView.setDrawerMinimized(true); |
47 if (wrapper && wrapper.isShowing()) | 52 this._view.show(this.element); |
48 WebInspector.inspectorView.setDrawerMinimized(true); | 53 } |
49 this._view.show(this.element); | |
50 }, | |
51 | 54 |
52 /** | 55 /** |
53 * @override | 56 * @override |
54 */ | 57 */ |
55 willHide: function() | 58 willHide() { |
56 { | 59 super.willHide(); |
57 WebInspector.Panel.prototype.willHide.call(this); | 60 if (WebInspector.ConsolePanel.WrapperView._instance) |
58 if (WebInspector.ConsolePanel.WrapperView._instance) | 61 WebInspector.ConsolePanel.WrapperView._instance._showViewInWrapper(); |
59 WebInspector.ConsolePanel.WrapperView._instance._showViewInWrapper()
; | 62 WebInspector.inspectorView.setDrawerMinimized(false); |
60 WebInspector.inspectorView.setDrawerMinimized(false); | 63 } |
61 }, | |
62 | 64 |
63 /** | 65 /** |
64 * @override | 66 * @override |
65 * @return {?WebInspector.SearchableView} | 67 * @return {?WebInspector.SearchableView} |
66 */ | 68 */ |
67 searchableView: function() | 69 searchableView() { |
68 { | 70 return WebInspector.ConsoleView.instance().searchableView(); |
69 return WebInspector.ConsoleView.instance().searchableView(); | 71 } |
70 }, | |
71 | |
72 __proto__: WebInspector.Panel.prototype | |
73 }; | 72 }; |
74 | 73 |
75 /** | 74 /** |
76 * @constructor | 75 * @unrestricted |
77 * @extends {WebInspector.VBox} | |
78 */ | 76 */ |
79 WebInspector.ConsolePanel.WrapperView = function() | 77 WebInspector.ConsolePanel.WrapperView = class extends WebInspector.VBox { |
80 { | 78 constructor() { |
81 WebInspector.VBox.call(this); | 79 super(); |
82 this.element.classList.add("console-view-wrapper"); | 80 this.element.classList.add('console-view-wrapper'); |
83 | 81 |
84 WebInspector.ConsolePanel.WrapperView._instance = this; | 82 WebInspector.ConsolePanel.WrapperView._instance = this; |
85 | 83 |
86 this._view = WebInspector.ConsoleView.instance(); | 84 this._view = WebInspector.ConsoleView.instance(); |
87 }; | 85 } |
88 | 86 |
89 WebInspector.ConsolePanel.WrapperView.prototype = { | 87 /** |
90 wasShown: function() | 88 * @override |
91 { | 89 */ |
92 if (!WebInspector.ConsolePanel.instance().isShowing()) | 90 wasShown() { |
93 this._showViewInWrapper(); | 91 if (!WebInspector.ConsolePanel.instance().isShowing()) |
94 else | 92 this._showViewInWrapper(); |
95 WebInspector.inspectorView.setDrawerMinimized(true); | 93 else |
96 }, | 94 WebInspector.inspectorView.setDrawerMinimized(true); |
| 95 } |
97 | 96 |
98 willHide: function() | 97 /** |
99 { | 98 * @override |
100 WebInspector.inspectorView.setDrawerMinimized(false); | 99 */ |
101 }, | 100 willHide() { |
| 101 WebInspector.inspectorView.setDrawerMinimized(false); |
| 102 } |
102 | 103 |
103 _showViewInWrapper: function() | 104 _showViewInWrapper() { |
104 { | 105 this._view.show(this.element); |
105 this._view.show(this.element); | 106 } |
106 }, | |
107 | |
108 __proto__: WebInspector.VBox.prototype | |
109 }; | 107 }; |
110 | 108 |
111 /** | 109 /** |
112 * @constructor | |
113 * @implements {WebInspector.Revealer} | 110 * @implements {WebInspector.Revealer} |
| 111 * @unrestricted |
114 */ | 112 */ |
115 WebInspector.ConsolePanel.ConsoleRevealer = function() | 113 WebInspector.ConsolePanel.ConsoleRevealer = class { |
116 { | 114 /** |
| 115 * @override |
| 116 * @param {!Object} object |
| 117 * @return {!Promise} |
| 118 */ |
| 119 reveal(object) { |
| 120 var consoleView = WebInspector.ConsoleView.instance(); |
| 121 if (consoleView.isShowing()) { |
| 122 consoleView.focus(); |
| 123 return Promise.resolve(); |
| 124 } |
| 125 WebInspector.viewManager.showView('console-view'); |
| 126 return Promise.resolve(); |
| 127 } |
117 }; | 128 }; |
118 | 129 |
119 WebInspector.ConsolePanel.ConsoleRevealer.prototype = { | |
120 /** | |
121 * @override | |
122 * @param {!Object} object | |
123 * @return {!Promise} | |
124 */ | |
125 reveal: function(object) | |
126 { | |
127 var consoleView = WebInspector.ConsoleView.instance(); | |
128 if (consoleView.isShowing()) { | |
129 consoleView.focus(); | |
130 return Promise.resolve(); | |
131 } | |
132 WebInspector.viewManager.showView("console-view"); | |
133 return Promise.resolve(); | |
134 } | |
135 }; | |
136 | 130 |
137 /** | |
138 * @return {!WebInspector.ConsolePanel} | |
139 */ | |
140 WebInspector.ConsolePanel.instance = function() | |
141 { | |
142 return /** @type {!WebInspector.ConsolePanel} */ (self.runtime.sharedInstanc
e(WebInspector.ConsolePanel)); | |
143 }; | |
OLD | NEW |