Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionPanel.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 /** 30 /**
31 * @implements {WebInspector.Searchable} 31 * @implements {UI.Searchable}
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.ExtensionPanel = class extends WebInspector.Panel { 34 Extensions.ExtensionPanel = class extends UI.Panel {
35 /** 35 /**
36 * @param {!WebInspector.ExtensionServer} server 36 * @param {!Extensions.ExtensionServer} server
37 * @param {string} panelName 37 * @param {string} panelName
38 * @param {string} id 38 * @param {string} id
39 * @param {string} pageURL 39 * @param {string} pageURL
40 */ 40 */
41 constructor(server, panelName, id, pageURL) { 41 constructor(server, panelName, id, pageURL) {
42 super(panelName); 42 super(panelName);
43 this._server = server; 43 this._server = server;
44 this._id = id; 44 this._id = id;
45 this.setHideOnDetach(); 45 this.setHideOnDetach();
46 this._panelToolbar = new WebInspector.Toolbar('hidden', this.element); 46 this._panelToolbar = new UI.Toolbar('hidden', this.element);
47 47
48 this._searchableView = new WebInspector.SearchableView(this); 48 this._searchableView = new UI.SearchableView(this);
49 this._searchableView.show(this.element); 49 this._searchableView.show(this.element);
50 50
51 var extensionView = new WebInspector.ExtensionView(server, this._id, pageURL , 'extension'); 51 var extensionView = new Extensions.ExtensionView(server, this._id, pageURL, 'extension');
52 extensionView.show(this._searchableView.element); 52 extensionView.show(this._searchableView.element);
53 } 53 }
54 54
55 /** 55 /**
56 * @param {!WebInspector.ToolbarItem} item 56 * @param {!UI.ToolbarItem} item
57 */ 57 */
58 addToolbarItem(item) { 58 addToolbarItem(item) {
59 this._panelToolbar.element.classList.remove('hidden'); 59 this._panelToolbar.element.classList.remove('hidden');
60 this._panelToolbar.appendToolbarItem(item); 60 this._panelToolbar.appendToolbarItem(item);
61 } 61 }
62 62
63 /** 63 /**
64 * @override 64 * @override
65 */ 65 */
66 searchCanceled() { 66 searchCanceled() {
67 this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.S earchAction.CancelSearch); 67 this._server.notifySearchAction(this._id, Extensions.extensionAPI.panels.Sea rchAction.CancelSearch);
68 this._searchableView.updateSearchMatchesCount(0); 68 this._searchableView.updateSearchMatchesCount(0);
69 } 69 }
70 70
71 /** 71 /**
72 * @override 72 * @override
73 * @return {!WebInspector.SearchableView} 73 * @return {!UI.SearchableView}
74 */ 74 */
75 searchableView() { 75 searchableView() {
76 return this._searchableView; 76 return this._searchableView;
77 } 77 }
78 78
79 /** 79 /**
80 * @override 80 * @override
81 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 81 * @param {!UI.SearchableView.SearchConfig} searchConfig
82 * @param {boolean} shouldJump 82 * @param {boolean} shouldJump
83 * @param {boolean=} jumpBackwards 83 * @param {boolean=} jumpBackwards
84 */ 84 */
85 performSearch(searchConfig, shouldJump, jumpBackwards) { 85 performSearch(searchConfig, shouldJump, jumpBackwards) {
86 var query = searchConfig.query; 86 var query = searchConfig.query;
87 this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.S earchAction.PerformSearch, query); 87 this._server.notifySearchAction(this._id, Extensions.extensionAPI.panels.Sea rchAction.PerformSearch, query);
88 } 88 }
89 89
90 /** 90 /**
91 * @override 91 * @override
92 */ 92 */
93 jumpToNextSearchResult() { 93 jumpToNextSearchResult() {
94 this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.S earchAction.NextSearchResult); 94 this._server.notifySearchAction(this._id, Extensions.extensionAPI.panels.Sea rchAction.NextSearchResult);
95 } 95 }
96 96
97 /** 97 /**
98 * @override 98 * @override
99 */ 99 */
100 jumpToPreviousSearchResult() { 100 jumpToPreviousSearchResult() {
101 this._server.notifySearchAction(this._id, WebInspector.extensionAPI.panels.S earchAction.PreviousSearchResult); 101 this._server.notifySearchAction(this._id, Extensions.extensionAPI.panels.Sea rchAction.PreviousSearchResult);
102 } 102 }
103 103
104 /** 104 /**
105 * @override 105 * @override
106 * @return {boolean} 106 * @return {boolean}
107 */ 107 */
108 supportsCaseSensitiveSearch() { 108 supportsCaseSensitiveSearch() {
109 return false; 109 return false;
110 } 110 }
111 111
112 /** 112 /**
113 * @override 113 * @override
114 * @return {boolean} 114 * @return {boolean}
115 */ 115 */
116 supportsRegexSearch() { 116 supportsRegexSearch() {
117 return false; 117 return false;
118 } 118 }
119 }; 119 };
120 120
121 /** 121 /**
122 * @unrestricted 122 * @unrestricted
123 */ 123 */
124 WebInspector.ExtensionButton = class { 124 Extensions.ExtensionButton = class {
125 /** 125 /**
126 * @param {!WebInspector.ExtensionServer} server 126 * @param {!Extensions.ExtensionServer} server
127 * @param {string} id 127 * @param {string} id
128 * @param {string} iconURL 128 * @param {string} iconURL
129 * @param {string=} tooltip 129 * @param {string=} tooltip
130 * @param {boolean=} disabled 130 * @param {boolean=} disabled
131 */ 131 */
132 constructor(server, id, iconURL, tooltip, disabled) { 132 constructor(server, id, iconURL, tooltip, disabled) {
133 this._id = id; 133 this._id = id;
134 134
135 this._toolbarButton = new WebInspector.ToolbarButton('', ''); 135 this._toolbarButton = new UI.ToolbarButton('', '');
136 this._toolbarButton.addEventListener('click', server.notifyButtonClicked.bin d(server, this._id)); 136 this._toolbarButton.addEventListener('click', server.notifyButtonClicked.bin d(server, this._id));
137 this.update(iconURL, tooltip, disabled); 137 this.update(iconURL, tooltip, disabled);
138 } 138 }
139 139
140 /** 140 /**
141 * @param {string} iconURL 141 * @param {string} iconURL
142 * @param {string=} tooltip 142 * @param {string=} tooltip
143 * @param {boolean=} disabled 143 * @param {boolean=} disabled
144 */ 144 */
145 update(iconURL, tooltip, disabled) { 145 update(iconURL, tooltip, disabled) {
146 if (typeof iconURL === 'string') 146 if (typeof iconURL === 'string')
147 this._toolbarButton.setBackgroundImage(iconURL); 147 this._toolbarButton.setBackgroundImage(iconURL);
148 if (typeof tooltip === 'string') 148 if (typeof tooltip === 'string')
149 this._toolbarButton.setTitle(tooltip); 149 this._toolbarButton.setTitle(tooltip);
150 if (typeof disabled === 'boolean') 150 if (typeof disabled === 'boolean')
151 this._toolbarButton.setEnabled(!disabled); 151 this._toolbarButton.setEnabled(!disabled);
152 } 152 }
153 153
154 /** 154 /**
155 * @return {!WebInspector.ToolbarButton} 155 * @return {!UI.ToolbarButton}
156 */ 156 */
157 toolbarButton() { 157 toolbarButton() {
158 return this._toolbarButton; 158 return this._toolbarButton;
159 } 159 }
160 }; 160 };
161 161
162 /** 162 /**
163 * @unrestricted 163 * @unrestricted
164 */ 164 */
165 WebInspector.ExtensionSidebarPane = class extends WebInspector.SimpleView { 165 Extensions.ExtensionSidebarPane = class extends UI.SimpleView {
166 /** 166 /**
167 * @param {!WebInspector.ExtensionServer} server 167 * @param {!Extensions.ExtensionServer} server
168 * @param {string} panelName 168 * @param {string} panelName
169 * @param {string} title 169 * @param {string} title
170 * @param {string} id 170 * @param {string} id
171 */ 171 */
172 constructor(server, panelName, title, id) { 172 constructor(server, panelName, title, id) {
173 super(title); 173 super(title);
174 this.element.classList.add('fill'); 174 this.element.classList.add('fill');
175 this._panelName = panelName; 175 this._panelName = panelName;
176 this._server = server; 176 this._server = server;
177 this._id = id; 177 this._id = id;
(...skipping 13 matching lines...) Expand all
191 return this._panelName; 191 return this._panelName;
192 } 192 }
193 193
194 /** 194 /**
195 * @param {!Object} object 195 * @param {!Object} object
196 * @param {string} title 196 * @param {string} title
197 * @param {function(?string=)} callback 197 * @param {function(?string=)} callback
198 */ 198 */
199 setObject(object, title, callback) { 199 setObject(object, title, callback) {
200 this._createObjectPropertiesView(); 200 this._createObjectPropertiesView();
201 this._setObject(WebInspector.RemoteObject.fromLocalObject(object), title, ca llback); 201 this._setObject(SDK.RemoteObject.fromLocalObject(object), title, callback);
202 } 202 }
203 203
204 /** 204 /**
205 * @param {string} expression 205 * @param {string} expression
206 * @param {string} title 206 * @param {string} title
207 * @param {!Object} evaluateOptions 207 * @param {!Object} evaluateOptions
208 * @param {string} securityOrigin 208 * @param {string} securityOrigin
209 * @param {function(?string=)} callback 209 * @param {function(?string=)} callback
210 */ 210 */
211 setExpression(expression, title, evaluateOptions, securityOrigin, callback) { 211 setExpression(expression, title, evaluateOptions, securityOrigin, callback) {
212 this._createObjectPropertiesView(); 212 this._createObjectPropertiesView();
213 this._server.evaluate( 213 this._server.evaluate(
214 expression, true, false, evaluateOptions, securityOrigin, this._onEvalua te.bind(this, title, callback)); 214 expression, true, false, evaluateOptions, securityOrigin, this._onEvalua te.bind(this, title, callback));
215 } 215 }
216 216
217 /** 217 /**
218 * @param {string} url 218 * @param {string} url
219 */ 219 */
220 setPage(url) { 220 setPage(url) {
221 if (this._objectPropertiesView) { 221 if (this._objectPropertiesView) {
222 this._objectPropertiesView.detach(); 222 this._objectPropertiesView.detach();
223 delete this._objectPropertiesView; 223 delete this._objectPropertiesView;
224 } 224 }
225 if (this._extensionView) 225 if (this._extensionView)
226 this._extensionView.detach(); 226 this._extensionView.detach();
227 227
228 this._extensionView = new WebInspector.ExtensionView(this._server, this._id, url, 'extension fill'); 228 this._extensionView = new Extensions.ExtensionView(this._server, this._id, u rl, 'extension fill');
229 this._extensionView.show(this.element); 229 this._extensionView.show(this.element);
230 230
231 if (!this.element.style.height) 231 if (!this.element.style.height)
232 this.setHeight('150px'); 232 this.setHeight('150px');
233 } 233 }
234 234
235 /** 235 /**
236 * @param {string} height 236 * @param {string} height
237 */ 237 */
238 setHeight(height) { 238 setHeight(height) {
239 this.element.style.height = height; 239 this.element.style.height = height;
240 } 240 }
241 241
242 /** 242 /**
243 * @param {string} title 243 * @param {string} title
244 * @param {function(?string=)} callback 244 * @param {function(?string=)} callback
245 * @param {?Protocol.Error} error 245 * @param {?Protocol.Error} error
246 * @param {?WebInspector.RemoteObject} result 246 * @param {?SDK.RemoteObject} result
247 * @param {boolean=} wasThrown 247 * @param {boolean=} wasThrown
248 */ 248 */
249 _onEvaluate(title, callback, error, result, wasThrown) { 249 _onEvaluate(title, callback, error, result, wasThrown) {
250 if (error) 250 if (error)
251 callback(error.toString()); 251 callback(error.toString());
252 else 252 else
253 this._setObject(/** @type {!WebInspector.RemoteObject} */ (result), title, callback); 253 this._setObject(/** @type {!SDK.RemoteObject} */ (result), title, callback );
254 } 254 }
255 255
256 _createObjectPropertiesView() { 256 _createObjectPropertiesView() {
257 if (this._objectPropertiesView) 257 if (this._objectPropertiesView)
258 return; 258 return;
259 if (this._extensionView) { 259 if (this._extensionView) {
260 this._extensionView.detach(); 260 this._extensionView.detach();
261 delete this._extensionView; 261 delete this._extensionView;
262 } 262 }
263 this._objectPropertiesView = new WebInspector.ExtensionNotifierView(this._se rver, this._id); 263 this._objectPropertiesView = new Extensions.ExtensionNotifierView(this._serv er, this._id);
264 this._objectPropertiesView.show(this.element); 264 this._objectPropertiesView.show(this.element);
265 } 265 }
266 266
267 /** 267 /**
268 * @param {!WebInspector.RemoteObject} object 268 * @param {!SDK.RemoteObject} object
269 * @param {string} title 269 * @param {string} title
270 * @param {function(?string=)} callback 270 * @param {function(?string=)} callback
271 */ 271 */
272 _setObject(object, title, callback) { 272 _setObject(object, title, callback) {
273 // This may only happen if setPage() was called while we were evaluating the expression. 273 // This may only happen if setPage() was called while we were evaluating the expression.
274 if (!this._objectPropertiesView) { 274 if (!this._objectPropertiesView) {
275 callback('operation cancelled'); 275 callback('operation cancelled');
276 return; 276 return;
277 } 277 }
278 this._objectPropertiesView.element.removeChildren(); 278 this._objectPropertiesView.element.removeChildren();
279 var section = new WebInspector.ObjectPropertiesSection(object, title); 279 var section = new Components.ObjectPropertiesSection(object, title);
280 if (!title) 280 if (!title)
281 section.titleLessMode(); 281 section.titleLessMode();
282 section.expand(); 282 section.expand();
283 section.editable = false; 283 section.editable = false;
284 this._objectPropertiesView.element.appendChild(section.element); 284 this._objectPropertiesView.element.appendChild(section.element);
285 callback(); 285 callback();
286 } 286 }
287 }; 287 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698