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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 253 |
264 // It is important to kick controller lifetime after apps are instantiat
ed. | 254 // It is important to kick controller lifetime after apps are instantiat
ed. |
265 WebInspector.dockController.initialize(); | 255 WebInspector.dockController.initialize(); |
266 console.timeStamp("Main._presentUI"); | 256 console.timeStamp("Main._presentUI"); |
267 WebInspector.app.presentUI(document); | 257 WebInspector.app.presentUI(document); |
268 | 258 |
269 if (!WebInspector.isWorkerFrontend()) | 259 if (!WebInspector.isWorkerFrontend()) |
270 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); | 260 WebInspector.inspectElementModeController = new WebInspector.Inspect
ElementModeController(); |
271 this._createGlobalStatusBarItems(); | 261 this._createGlobalStatusBarItems(); |
272 | 262 |
| 263 InspectorAppHost.afterInspectorAppLoad(); |
273 InspectorFrontendHost.loadCompleted(); | 264 InspectorFrontendHost.loadCompleted(); |
274 | 265 |
275 // Give UI cycles to repaint, then proceed with creating connection. | 266 // Give UI cycles to repaint, then proceed with creating connection. |
276 setTimeout(this._createConnection.bind(this), 0); | 267 setTimeout(this._createConnection.bind(this), 0); |
277 }, | 268 }, |
278 | 269 |
279 _createConnection: function() | 270 _createConnection: function() |
280 { | 271 { |
281 console.timeStamp("Main._createConnection"); | 272 console.timeStamp("Main._createConnection"); |
282 InspectorBackend.loadFromJSONIfNeeded("../protocol.json"); | 273 InspectorBackend.loadFromJSONIfNeeded("../protocol.json"); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 /** | 883 /** |
893 * @param {!WebInspector.Event} event | 884 * @param {!WebInspector.Event} event |
894 */ | 885 */ |
895 _inspectNode: function(event) | 886 _inspectNode: function(event) |
896 { | 887 { |
897 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); | 888 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event
.data)); |
898 } | 889 } |
899 } | 890 } |
900 | 891 |
901 new WebInspector.Main(); | 892 new WebInspector.Main(); |
OLD | NEW |