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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 window.removeEventListener("DOMContentLoaded", boundListener, false); | 45 window.removeEventListener("DOMContentLoaded", boundListener, false); |
46 } | 46 } |
47 window.addEventListener("DOMContentLoaded", boundListener, false); | 47 window.addEventListener("DOMContentLoaded", boundListener, false); |
48 } | 48 } |
49 | 49 |
50 WebInspector.Main.prototype = { | 50 WebInspector.Main.prototype = { |
51 _registerModules: function() | 51 _registerModules: function() |
52 { | 52 { |
53 var configuration; | 53 var configuration; |
54 if (!Capabilities.isMainFrontend) { | 54 if (!Capabilities.isMainFrontend) { |
55 configuration = ["sources", "timeline", "profiles", "console", "code
mirror"]; | 55 configuration = ["main", "sources", "timeline", "profiles", "console
", "codemirror"]; |
56 } else { | 56 } else { |
57 configuration = ["elements", "network", "sources", "timeline", "prof
iles", "resources", "audits", "console", "codemirror", "extensions"]; | 57 configuration = ["main", "elements", "network", "sources", "timeline
", "profiles", "resources", "audits", "console", "codemirror", "extensions", "se
ttings"]; |
58 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) | 58 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) |
59 configuration.push("layers"); | 59 configuration.push("layers"); |
60 } | 60 } |
61 WebInspector.moduleManager.registerModules(configuration); | 61 WebInspector.moduleManager.registerModules(configuration); |
62 }, | 62 }, |
63 | 63 |
64 _createGlobalStatusBarItems: function() | 64 _createGlobalStatusBarItems: function() |
65 { | 65 { |
66 if (WebInspector.inspectElementModeController) | 66 if (WebInspector.inspectElementModeController) |
67 WebInspector.inspectorView.appendToLeftToolbar(WebInspector.inspectE
lementModeController.toggleSearchButton.element); | 67 WebInspector.inspectorView.appendToLeftToolbar(WebInspector.inspectE
lementModeController.toggleSearchButton.element); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 new WebInspector.DebuggerScriptMapping(WebInspector.debuggerModel, WebIn
spector.workspace, WebInspector.networkWorkspaceProvider); | 329 new WebInspector.DebuggerScriptMapping(WebInspector.debuggerModel, WebIn
spector.workspace, WebInspector.networkWorkspaceProvider); |
330 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); | 330 WebInspector.liveEditSupport = new WebInspector.LiveEditSupport(WebInspe
ctor.workspace); |
331 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceProvider); | 331 new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel, WebInspecto
r.workspace, WebInspector.networkWorkspaceProvider); |
332 new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace
); | 332 new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace
); |
333 | 333 |
334 // Create settings before loading modules. | 334 // Create settings before loading modules. |
335 WebInspector.settings.initializeBackendSettings(); | 335 WebInspector.settings.initializeBackendSettings(); |
336 | 336 |
337 this._registerModules(); | 337 this._registerModules(); |
| 338 WebInspector.KeyboardShortcut.registerActions(); |
338 | 339 |
339 WebInspector.panels = {}; | 340 WebInspector.panels = {}; |
340 WebInspector.inspectorView = new WebInspector.InspectorView(); | 341 WebInspector.inspectorView = new WebInspector.InspectorView(); |
341 // Screencast controller creates a root view itself. | 342 // Screencast controller creates a root view itself. |
342 if (mainTarget.canScreencast) | 343 if (mainTarget.canScreencast) |
343 this._screencastController = new WebInspector.ScreencastController()
; | 344 this._screencastController = new WebInspector.ScreencastController()
; |
344 else | 345 else |
345 this._createRootView(); | 346 this._createRootView(); |
346 this._createGlobalStatusBarItems(); | 347 this._createGlobalStatusBarItems(); |
347 | 348 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 event.consume(true); | 527 event.consume(true); |
527 return; | 528 return; |
528 } | 529 } |
529 } | 530 } |
530 | 531 |
531 if (WebInspector.advancedSearchController.handleShortcut(event)) | 532 if (WebInspector.advancedSearchController.handleShortcut(event)) |
532 return; | 533 return; |
533 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.handleShortcut(event)) | 534 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.handleShortcut(event)) |
534 return; | 535 return; |
535 | 536 |
536 switch (event.keyIdentifier) { | |
537 case "U+004F": // O key | |
538 case "U+0050": // P key | |
539 if (!event.shiftKey && !event.altKey && WebInspector.KeyboardSho
rtcut.eventHasCtrlOrMeta(event)) { | |
540 // FIXME: Dependency violation. Introduce pluggable global s
hortcuts. | |
541 /** @type {!WebInspector.SourcesPanel} */ (WebInspector.insp
ectorView.showPanel("sources")).showGoToSourceDialog(); | |
542 event.consume(true); | |
543 } | |
544 break; | |
545 case "U+0052": // R key | |
546 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { | |
547 WebInspector.debuggerModel.skipAllPauses(true, true); | |
548 WebInspector.resourceTreeModel.reloadPage(event.shiftKey); | |
549 event.consume(true); | |
550 } | |
551 if (window.DEBUG && event.altKey) { | |
552 WebInspector.reload(); | |
553 return; | |
554 } | |
555 break; | |
556 case "F5": | |
557 if (!WebInspector.isMac()) { | |
558 WebInspector.resourceTreeModel.reloadPage(event.ctrlKey || e
vent.shiftKey); | |
559 event.consume(true); | |
560 } | |
561 break; | |
562 } | |
563 | |
564 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMe
ta(event) && | 537 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMe
ta(event) && |
565 !event.altKey && | 538 !event.altKey && |
566 !InspectorFrontendHost.isStub; | 539 !InspectorFrontendHost.isStub; |
567 if (isValidZoomShortcut && this._handleZoomEvent(event)) { | 540 if (isValidZoomShortcut && this._handleZoomEvent(event)) { |
568 event.consume(true); | 541 event.consume(true); |
569 return; | 542 return; |
570 } | 543 } |
571 | 544 WebInspector.KeyboardShortcut.handleShortcut(event); |
572 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.F1.code || | |
573 (event.keyCode === WebInspector.KeyboardShortcut.Keys.QuestionMark.c
ode && event.shiftKey && (!WebInspector.isBeingEdited(event.target) || event.met
aKey))) { | |
574 WebInspector.settingsController.showSettingsScreen(WebInspector.Sett
ingsScreen.Tabs.General); | |
575 event.consume(true); | |
576 return; | |
577 } | |
578 | |
579 var Esc = "U+001B"; | |
580 var doNotOpenDrawerOnEsc = WebInspector.experimentsSettings.doNotOpenDra
werOnEsc.isEnabled(); | |
581 if (event.keyIdentifier === Esc) { | |
582 if (WebInspector.inspectorView.drawerVisible()) | |
583 WebInspector.inspectorView.closeDrawer(); | |
584 else if (!doNotOpenDrawerOnEsc) | |
585 WebInspector.inspectorView.showDrawer(); | |
586 } | |
587 | |
588 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Tilde.code && e
vent.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) | |
589 WebInspector.console.show(); | |
590 }, | 545 }, |
591 | 546 |
592 _documentCanCopy: function(event) | 547 _documentCanCopy: function(event) |
593 { | 548 { |
594 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV
iew.currentPanel()["handleCopyEvent"]) | 549 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV
iew.currentPanel()["handleCopyEvent"]) |
595 event.preventDefault(); | 550 event.preventDefault(); |
596 }, | 551 }, |
597 | 552 |
598 _documentCopy: function(event) | 553 _documentCopy: function(event) |
599 { | 554 { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 WebInspector.evaluateForTestInFrontend(callId, script); | 670 WebInspector.evaluateForTestInFrontend(callId, script); |
716 } | 671 } |
717 } | 672 } |
718 | 673 |
719 WebInspector.reload = function() | 674 WebInspector.reload = function() |
720 { | 675 { |
721 InspectorAgent.reset(); | 676 InspectorAgent.reset(); |
722 window.location.reload(); | 677 window.location.reload(); |
723 } | 678 } |
724 | 679 |
| 680 /** |
| 681 * @constructor |
| 682 * @implements {WebInspector.ActionDelegate} |
| 683 */ |
| 684 WebInspector.Main.ReloadActionDelegate = function() |
| 685 { |
| 686 } |
| 687 |
| 688 WebInspector.Main.ReloadActionDelegate.prototype = { |
| 689 /** |
| 690 * @return {boolean} |
| 691 */ |
| 692 handleAction: function() |
| 693 { |
| 694 WebInspector.debuggerModel.skipAllPauses(true, true); |
| 695 WebInspector.resourceTreeModel.reloadPage(false); |
| 696 return true; |
| 697 } |
| 698 } |
| 699 |
| 700 /** |
| 701 * @constructor |
| 702 * @implements {WebInspector.ActionDelegate} |
| 703 */ |
| 704 WebInspector.Main.HardReloadActionDelegate = function() |
| 705 { |
| 706 } |
| 707 |
| 708 WebInspector.Main.HardReloadActionDelegate.prototype = { |
| 709 /** |
| 710 * @return {boolean} |
| 711 */ |
| 712 handleAction: function() |
| 713 { |
| 714 WebInspector.debuggerModel.skipAllPauses(true, true); |
| 715 WebInspector.resourceTreeModel.reloadPage(true); |
| 716 return true; |
| 717 } |
| 718 } |
| 719 |
| 720 /** |
| 721 * @constructor |
| 722 * @implements {WebInspector.ActionDelegate} |
| 723 */ |
| 724 WebInspector.Main.DebugReloadActionDelegate = function() |
| 725 { |
| 726 } |
| 727 |
| 728 WebInspector.Main.DebugReloadActionDelegate.prototype = { |
| 729 /** |
| 730 * @return {boolean} |
| 731 */ |
| 732 handleAction: function() |
| 733 { |
| 734 WebInspector.reload(); |
| 735 return true; |
| 736 } |
| 737 } |
| 738 |
725 new WebInspector.Main(); | 739 new WebInspector.Main(); |
726 | 740 |
727 window.DEBUG = true; | 741 window.DEBUG = true; |
OLD | NEW |