| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 * @override | 655 * @override |
| 656 * @return {?UI.ToolbarItem} | 656 * @return {?UI.ToolbarItem} |
| 657 */ | 657 */ |
| 658 item() { | 658 item() { |
| 659 return this._toolbarItem; | 659 return this._toolbarItem; |
| 660 } | 660 } |
| 661 }; | 661 }; |
| 662 | 662 |
| 663 /** | 663 /** |
| 664 * @implements {UI.ToolbarItem.Provider} | 664 * @implements {UI.ToolbarItem.Provider} |
| 665 * @unrestricted | |
| 666 */ | 665 */ |
| 667 Main.Main.MainMenuItem = class { | 666 Main.Main.MainMenuItem = class { |
| 668 constructor() { | 667 constructor() { |
| 669 this._item = new UI.ToolbarButton(Common.UIString('Customize and control Dev
Tools'), 'largeicon-menu'); | 668 this._item = new UI.ToolbarMenuButton(this._handleContextMenu.bind(this), tr
ue); |
| 670 this._item.addEventListener(UI.ToolbarButton.Events.MouseDown, this._mouseDo
wn, this); | 669 this._item.setTitle(Common.UIString('Customize and control DevTools')); |
| 671 } | 670 } |
| 672 | 671 |
| 673 /** | 672 /** |
| 674 * @override | 673 * @override |
| 675 * @return {?UI.ToolbarItem} | 674 * @return {?UI.ToolbarItem} |
| 676 */ | 675 */ |
| 677 item() { | 676 item() { |
| 678 return this._item; | 677 return this._item; |
| 679 } | 678 } |
| 680 | 679 |
| 681 /** | 680 /** |
| 682 * @param {!Common.Event} event | 681 * @param {!UI.ContextMenu} contextMenu |
| 683 */ | 682 */ |
| 684 _mouseDown(event) { | 683 _handleContextMenu(contextMenu) { |
| 685 var contextMenu = new UI.ContextMenu( | |
| 686 /** @type {!Event} */ (event.data), true, this._item.element.totalOffset
Left(), | |
| 687 this._item.element.totalOffsetTop() + this._item.element.offsetHeight); | |
| 688 | |
| 689 if (Components.dockController.canDock()) { | 684 if (Components.dockController.canDock()) { |
| 690 var dockItemElement = createElementWithClass('div', 'flex-centered flex-au
to'); | 685 var dockItemElement = createElementWithClass('div', 'flex-centered flex-au
to'); |
| 691 var titleElement = dockItemElement.createChild('span', 'flex-auto'); | 686 var titleElement = dockItemElement.createChild('span', 'flex-auto'); |
| 692 titleElement.textContent = Common.UIString('Dock side'); | 687 titleElement.textContent = Common.UIString('Dock side'); |
| 693 var toggleDockSideShorcuts = UI.shortcutRegistry.shortcutDescriptorsForAct
ion('main.toggle-dock'); | 688 var toggleDockSideShorcuts = UI.shortcutRegistry.shortcutDescriptorsForAct
ion('main.toggle-dock'); |
| 694 titleElement.title = Common.UIString( | 689 titleElement.title = Common.UIString( |
| 695 'Placement of DevTools relative to the page. (%s to restore last posit
ion)', toggleDockSideShorcuts[0].name); | 690 'Placement of DevTools relative to the page. (%s to restore last posit
ion)', toggleDockSideShorcuts[0].name); |
| 696 dockItemElement.appendChild(titleElement); | 691 dockItemElement.appendChild(titleElement); |
| 697 var dockItemToolbar = new UI.Toolbar('', dockItemElement); | 692 var dockItemToolbar = new UI.Toolbar('', dockItemElement); |
| 698 dockItemToolbar.makeBlueOnHover(); | 693 dockItemToolbar.makeBlueOnHover(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if (descriptor['persistence'] !== 'closeable') | 734 if (descriptor['persistence'] !== 'closeable') |
| 740 continue; | 735 continue; |
| 741 if (descriptor['location'] !== 'drawer-view' && descriptor['location'] !==
'panel') | 736 if (descriptor['location'] !== 'drawer-view' && descriptor['location'] !==
'panel') |
| 742 continue; | 737 continue; |
| 743 moreTools.appendItem(extension.title(), UI.viewManager.showView.bind(UI.vi
ewManager, descriptor['id'])); | 738 moreTools.appendItem(extension.title(), UI.viewManager.showView.bind(UI.vi
ewManager, descriptor['id'])); |
| 744 } | 739 } |
| 745 | 740 |
| 746 var helpSubMenu = contextMenu.namedSubMenu('mainMenuHelp'); | 741 var helpSubMenu = contextMenu.namedSubMenu('mainMenuHelp'); |
| 747 helpSubMenu.appendAction('settings.documentation'); | 742 helpSubMenu.appendAction('settings.documentation'); |
| 748 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openInNe
wTab(Help.latestReleaseNote().link)); | 743 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openInNe
wTab(Help.latestReleaseNote().link)); |
| 749 contextMenu.show(); | |
| 750 } | 744 } |
| 751 }; | 745 }; |
| 752 | 746 |
| 753 Main.NetworkPanelIndicator = class { | 747 Main.NetworkPanelIndicator = class { |
| 754 constructor() { | 748 constructor() { |
| 755 // TODO: we should not access network from other modules. | 749 // TODO: we should not access network from other modules. |
| 756 if (!UI.inspectorView.hasPanel('network')) | 750 if (!UI.inspectorView.hasPanel('network')) |
| 757 return; | 751 return; |
| 758 var manager = SDK.multitargetNetworkManager; | 752 var manager = SDK.multitargetNetworkManager; |
| 759 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan
ged, updateVisibility); | 753 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan
ged, updateVisibility); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 * @override | 971 * @override |
| 978 * @return {?Element} | 972 * @return {?Element} |
| 979 */ | 973 */ |
| 980 settingElement() { | 974 settingElement() { |
| 981 return UI.SettingsUI.createSettingCheckbox( | 975 return UI.SettingsUI.createSettingCheckbox( |
| 982 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); | 976 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); |
| 983 } | 977 } |
| 984 }; | 978 }; |
| 985 | 979 |
| 986 new Main.Main(); | 980 new Main.Main(); |
| OLD | NEW |