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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); | 363 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); |
364 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); | 364 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceBinding); |
365 | 365 |
366 // Create settings before loading modules. | 366 // Create settings before loading modules. |
367 WebInspector.settings.initializeBackendSettings(); | 367 WebInspector.settings.initializeBackendSettings(); |
368 | 368 |
369 this._registerModules(); | 369 this._registerModules(); |
370 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); | 370 WebInspector.actionRegistry = new WebInspector.ActionRegistry(); |
371 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); | 371 WebInspector.shortcutRegistry = new WebInspector.ShortcutRegistry(WebIns
pector.actionRegistry); |
372 this._registerForwardedShortcuts(); | 372 this._registerForwardedShortcuts(); |
| 373 this._registerMessageSinkListener(); |
373 | 374 |
374 WebInspector.inspectorView = new WebInspector.InspectorView(); | 375 WebInspector.inspectorView = new WebInspector.InspectorView(); |
375 | 376 |
376 // Screencast controller creates a root view itself. | 377 // Screencast controller creates a root view itself. |
377 if (mainTarget.canScreencast) | 378 if (mainTarget.canScreencast) |
378 this._screencastController = new WebInspector.ScreencastController()
; | 379 this._screencastController = new WebInspector.ScreencastController()
; |
379 else | 380 else |
380 this._createRootView(); | 381 this._createRootView(); |
381 this._createGlobalStatusBarItems(); | 382 this._createGlobalStatusBarItems(); |
382 | 383 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 425 |
425 _registerForwardedShortcuts: function() | 426 _registerForwardedShortcuts: function() |
426 { | 427 { |
427 /** @const */ var forwardedActions = ["main.reload", "main.hard-reload"]
; | 428 /** @const */ var forwardedActions = ["main.reload", "main.hard-reload"]
; |
428 var actionKeys = WebInspector.shortcutRegistry.keysForActions(forwardedA
ctions).map(WebInspector.KeyboardShortcut.keyCodeAndModifiersFromKey); | 429 var actionKeys = WebInspector.shortcutRegistry.keysForActions(forwardedA
ctions).map(WebInspector.KeyboardShortcut.keyCodeAndModifiersFromKey); |
429 | 430 |
430 actionKeys.push({keyCode: WebInspector.KeyboardShortcut.Keys.F8.code}); | 431 actionKeys.push({keyCode: WebInspector.KeyboardShortcut.Keys.F8.code}); |
431 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys)
); | 432 InspectorFrontendHost.setWhitelistedShortcuts(JSON.stringify(actionKeys)
); |
432 }, | 433 }, |
433 | 434 |
| 435 _registerMessageSinkListener: function() |
| 436 { |
| 437 WebInspector.messageSink.addEventListener(WebInspector.MessageSink.Event
s.MessageAdded, messageAdded); |
| 438 |
| 439 /** |
| 440 * @param {!WebInspector.Event} event |
| 441 */ |
| 442 function messageAdded(event) |
| 443 { |
| 444 var message = /** @type {!WebInspector.MessageSink.Message} */ (even
t.data); |
| 445 if (message.show) |
| 446 WebInspector.actionRegistry.execute("console.show"); |
| 447 } |
| 448 }, |
| 449 |
434 _documentClick: function(event) | 450 _documentClick: function(event) |
435 { | 451 { |
436 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); | 452 var anchor = event.target.enclosingNodeOrSelfWithNodeName("a"); |
437 if (!anchor || !anchor.href) | 453 if (!anchor || !anchor.href) |
438 return; | 454 return; |
439 | 455 |
440 // Prevent the link from navigating, since we don't do any navigation by
following links normally. | 456 // Prevent the link from navigating, since we don't do any navigation by
following links normally. |
441 event.consume(true); | 457 event.consume(true); |
442 | 458 |
443 if (anchor.target === "_blank") { | 459 if (anchor.target === "_blank") { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 850 |
835 WebInspector.__defineGetter__("inspectedPageURL", function() | 851 WebInspector.__defineGetter__("inspectedPageURL", function() |
836 { | 852 { |
837 return WebInspector.resourceTreeModel.inspectedPageURL(); | 853 return WebInspector.resourceTreeModel.inspectedPageURL(); |
838 }); | 854 }); |
839 | 855 |
840 WebInspector.panel = function(name) | 856 WebInspector.panel = function(name) |
841 { | 857 { |
842 return WebInspector.inspectorView.panel(name); | 858 return WebInspector.inspectorView.panel(name); |
843 } | 859 } |
OLD | NEW |