Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1519)

Side by Side Diff: Source/devtools/front_end/profiler/ProfilesPanel.js

Issue 720223002: DevTools: only allow status bar items in status bars. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }, 73 },
74 74
75 /** 75 /**
76 * @return {?string} 76 * @return {?string}
77 */ 77 */
78 fileExtension: function() 78 fileExtension: function()
79 { 79 {
80 return null; 80 return null;
81 }, 81 },
82 82
83 get statusBarItems() 83 /**
84 * @return {!Array.<!WebInspector.StatusBarItem>}
85 */
86 statusBarItems: function()
84 { 87 {
85 return []; 88 return [];
86 }, 89 },
87 90
88 get buttonTooltip() 91 get buttonTooltip()
89 { 92 {
90 return ""; 93 return "";
91 }, 94 },
92 95
93 get id() 96 get id()
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 449
447 this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(t his); 450 this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(t his);
448 this.sidebarTree.setFocusable(false); 451 this.sidebarTree.setFocusable(false);
449 this.sidebarTree.appendChild(this.profilesItemTreeElement); 452 this.sidebarTree.appendChild(this.profilesItemTreeElement);
450 453
451 this.profileViews = createElement("div"); 454 this.profileViews = createElement("div");
452 this.profileViews.id = "profile-views"; 455 this.profileViews.id = "profile-views";
453 this.profileViews.classList.add("vbox"); 456 this.profileViews.classList.add("vbox");
454 mainView.element.appendChild(this.profileViews); 457 mainView.element.appendChild(this.profileViews);
455 458
456 var statusBarContainer = createElementWithClass("div", "profiles-status-bar" ); 459 this._statusBarElement = createElementWithClass("div", "profiles-status-bar" );
457 mainView.element.insertBefore(statusBarContainer, mainView.element.firstChil d); 460 mainView.element.insertBefore(this._statusBarElement, mainView.element.first Child);
458 this._statusBarElement = statusBarContainer.createChild("div", "status-bar") ;
459 461
460 this.sidebarElement().classList.add("profiles-sidebar-tree-box"); 462 this.sidebarElement().classList.add("profiles-sidebar-tree-box");
461 var statusBarContainerLeft = createElementWithClass("div", "profiles-status- bar"); 463 var statusBarContainerLeft = createElementWithClass("div", "profiles-status- bar");
462 this.sidebarElement().insertBefore(statusBarContainerLeft, this.sidebarEleme nt().firstChild); 464 this.sidebarElement().insertBefore(statusBarContainerLeft, this.sidebarEleme nt().firstChild);
463 this._statusBarButtons = statusBarContainerLeft.createChild("div", "status-b ar"); 465 var statusBar = new WebInspector.StatusBar(statusBarContainerLeft);
464 466
465 this.recordButton = new WebInspector.StatusBarButton("", "record-profile-sta tus-bar-item"); 467 this.recordButton = new WebInspector.StatusBarButton("", "record-profile-sta tus-bar-item");
466 this.recordButton.addEventListener("click", this.toggleRecordButton, this); 468 this.recordButton.addEventListener("click", this.toggleRecordButton, this);
467 this._statusBarButtons.appendChild(this.recordButton.element); 469 statusBar.appendStatusBarItem(this.recordButton);
468 470
469 this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UISt ring("Clear all profiles."), "clear-status-bar-item"); 471 this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UISt ring("Clear all profiles."), "clear-status-bar-item");
470 this.clearResultsButton.addEventListener("click", this._reset, this); 472 this.clearResultsButton.addEventListener("click", this._reset, this);
471 this._statusBarButtons.appendChild(this.clearResultsButton.element); 473 statusBar.appendStatusBarItem(this.clearResultsButton);
472 474
473 this._profileTypeStatusBarItemsContainer = this._statusBarElement.createChil d("div"); 475 this._profileTypeStatusBar = new WebInspector.StatusBar(this._statusBarEleme nt);
474 this._profileViewStatusBarItemsContainer = this._statusBarElement.createChil d("div"); 476 this._profileViewStatusBar = new WebInspector.StatusBar(this._statusBarEleme nt);
475 477
476 this._profileGroups = {}; 478 this._profileGroups = {};
477 this._launcherView = new WebInspector.MultiProfileLauncherView(this); 479 this._launcherView = new WebInspector.MultiProfileLauncherView(this);
478 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this); 480 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
479 481
480 this._profileToView = []; 482 this._profileToView = [];
481 this._typeIdToSidebarSection = {}; 483 this._typeIdToSidebarSection = {};
482 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 484 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
483 for (var i = 0; i < types.length; i++) 485 for (var i = 0; i < types.length; i++)
484 this._registerProfileType(types[i]); 486 this._registerProfileType(types[i]);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 */ 612 */
611 _onProfileTypeSelected: function(event) 613 _onProfileTypeSelected: function(event)
612 { 614 {
613 this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (ev ent.data); 615 this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (ev ent.data);
614 this._updateProfileTypeSpecificUI(); 616 this._updateProfileTypeSpecificUI();
615 }, 617 },
616 618
617 _updateProfileTypeSpecificUI: function() 619 _updateProfileTypeSpecificUI: function()
618 { 620 {
619 this._updateRecordButton(this.recordButton.toggled()); 621 this._updateRecordButton(this.recordButton.toggled());
620 this._profileTypeStatusBarItemsContainer.removeChildren(); 622 this._profileTypeStatusBar.removeStatusBarItems();
apavlov 2014/11/14 09:36:08 clear() ?
pfeldman 2014/11/14 09:37:19 Acknowledged.
621 var statusBarItems = this._selectedProfileType.statusBarItems; 623 var statusBarItems = this._selectedProfileType.statusBarItems();
622 if (statusBarItems) { 624 for (var i = 0; i < statusBarItems.length; ++i)
623 for (var i = 0; i < statusBarItems.length; ++i) 625 this._profileTypeStatusBar.appendStatusBarItem(statusBarItems[i]);
624 this._profileTypeStatusBarItemsContainer.appendChild(statusBarIt ems[i]);
625 }
626 }, 626 },
627 627
628 _reset: function() 628 _reset: function()
629 { 629 {
630 WebInspector.Panel.prototype.reset.call(this); 630 WebInspector.Panel.prototype.reset.call(this);
631 631
632 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 632 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
633 for (var i = 0; i < types.length; i++) 633 for (var i = 0; i < types.length; i++)
634 types[i]._reset(); 634 types[i]._reset();
635 635
636 delete this.visibleView; 636 delete this.visibleView;
637 637
638 this._profileGroups = {}; 638 this._profileGroups = {};
639 this._updateRecordButton(false); 639 this._updateRecordButton(false);
640 this._launcherView.profileFinished(); 640 this._launcherView.profileFinished();
641 641
642 this.sidebarTree.element.classList.remove("some-expandable"); 642 this.sidebarTree.element.classList.remove("some-expandable");
643 643
644 this._launcherView.detach(); 644 this._launcherView.detach();
645 this.profileViews.removeChildren(); 645 this.profileViews.removeChildren();
646 this._profileViewStatusBarItemsContainer.removeChildren(); 646 this._profileViewStatusBar.removeStatusBarItems();
647 647
648 this.removeAllListeners(); 648 this.removeAllListeners();
649 649
650 this.recordButton.setVisible(true); 650 this.recordButton.setVisible(true);
651 this._profileViewStatusBarItemsContainer.classList.remove("hidden"); 651 this._profileViewStatusBar.element.classList.remove("hidden");
652 this.clearResultsButton.element.classList.remove("hidden"); 652 this.clearResultsButton.element.classList.remove("hidden");
653 this.profilesItemTreeElement.select(); 653 this.profilesItemTreeElement.select();
654 this._showLauncherView(); 654 this._showLauncherView();
655 }, 655 },
656 656
657 _showLauncherView: function() 657 _showLauncherView: function()
658 { 658 {
659 this.closeVisibleView(); 659 this.closeVisibleView();
660 this._profileViewStatusBarItemsContainer.removeChildren(); 660 this._profileViewStatusBar.removeStatusBarItems();
661 this._launcherView.show(this.profileViews); 661 this._launcherView.show(this.profileViews);
662 this.visibleView = this._launcherView; 662 this.visibleView = this._launcherView;
663 }, 663 },
664 664
665 /** 665 /**
666 * @param {!WebInspector.ProfileType} profileType 666 * @param {!WebInspector.ProfileType} profileType
667 */ 667 */
668 _registerProfileType: function(profileType) 668 _registerProfileType: function(profileType)
669 { 669 {
670 this._launcherView.addProfileType(profileType); 670 this._launcherView.addProfileType(profileType);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 793
794 view.show(this.profileViews); 794 view.show(this.profileViews);
795 view.focus(); 795 view.focus();
796 796
797 this.visibleView = view; 797 this.visibleView = view;
798 798
799 var profileTypeSection = this._typeIdToSidebarSection[profile.profileTyp e().id]; 799 var profileTypeSection = this._typeIdToSidebarSection[profile.profileTyp e().id];
800 var sidebarElement = profileTypeSection.sidebarElementForProfile(profile ); 800 var sidebarElement = profileTypeSection.sidebarElementForProfile(profile );
801 sidebarElement.revealAndSelect(); 801 sidebarElement.revealAndSelect();
802 802
803 this._profileViewStatusBarItemsContainer.removeChildren(); 803 this._profileViewStatusBar.removeStatusBarItems();
804 804
805 var statusBarItems = view.statusBarItems; 805 var statusBarItems = view.statusBarItems();
806 if (statusBarItems) 806 for (var i = 0; i < statusBarItems.length; ++i)
807 for (var i = 0; i < statusBarItems.length; ++i) 807 this._profileViewStatusBar.appendStatusBarItem(statusBarItems[i]);
808 this._profileViewStatusBarItemsContainer.appendChild(statusBarIt ems[i]);
809 808
810 return view; 809 return view;
811 }, 810 },
812 811
813 /** 812 /**
814 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId 813 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId
815 * @param {string} perspectiveName 814 * @param {string} perspectiveName
816 */ 815 */
817 showObject: function(snapshotObjectId, perspectiveName) 816 showObject: function(snapshotObjectId, perspectiveName)
818 { 817 {
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 1252
1254 WebInspector.ProfilesPanelFactory.prototype = { 1253 WebInspector.ProfilesPanelFactory.prototype = {
1255 /** 1254 /**
1256 * @return {!WebInspector.Panel} 1255 * @return {!WebInspector.Panel}
1257 */ 1256 */
1258 createPanel: function() 1257 createPanel: function()
1259 { 1258 {
1260 return WebInspector.ProfilesPanel._instance(); 1259 return WebInspector.ProfilesPanel._instance();
1261 } 1260 }
1262 } 1261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698