Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 691 _createDebugToolbar: function() | 691 _createDebugToolbar: function() |
| 692 { | 692 { |
| 693 var debugToolbar = new WebInspector.StatusBar(); | 693 var debugToolbar = new WebInspector.StatusBar(); |
| 694 debugToolbar.element.classList.add("scripts-debug-toolbar"); | 694 debugToolbar.element.classList.add("scripts-debug-toolbar"); |
| 695 | 695 |
| 696 var title, handler; | 696 var title, handler; |
| 697 | 697 |
| 698 // Run snippet. | 698 // Run snippet. |
| 699 title = WebInspector.UIString("Run snippet (%s)."); | 699 title = WebInspector.UIString("Run snippet (%s)."); |
| 700 handler = this._runSnippet.bind(this); | 700 handler = this._runSnippet.bind(this); |
| 701 this._runSnippetButton = this._createButtonAndRegisterShortcuts("play-st atus-bar-item", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcu ts.RunSnippet); | 701 this._runSnippetButton = this._createButtonAndRegisterShortcutsForAction ("play-status-bar-item", title, "debugger.run-snippet"); |
| 702 debugToolbar.appendStatusBarItem(this._runSnippetButton); | 702 debugToolbar.appendStatusBarItem(this._runSnippetButton); |
| 703 this._runSnippetButton.element.classList.add("hidden"); | 703 this._runSnippetButton.element.classList.add("hidden"); |
| 704 | 704 |
| 705 // Continue. | 705 // Continue. |
| 706 this._pauseButton = this._createButtonAndRegisterShortcutsForAction("pau se-status-bar-item", "", "debugger.toggle-pause"); | 706 this._pauseButton = this._createButtonAndRegisterShortcutsForAction("pau se-status-bar-item", "", "debugger.toggle-pause"); |
| 707 debugToolbar.appendStatusBarItem(this._pauseButton); | 707 debugToolbar.appendStatusBarItem(this._pauseButton); |
| 708 | 708 |
| 709 // Long resume. | 709 // Long resume. |
| 710 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms "); | 710 title = WebInspector.UIString("Resume with all pauses blocked for 500 ms "); |
| 711 this._longResumeButton = new WebInspector.StatusBarButton(title, "play-s tatus-bar-item"); | 711 this._longResumeButton = new WebInspector.StatusBarButton(title, "play-s tatus-bar-item"); |
| 712 this._longResumeButton.addEventListener("click", this._longResume.bind(t his), this); | 712 this._longResumeButton.addEventListener("click", this._longResume.bind(t his), this); |
| 713 | 713 |
| 714 // Step over. | 714 // Step over. |
| 715 title = WebInspector.UIString("Step over next function call (%s)."); | 715 title = WebInspector.UIString("Step over next function call (%s)."); |
| 716 handler = this._stepOverClicked.bind(this); | 716 this._stepOverButton = this._createButtonAndRegisterShortcutsForAction(" step-over-status-bar-item", title, "debugger.step-over"); |
| 717 this._stepOverButton = this._createButtonAndRegisterShortcuts("step-over -status-bar-item", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShor tcuts.StepOver); | |
| 718 debugToolbar.appendStatusBarItem(this._stepOverButton); | 717 debugToolbar.appendStatusBarItem(this._stepOverButton); |
| 719 | 718 |
| 720 // Step into. | 719 // Step into. |
| 721 title = WebInspector.UIString("Step into next function call (%s)."); | 720 title = WebInspector.UIString("Step into next function call (%s)."); |
| 722 handler = this._stepIntoClicked.bind(this); | 721 this._stepIntoButton = this._createButtonAndRegisterShortcutsForAction(" step-in-status-bar-item", title, "debugger.step-into"); |
| 723 this._stepIntoButton = this._createButtonAndRegisterShortcuts("step-in-s tatus-bar-item", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortc uts.StepInto); | |
| 724 debugToolbar.appendStatusBarItem(this._stepIntoButton); | 722 debugToolbar.appendStatusBarItem(this._stepIntoButton); |
| 725 | 723 |
| 726 // Step into async. | |
| 727 if (Runtime.experiments.isEnabled("stepIntoAsync")) { | |
|
pfeldman
2015/03/05 20:09:23
This is missing.
sergeyv
2015/03/06 09:33:58
Acknowledged.
| |
| 728 handler = this._stepIntoAsyncClicked.bind(this); | |
| 729 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShor tcuts.StepIntoAsync, handler); | |
| 730 } | |
| 731 | |
| 732 // Step out. | 724 // Step out. |
| 733 title = WebInspector.UIString("Step out of current function (%s)."); | 725 title = WebInspector.UIString("Step out of current function (%s)."); |
| 734 handler = this._stepOutClicked.bind(this); | 726 this._stepOutButton = this._createButtonAndRegisterShortcutsForAction("s tep-out-status-bar-item", title, "debugger.step-out"); |
| 735 this._stepOutButton = this._createButtonAndRegisterShortcuts("step-out-s tatus-bar-item", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortc uts.StepOut); | |
| 736 debugToolbar.appendStatusBarItem(this._stepOutButton); | 727 debugToolbar.appendStatusBarItem(this._stepOutButton); |
| 737 | 728 |
| 738 // Toggle Breakpoints | 729 // Toggle Breakpoints |
| 739 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "breakpoint-status-bar-item"); | 730 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp ector.UIString("Deactivate breakpoints."), "breakpoint-status-bar-item"); |
| 740 this._toggleBreakpointsButton.setToggled(false); | 731 this._toggleBreakpointsButton.setToggled(false); |
| 741 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); | 732 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea kpointsClicked, this); |
| 742 debugToolbar.appendStatusBarItem(this._toggleBreakpointsButton); | 733 debugToolbar.appendStatusBarItem(this._toggleBreakpointsButton); |
| 743 | 734 |
| 744 // Pause on Exception | 735 // Pause on Exception |
| 745 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "pau se-on-exceptions-status-bar-item"); | 736 this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "pau se-on-exceptions-status-bar-item"); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 759 | 750 |
| 760 return debugToolbarDrawer; | 751 return debugToolbarDrawer; |
| 761 }, | 752 }, |
| 762 | 753 |
| 763 /** | 754 /** |
| 764 * @param {!WebInspector.StatusBarButton} button | 755 * @param {!WebInspector.StatusBarButton} button |
| 765 * @param {string} buttonTitle | 756 * @param {string} buttonTitle |
| 766 */ | 757 */ |
| 767 _updateButtonTitle: function(button, buttonTitle) | 758 _updateButtonTitle: function(button, buttonTitle) |
| 768 { | 759 { |
| 769 var hasShortcuts = button.shortcuts && button.shortcuts.length; | 760 var hasShortcuts = button._shortcuts && button._shortcuts.length; |
| 770 if (hasShortcuts) | 761 if (hasShortcuts) |
| 771 button.setTitle(String.vsprintf(buttonTitle, [button.shortcuts[0].na me])); | 762 button.setTitle(String.vsprintf(buttonTitle, [button._shortcuts[0].n ame])); |
| 772 else | 763 else |
| 773 button.setTitle(buttonTitle); | 764 button.setTitle(buttonTitle); |
| 774 }, | 765 }, |
| 775 | 766 |
| 776 /** | 767 /** |
| 777 * @param {string} buttonId | 768 * @param {string} buttonId |
| 778 * @param {string} buttonTitle | 769 * @param {string} buttonTitle |
| 779 * @param {function(!Event=)} handler | |
| 780 * @param {!Array.<!WebInspector.KeyboardShortcut.Descriptor>} shortcuts | |
| 781 * @return {!WebInspector.StatusBarButton} | |
| 782 */ | |
| 783 _createButtonAndRegisterShortcuts: function(buttonId, buttonTitle, handler, shortcuts) | |
| 784 { | |
| 785 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); | |
| 786 button.element.addEventListener("click", handler, false); | |
| 787 button.shortcuts = shortcuts; | |
| 788 this._updateButtonTitle(button, buttonTitle); | |
| 789 this.registerShortcuts(shortcuts, handler); | |
| 790 return button; | |
| 791 }, | |
| 792 | |
| 793 /** | |
| 794 * @param {string} buttonId | |
| 795 * @param {string} buttonTitle | |
| 796 * @param {string} actionId | 770 * @param {string} actionId |
| 797 * @return {!WebInspector.StatusBarButton} | 771 * @return {!WebInspector.StatusBarButton} |
| 798 */ | 772 */ |
| 799 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle, actionId) | 773 _createButtonAndRegisterShortcutsForAction: function(buttonId, buttonTitle, actionId) |
| 800 { | 774 { |
| 801 function handler() | 775 function handler() |
| 802 { | 776 { |
| 803 WebInspector.actionRegistry.execute(actionId); | 777 WebInspector.actionRegistry.execute(actionId); |
| 804 } | 778 } |
| 805 var shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsForActi on(actionId); | 779 var button = new WebInspector.StatusBarButton(buttonTitle, buttonId); |
| 806 return this._createButtonAndRegisterShortcuts(buttonId, buttonTitle, han dler, shortcuts); | 780 button.element.addEventListener("click", handler, false); |
| 781 button._shortcuts = WebInspector.shortcutRegistry.shortcutDescriptorsFor Action(actionId); | |
| 782 this._updateButtonTitle(button, buttonTitle); | |
| 783 return button; | |
| 807 }, | 784 }, |
| 808 | 785 |
| 809 addToWatch: function(expression) | 786 addToWatch: function(expression) |
| 810 { | 787 { |
| 811 this.sidebarPanes.watchExpressions.addExpression(expression); | 788 this.sidebarPanes.watchExpressions.addExpression(expression); |
| 812 }, | 789 }, |
| 813 | 790 |
| 814 _installDebuggerSidebarController: function() | 791 _installDebuggerSidebarController: function() |
| 815 { | 792 { |
| 816 this.editorView.displayShowHideSidebarButton("navigator"); | 793 this.editorView.displayShowHideSidebarButton("navigator"); |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1450 */ | 1427 */ |
| 1451 handleAction: function() | 1428 handleAction: function() |
| 1452 { | 1429 { |
| 1453 var panel = WebInspector.SourcesPanel.instance(); | 1430 var panel = WebInspector.SourcesPanel.instance(); |
| 1454 WebInspector.inspectorView.setCurrentPanel(panel); | 1431 WebInspector.inspectorView.setCurrentPanel(panel); |
| 1455 panel.togglePause(); | 1432 panel.togglePause(); |
| 1456 return true; | 1433 return true; |
| 1457 } | 1434 } |
| 1458 } | 1435 } |
| 1459 | 1436 |
| 1437 /** | |
| 1438 * @constructor | |
| 1439 * @implements {WebInspector.ActionDelegate} | |
| 1440 * @param {function(this:WebInspector.SourcesPanel):boolean} handler | |
| 1441 */ | |
| 1442 WebInspector.SourcesPanel.BaseActionDelegate = function(handler) | |
| 1443 { | |
| 1444 this._handler = handler; | |
| 1445 } | |
| 1446 | |
| 1447 WebInspector.SourcesPanel.BaseActionDelegate.prototype = { | |
| 1448 /** | |
| 1449 * @override | |
| 1450 * @return {boolean} | |
| 1451 */ | |
| 1452 handleAction: function() | |
| 1453 { | |
| 1454 return this._handler.call(WebInspector.SourcesPanel.instance()); | |
| 1455 } | |
| 1456 } | |
| 1457 | |
| 1458 /** | |
| 1459 * @constructor | |
| 1460 * @extends {WebInspector.SourcesPanel.BaseActionDelegate} | |
| 1461 */ | |
| 1462 WebInspector.SourcesPanel.StepOverActionDelegate = function() | |
| 1463 { | |
| 1464 WebInspector.SourcesPanel.BaseActionDelegate.call(this, WebInspector.Sources Panel.prototype._stepOverClicked); | |
| 1465 } | |
| 1466 | |
| 1467 WebInspector.SourcesPanel.StepOverActionDelegate.prototype = { | |
| 1468 __proto__: WebInspector.SourcesPanel.BaseActionDelegate.prototype | |
| 1469 } | |
| 1470 | |
| 1471 /** | |
| 1472 * @constructor | |
| 1473 * @extends {WebInspector.SourcesPanel.BaseActionDelegate} | |
| 1474 */ | |
| 1475 WebInspector.SourcesPanel.StepIntoActionDelegate = function() | |
| 1476 { | |
| 1477 WebInspector.SourcesPanel.BaseActionDelegate.call(this, WebInspector.Sources Panel.prototype._stepIntoClicked); | |
| 1478 } | |
| 1479 | |
| 1480 WebInspector.SourcesPanel.StepIntoActionDelegate.prototype = { | |
| 1481 __proto__: WebInspector.SourcesPanel.BaseActionDelegate.prototype | |
| 1482 } | |
| 1483 | |
| 1484 /** | |
| 1485 * @constructor | |
| 1486 * @extends {WebInspector.SourcesPanel.BaseActionDelegate} | |
| 1487 */ | |
| 1488 WebInspector.SourcesPanel.StepIntoAsyncActionDelegate = function() | |
| 1489 { | |
| 1490 WebInspector.SourcesPanel.BaseActionDelegate.call(this, WebInspector.Sources Panel.prototype._stepIntoAsyncClicked); | |
| 1491 } | |
| 1492 | |
| 1493 WebInspector.SourcesPanel.StepIntoAsyncActionDelegate.prototype = { | |
| 1494 __proto__: WebInspector.SourcesPanel.BaseActionDelegate.prototype | |
| 1495 } | |
| 1496 | |
| 1497 /** | |
| 1498 * @constructor | |
| 1499 * @extends {WebInspector.SourcesPanel.BaseActionDelegate} | |
| 1500 */ | |
| 1501 WebInspector.SourcesPanel.StepOutActionDelegate = function() | |
| 1502 { | |
| 1503 WebInspector.SourcesPanel.BaseActionDelegate.call(this, WebInspector.Sources Panel.prototype._stepOutClicked); | |
| 1504 } | |
| 1505 | |
| 1506 WebInspector.SourcesPanel.StepOutActionDelegate.prototype = { | |
| 1507 __proto__: WebInspector.SourcesPanel.BaseActionDelegate.prototype | |
| 1508 } | |
| 1509 | |
| 1510 /** | |
| 1511 * @constructor | |
| 1512 * @extends {WebInspector.SourcesPanel.BaseActionDelegate} | |
| 1513 */ | |
| 1514 WebInspector.SourcesPanel.RunSnippetActionDelegate = function() | |
| 1515 { | |
| 1516 WebInspector.SourcesPanel.BaseActionDelegate.call(this, WebInspector.Sources Panel.prototype._runSnippet); | |
| 1517 } | |
| 1518 | |
| 1519 WebInspector.SourcesPanel.RunSnippetActionDelegate.prototype = { | |
| 1520 __proto__: WebInspector.SourcesPanel.BaseActionDelegate.prototype | |
| 1521 } | |
| 1522 | |
| 1460 WebInspector.SourcesPanel.show = function() | 1523 WebInspector.SourcesPanel.show = function() |
| 1461 { | 1524 { |
| 1462 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e()); | 1525 WebInspector.inspectorView.setCurrentPanel(WebInspector.SourcesPanel.instanc e()); |
| 1463 } | 1526 } |
| 1464 | 1527 |
| 1465 /** | 1528 /** |
| 1466 * @return {!WebInspector.SourcesPanel} | 1529 * @return {!WebInspector.SourcesPanel} |
| 1467 */ | 1530 */ |
| 1468 WebInspector.SourcesPanel.instance = function() | 1531 WebInspector.SourcesPanel.instance = function() |
| 1469 { | 1532 { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1483 WebInspector.SourcesPanelFactory.prototype = { | 1546 WebInspector.SourcesPanelFactory.prototype = { |
| 1484 /** | 1547 /** |
| 1485 * @override | 1548 * @override |
| 1486 * @return {!WebInspector.Panel} | 1549 * @return {!WebInspector.Panel} |
| 1487 */ | 1550 */ |
| 1488 createPanel: function() | 1551 createPanel: function() |
| 1489 { | 1552 { |
| 1490 return WebInspector.SourcesPanel.instance(); | 1553 return WebInspector.SourcesPanel.instance(); |
| 1491 } | 1554 } |
| 1492 } | 1555 } |
| OLD | NEW |