OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Stub implementation of the InspectorController API. | 6 * @fileoverview Stub implementation of the InspectorController API. |
7 * This stub class is supposed to make front-end a standalone WebApp | 7 * This stub class is supposed to make front-end a standalone WebApp |
8 * that can be implemented/refactored in isolation from the Web browser | 8 * that can be implemented/refactored in isolation from the Web browser |
9 * backend. Clients need to subclass it in order to wire calls to the | 9 * backend. Clients need to subclass it in order to wire calls to the |
10 * non-stub backends. | 10 * non-stub backends. |
11 */ | 11 */ |
12 goog.provide('devtools.InspectorController'); | 12 goog.provide('devtools.InspectorController'); |
13 | 13 |
14 | 14 |
15 /** | 15 /** |
16 * Creates inspector controller stub instance. | 16 * Creates inspector controller stub instance. |
17 * @constructor. | 17 * @constructor. |
18 */ | 18 */ |
19 devtools.InspectorController = function() { | 19 devtools.InspectorController = function() { |
20 /** | 20 /** |
21 * @type {boolean} | 21 * @type {boolean} |
22 */ | 22 */ |
23 this.searchingForNode_ = false; | 23 this.searchingForNode_ = false; |
24 | 24 |
25 /** | 25 /** |
26 * @type {boolean} | 26 * @type {boolean} |
27 */ | 27 */ |
28 this.windowVisible_ = true; | 28 this.windowVisible_ = true; |
29 | 29 |
30 /** | 30 /** |
31 * @type {number} | 31 * @type {number} |
32 */ | 32 */ |
33 this.attachedWindowHeight_ = 0; | 33 this.attachedWindowHeight_ = 0; |
34 | 34 |
35 /** | 35 /** |
36 * @type {boolean} | 36 * @type {boolean} |
37 */ | 37 */ |
38 this.debuggerEnabled_ = true; | 38 this.debuggerEnabled_ = true; |
39 | 39 |
40 /** | 40 /** |
41 * @type {boolean} | 41 * @type {boolean} |
42 */ | 42 */ |
43 this.profilerEnabled_ = true; | 43 this.profilerEnabled_ = true; |
| 44 |
| 45 /** |
| 46 * @type {boolean} |
| 47 */ |
| 48 this.resourceTrackingEnabled_ = false; |
44 }; | 49 }; |
45 | 50 |
46 | 51 |
47 /** | 52 /** |
48 * Wraps javascript callback. | 53 * Wraps javascript callback. |
49 * @param {function():undefined} func The callback to wrap. | 54 * @param {function():undefined} func The callback to wrap. |
50 * @return {function():undefined} Callback wrapper. | 55 * @return {function():undefined} Callback wrapper. |
51 */ | 56 */ |
52 devtools.InspectorController.prototype.wrapCallback = function f(func) { | 57 devtools.InspectorController.prototype.wrapCallback = function f(func) { |
53 // Just return as is. | 58 // Just return as is. |
54 return func; | 59 return func; |
55 }; | 60 }; |
56 | 61 |
57 | 62 |
58 /** | 63 /** |
59 * @return {boolean} True iff inspector window is currently visible. | 64 * @return {boolean} True iff inspector window is currently visible. |
60 */ | 65 */ |
61 devtools.InspectorController.prototype.isWindowVisible = function() { | 66 devtools.InspectorController.prototype.isWindowVisible = function() { |
62 return this.windowVisible_; | 67 return this.windowVisible_; |
63 }; | 68 }; |
64 | 69 |
65 | 70 |
66 /** | 71 /** |
67 * @return {string} Platform identifier. | 72 * @return {string} Platform identifier. |
68 */ | 73 */ |
69 devtools.InspectorController.prototype.platform = function() { | 74 devtools.InspectorController.prototype.platform = function() { |
70 return 'windows'; | 75 return 'windows'; |
71 }; | 76 }; |
72 | 77 |
73 | 78 |
74 /** | 79 /** |
75 * Closes inspector window. | 80 * Closes inspector window. |
76 */ | 81 */ |
77 devtools.InspectorController.prototype.closeWindow = function() { | 82 devtools.InspectorController.prototype.closeWindow = function() { |
78 this.windowVisible_ = false; | 83 this.windowVisible_ = false; |
79 }; | 84 }; |
80 | 85 |
81 | 86 |
82 /** | 87 /** |
83 * Attaches frontend to the backend. | 88 * Attaches frontend to the backend. |
84 */ | 89 */ |
85 devtools.InspectorController.prototype.attach = function() { | 90 devtools.InspectorController.prototype.attach = function() { |
86 }; | 91 }; |
87 | 92 |
88 | 93 |
89 /** | 94 /** |
90 * Detaches frontend from the backend. | 95 * Detaches frontend from the backend. |
91 */ | 96 */ |
92 devtools.InspectorController.prototype.detach = function() { | 97 devtools.InspectorController.prototype.detach = function() { |
93 }; | 98 }; |
94 | 99 |
95 | 100 |
96 /** | 101 /** |
| 102 * Tell host that the active panel has changed. |
| 103 * @param {string} panel Panel name that was last active. |
| 104 */ |
| 105 devtools.InspectorController.prototype.storeLastActivePanel = function(panel) { |
| 106 }; |
| 107 |
| 108 |
| 109 /** |
97 * Clears console message log in the backend. | 110 * Clears console message log in the backend. |
98 */ | 111 */ |
99 devtools.InspectorController.prototype.clearMessages = function() { | 112 devtools.InspectorController.prototype.clearMessages = function() { |
100 }; | 113 }; |
101 | 114 |
102 | 115 |
103 /** | 116 /** |
104 * Returns true iff browser is currently in the search for node mode. | 117 * Returns true iff browser is currently in the search for node mode. |
105 * @return {boolean} True is currently searching for a node. | 118 * @return {boolean} True is currently searching for a node. |
106 */ | 119 */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 }; | 158 }; |
146 | 159 |
147 | 160 |
148 /** | 161 /** |
149 * Adds resource with given identifier into the given iframe element. | 162 * Adds resource with given identifier into the given iframe element. |
150 * @param {number} identifier Identifier of the resource to add into the frame. | 163 * @param {number} identifier Identifier of the resource to add into the frame. |
151 * @param {Element} element Element to add resource content to. | 164 * @param {Element} element Element to add resource content to. |
152 */ | 165 */ |
153 devtools.InspectorController.prototype.addResourceSourceToFrame = | 166 devtools.InspectorController.prototype.addResourceSourceToFrame = |
154 function(identifier, element) { | 167 function(identifier, element) { |
155 return false; | |
156 }; | 168 }; |
157 | 169 |
158 | 170 |
159 /** | 171 /** |
160 * Adds given source of a given mimeType into the given iframe element. | 172 * Adds given source of a given mimeType into the given iframe element. |
161 * @param {string} mimeType MIME type of the content to be added. | 173 * @param {string} mimeType MIME type of the content to be added. |
162 * @param {string} source String content to be added. | 174 * @param {string} source String content to be added. |
163 * @param {Element} element Element to add resource content to. | 175 * @param {Element} element Element to add resource content to. |
164 */ | 176 */ |
165 devtools.InspectorController.prototype.addSourceToFrame = | 177 devtools.InspectorController.prototype.addSourceToFrame = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 */ | 220 */ |
209 devtools.InspectorController.prototype.loaded = function() { | 221 devtools.InspectorController.prototype.loaded = function() { |
210 // Does nothing in stub. | 222 // Does nothing in stub. |
211 }; | 223 }; |
212 | 224 |
213 | 225 |
214 /** | 226 /** |
215 * @return {string} Url of the i18n-ed strings map. | 227 * @return {string} Url of the i18n-ed strings map. |
216 */ | 228 */ |
217 devtools.InspectorController.prototype.localizedStringsURL = function() { | 229 devtools.InspectorController.prototype.localizedStringsURL = function() { |
218 return undefined; | 230 return undefined; |
219 }; | 231 }; |
220 | 232 |
221 | 233 |
222 /** | 234 /** |
223 * @return {boolean} True iff window is currently unloading. | 235 * @return {boolean} True iff window is currently unloading. |
224 */ | 236 */ |
225 devtools.InspectorController.prototype.windowUnloading = function() { | 237 devtools.InspectorController.prototype.windowUnloading = function() { |
226 return false; | 238 return false; |
227 }; | 239 }; |
228 | 240 |
229 | 241 |
230 /** | 242 /** |
231 * @return {string} Identifiers of the panels that should be hidden. | 243 * @return {string} Identifiers of the panels that should be hidden. |
232 */ | 244 */ |
233 devtools.InspectorController.prototype.hiddenPanels = function() { | 245 devtools.InspectorController.prototype.hiddenPanels = function() { |
234 return ''; | 246 return ''; |
235 }; | 247 }; |
236 | 248 |
237 | 249 |
238 /** | 250 /** |
239 * @return {boolean} True iff debugger is enabled. | 251 * @return {boolean} True iff debugger is enabled. |
240 */ | 252 */ |
241 devtools.InspectorController.prototype.debuggerEnabled = function() { | 253 devtools.InspectorController.prototype.debuggerEnabled = function() { |
242 return this.debuggerEnabled_; | 254 return this.debuggerEnabled_; |
243 }; | 255 }; |
244 | 256 |
245 | 257 |
246 /** | 258 /** |
| 259 * Enables resource tracking. |
| 260 */ |
| 261 devtools.InspectorController.prototype.enableResourceTracking = function() { |
| 262 this.resourceTrackingEnabled_ = true; |
| 263 WebInspector.resourceTrackingWasEnabled(); |
| 264 }; |
| 265 |
| 266 |
| 267 /** |
| 268 * Disables resource tracking. |
| 269 */ |
| 270 devtools.InspectorController.prototype.disableResourceTracking = function() { |
| 271 this.resourceTrackingEnabled_ = false; |
| 272 WebInspector.resourceTrackingWasDisabled(); |
| 273 }; |
| 274 |
| 275 |
| 276 /** |
| 277 * @return {boolean} True iff resource tracking is enabled. |
| 278 */ |
| 279 devtools.InspectorController.prototype.resourceTrackingEnabled = function() { |
| 280 return this.resourceTrackingEnabled_; |
| 281 }; |
| 282 |
| 283 |
| 284 /** |
247 * Enables debugger. | 285 * Enables debugger. |
248 */ | 286 */ |
249 devtools.InspectorController.prototype.enableDebugger = function() { | 287 devtools.InspectorController.prototype.enableDebugger = function() { |
250 this.debuggerEnabled_ = true; | 288 this.debuggerEnabled_ = true; |
251 }; | 289 }; |
252 | 290 |
253 | 291 |
254 /** | 292 /** |
255 * Disables debugger. | 293 * Disables debugger. |
256 */ | 294 */ |
(...skipping 27 matching lines...) Expand all Loading... |
284 */ | 322 */ |
285 devtools.InspectorController.prototype.pauseInDebugger = function() { | 323 devtools.InspectorController.prototype.pauseInDebugger = function() { |
286 // Does nothing in stub. | 324 // Does nothing in stub. |
287 }; | 325 }; |
288 | 326 |
289 | 327 |
290 /** | 328 /** |
291 * @return {boolean} True iff the debugger will pause execution on the | 329 * @return {boolean} True iff the debugger will pause execution on the |
292 * exceptions. | 330 * exceptions. |
293 */ | 331 */ |
294 devtools.InspectorController.prototype.pauseOnExceptions = function() { | 332 devtools.InspectorController.prototype.pauseOnExceptions = function() { |
295 // Does nothing in stub. | 333 // Does nothing in stub. |
296 return false; | 334 return false; |
297 }; | 335 }; |
298 | 336 |
299 | 337 |
300 /** | 338 /** |
301 * Tells whether to pause in the debugger on the exceptions or not. | 339 * Tells whether to pause in the debugger on the exceptions or not. |
302 * @param {boolean} value True iff execution should be stopped in the debugger | 340 * @param {boolean} value True iff execution should be stopped in the debugger |
303 * on the exceptions. | 341 * on the exceptions. |
304 */ | 342 */ |
305 devtools.InspectorController.prototype.setPauseOnExceptions = function(value) { | 343 devtools.InspectorController.prototype.setPauseOnExceptions = function(value) { |
306 }; | 344 }; |
307 | 345 |
308 | 346 |
309 /** | 347 /** |
310 * Tells backend to resume execution. | 348 * Tells backend to resume execution. |
311 */ | 349 */ |
312 devtools.InspectorController.prototype.resumeDebugger = function() { | 350 devtools.InspectorController.prototype.resumeDebugger = function() { |
313 }; | 351 }; |
314 | 352 |
315 | 353 |
316 /** | 354 /** |
317 * @return {boolean} True iff profiler is enabled. | 355 * @return {boolean} True iff profiler is enabled. |
318 */ | 356 */ |
319 devtools.InspectorController.prototype.profilerEnabled = function() { | 357 devtools.InspectorController.prototype.profilerEnabled = function() { |
320 return true; | 358 return true; |
321 }; | 359 }; |
322 | 360 |
323 | 361 |
324 /** | 362 /** |
325 * Enables profiler. | 363 * Enables profiler. |
326 */ | 364 */ |
327 devtools.InspectorController.prototype.enableProfiler = function() { | 365 devtools.InspectorController.prototype.enableProfiler = function() { |
328 this.profilerEnabled_ = true; | 366 this.profilerEnabled_ = true; |
329 }; | 367 }; |
330 | 368 |
(...skipping 25 matching lines...) Expand all Loading... |
356 /** | 394 /** |
357 * Tells backend to stop collecting profiler data. | 395 * Tells backend to stop collecting profiler data. |
358 */ | 396 */ |
359 devtools.InspectorController.prototype.stopProfiling = function() { | 397 devtools.InspectorController.prototype.stopProfiling = function() { |
360 }; | 398 }; |
361 | 399 |
362 | 400 |
363 /** | 401 /** |
364 * @return {Array.<Object>} Profile snapshots array. | 402 * @return {Array.<Object>} Profile snapshots array. |
365 */ | 403 */ |
366 devtools.InspectorController.prototype.profiles = function() { | 404 devtools.InspectorController.prototype.profiles = function() { |
367 return []; | 405 return []; |
368 }; | 406 }; |
369 | 407 |
370 | 408 |
371 /** | 409 /** |
372 * @return {Array.<string>} Database table names available offline. | 410 * @return {Array.<string>} Database table names available offline. |
373 */ | 411 */ |
374 devtools.InspectorController.prototype.databaseTableNames = | 412 devtools.InspectorController.prototype.databaseTableNames = |
375 function(database) { | 413 function(database) { |
376 return []; | 414 return []; |
377 }; | 415 }; |
(...skipping 13 matching lines...) Expand all Loading... |
391 devtools.InspectorController.prototype.stepOutOfFunctionInDebugger = | 429 devtools.InspectorController.prototype.stepOutOfFunctionInDebugger = |
392 function() {}; | 430 function() {}; |
393 | 431 |
394 | 432 |
395 /** | 433 /** |
396 * Tells backend to step over the statement in debugger. | 434 * Tells backend to step over the statement in debugger. |
397 */ | 435 */ |
398 devtools.InspectorController.prototype.stepOverStatementInDebugger = | 436 devtools.InspectorController.prototype.stepOverStatementInDebugger = |
399 function() { | 437 function() { |
400 }; | 438 }; |
| 439 |
| 440 var InspectorController = new devtools.InspectorController(); |
OLD | NEW |