OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @implements {InspectorAgent.Dispatcher} | 33 * @implements {InspectorAgent.Dispatcher} |
34 * @implements {WebInspector.Console.UIDelegate} | 34 * @implements {WebInspector.Console.UIDelegate} |
35 * @suppressGlobalPropertiesCheck | 35 * @suppressGlobalPropertiesCheck |
36 */ | 36 */ |
37 WebInspector.Main = function() | 37 WebInspector.Main = function() |
38 { | 38 { |
39 var boundListener = windowLoaded.bind(this); | 39 if (!InspectorAppHost) { |
40 WebInspector.console.setUIDelegate(this); | 40 console.error("Inspector should be embedded."); |
41 if (document.readyState === "complete") { | |
42 this._loaded(); | |
43 return; | 41 return; |
44 } | 42 } |
45 | 43 InspectorAppHost.beforeInspectorAppLoad(); |
46 /** | 44 WebInspector.console.setUIDelegate(this); |
47 * @suppressGlobalPropertiesCheck | 45 runOnWindowLoad(this._loaded.bind(this)); |
48 * @this {WebInspector.Main} | |
49 */ | |
50 function windowLoaded() | |
51 { | |
52 this._loaded(); | |
53 window.removeEventListener("DOMContentLoaded", boundListener, false); | |
54 } | |
55 window.addEventListener("DOMContentLoaded", boundListener, false); | |
56 } | 46 } |
57 | 47 |
58 WebInspector.Main.prototype = { | 48 WebInspector.Main.prototype = { |
59 /** | 49 /** |
60 * @return {!Promise.<undefined>} | 50 * @return {!Promise.<undefined>} |
61 */ | 51 */ |
62 showConsole: function() | 52 showConsole: function() |
63 { | 53 { |
64 return WebInspector.Revealer.revealPromise(WebInspector.console); | 54 return WebInspector.Revealer.revealPromise(WebInspector.console); |
65 }, | 55 }, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 249 |
260 // It is important to kick controller lifetime after apps are instantiat
ed. | 250 // It is important to kick controller lifetime after apps are instantiat
ed. |
261 WebInspector.dockController.initialize(); | 251 WebInspector.dockController.initialize(); |
262 console.timeStamp("Main._presentUI"); | 252 console.timeStamp("Main._presentUI"); |
263 WebInspector.app.presentUI(document); | 253 WebInspector.app.presentUI(document); |
264 | 254 |
265 if (!WebInspector.isWorkerFrontend()) | 255 if (!WebInspector.isWorkerFrontend()) |
266 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); | 256 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); |
267 this._createGlobalStatusBarItems(); | 257 this._createGlobalStatusBarItems(); |
268 | 258 |
| 259 InspectorAppHost.afterInspectorAppLoad(); |
269 InspectorFrontendHost.loadCompleted(); | 260 InspectorFrontendHost.loadCompleted(); |
270 | 261 |
271 // Give UI cycles to repaint, then proceed with creating connection. | 262 // Give UI cycles to repaint, then proceed with creating connection. |
272 setTimeout(this._createConnection.bind(this), 0); | 263 setTimeout(this._createConnection.bind(this), 0); |
273 }, | 264 }, |
274 | 265 |
275 _createConnection: function() | 266 _createConnection: function() |
276 { | 267 { |
277 console.timeStamp("Main._createConnection"); | 268 console.timeStamp("Main._createConnection"); |
278 InspectorBackend.loadFromJSONIfNeeded("../protocol.json"); | 269 InspectorBackend.loadFromJSONIfNeeded("../protocol.json"); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 /** | 879 /** |
889 * @param {!WebInspector.Event} event | 880 * @param {!WebInspector.Event} event |
890 */ | 881 */ |
891 _inspectNode: function(event) | 882 _inspectNode: function(event) |
892 { | 883 { |
893 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); | 884 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); |
894 } | 885 } |
895 } | 886 } |
896 | 887 |
897 new WebInspector.Main(); | 888 new WebInspector.Main(); |
OLD | NEW |