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

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

Issue 1273363002: Devtools UI: Show multiple shortcuts, show more shortcuts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 mainContainer.element.appendChild(this.profileViews); 457 mainContainer.element.appendChild(this.profileViews);
458 458
459 this._toolbarElement = createElementWithClass("div", "profiles-toolbar"); 459 this._toolbarElement = createElementWithClass("div", "profiles-toolbar");
460 mainContainer.element.insertBefore(this._toolbarElement, mainContainer.eleme nt.firstChild); 460 mainContainer.element.insertBefore(this._toolbarElement, mainContainer.eleme nt.firstChild);
461 461
462 this.panelSidebarElement().classList.add("profiles-sidebar-tree-box"); 462 this.panelSidebarElement().classList.add("profiles-sidebar-tree-box");
463 var toolbarContainerLeft = createElementWithClass("div", "profiles-toolbar") ; 463 var toolbarContainerLeft = createElementWithClass("div", "profiles-toolbar") ;
464 this.panelSidebarElement().insertBefore(toolbarContainerLeft, this.panelSide barElement().firstChild); 464 this.panelSidebarElement().insertBefore(toolbarContainerLeft, this.panelSide barElement().firstChild);
465 var toolbar = new WebInspector.Toolbar(toolbarContainerLeft); 465 var toolbar = new WebInspector.Toolbar(toolbarContainerLeft);
466 466
467 this.recordButton = new WebInspector.ToolbarButton("", "record-toolbar-item" ); 467 this.recordButton = WebInspector.ToolbarButton.createActionButton("profiler. toggle-recording");
468 this.recordButton.addEventListener("click", this.toggleRecordButton, this);
469 toolbar.appendToolbarItem(this.recordButton); 468 toolbar.appendToolbarItem(this.recordButton);
470 469
471 this.clearResultsButton = new WebInspector.ToolbarButton(WebInspector.UIStri ng("Clear all profiles"), "clear-toolbar-item"); 470 this.clearResultsButton = new WebInspector.ToolbarButton(WebInspector.UIStri ng("Clear all profiles"), "clear-toolbar-item");
472 this.clearResultsButton.addEventListener("click", this._reset, this); 471 this.clearResultsButton.addEventListener("click", this._reset, this);
473 toolbar.appendToolbarItem(this.clearResultsButton); 472 toolbar.appendToolbarItem(this.clearResultsButton);
474 473
475 this._profileTypeToolbar = new WebInspector.Toolbar(this._toolbarElement); 474 this._profileTypeToolbar = new WebInspector.Toolbar(this._toolbarElement);
476 this._profileViewToolbar = new WebInspector.Toolbar(this._toolbarElement); 475 this._profileViewToolbar = new WebInspector.Toolbar(this._toolbarElement);
477 476
478 this._profileGroups = {}; 477 this._profileGroups = {};
479 this._launcherView = new WebInspector.MultiProfileLauncherView(this); 478 this._launcherView = new WebInspector.MultiProfileLauncherView(this);
480 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this); 479 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
481 480
482 this._profileToView = []; 481 this._profileToView = [];
483 this._typeIdToSidebarSection = {}; 482 this._typeIdToSidebarSection = {};
484 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 483 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
485 for (var i = 0; i < types.length; i++) 484 for (var i = 0; i < types.length; i++)
486 this._registerProfileType(types[i]); 485 this._registerProfileType(types[i]);
487 this._launcherView.restoreSelectedProfileType(); 486 this._launcherView.restoreSelectedProfileType();
488 this.profilesItemTreeElement.select(); 487 this.profilesItemTreeElement.select();
489 this._showLauncherView(); 488 this._showLauncherView();
490 489
491 this._createFileSelectorElement(); 490 this._createFileSelectorElement();
492 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true); 491 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true);
493 this._registerShortcuts();
494 492
495 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this); 493 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this);
496 } 494 }
497 495
498 WebInspector.ProfilesPanel.prototype = { 496 WebInspector.ProfilesPanel.prototype = {
499 /** 497 /**
500 * @override 498 * @override
501 * @return {?WebInspector.SearchableView} 499 * @return {?WebInspector.SearchableView}
502 */ 500 */
503 searchableView: function() 501 searchableView: function()
(...skipping 16 matching lines...) Expand all
520 var type = types[i]; 518 var type = types[i];
521 var extension = type.fileExtension(); 519 var extension = type.fileExtension();
522 if (!extension) 520 if (!extension)
523 continue; 521 continue;
524 if (fileName.endsWith(type.fileExtension())) 522 if (fileName.endsWith(type.fileExtension()))
525 return type; 523 return type;
526 } 524 }
527 return null; 525 return null;
528 }, 526 },
529 527
530 _registerShortcuts: function()
531 {
532 this.registerShortcuts(WebInspector.ShortcutsScreen.ProfilesPanelShortcu ts.StartStopRecording, this.toggleRecordButton.bind(this));
533 },
534
535 /** 528 /**
536 * @param {!File} file 529 * @param {!File} file
537 */ 530 */
538 _loadFromFile: function(file) 531 _loadFromFile: function(file)
539 { 532 {
540 this._createFileSelectorElement(); 533 this._createFileSelectorElement();
541 534
542 var profileType = this._findProfileTypeByExtension(file.name); 535 var profileType = this._findProfileTypeByExtension(file.name);
543 if (!profileType) { 536 if (!profileType) {
544 var extensions = []; 537 var extensions = [];
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 { 896 {
904 if (WebInspector.inspectorView.currentPanel() !== this) 897 if (WebInspector.inspectorView.currentPanel() !== this)
905 return; 898 return;
906 if (!error) 899 if (!error)
907 this.showObject(result, viewName); 900 this.showObject(result, viewName);
908 } 901 }
909 902
910 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Summa ry ^view"), revealInView.bind(this, "Summary")); 903 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Summa ry ^view"), revealInView.bind(this, "Summary"));
911 }, 904 },
912 905
906 wasShown: function()
907 {
908 WebInspector.context.setFlavor(WebInspector.ProfilesPanel, this);
909 },
910
911 willHide: function()
912 {
913 WebInspector.context.setFlavor(WebInspector.ProfilesPanel, null);
914 },
915
913 __proto__: WebInspector.PanelWithSidebar.prototype 916 __proto__: WebInspector.PanelWithSidebar.prototype
914 } 917 }
915 918
916 919
917 /** 920 /**
918 * @constructor 921 * @constructor
919 * @extends {WebInspector.SidebarSectionTreeElement} 922 * @extends {WebInspector.SidebarSectionTreeElement}
920 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate 923 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate
921 * @param {!WebInspector.ProfileType} profileType 924 * @param {!WebInspector.ProfileType} profileType
922 */ 925 */
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 WebInspector.ProfilesPanelFactory.prototype = { 1265 WebInspector.ProfilesPanelFactory.prototype = {
1263 /** 1266 /**
1264 * @override 1267 * @override
1265 * @return {!WebInspector.Panel} 1268 * @return {!WebInspector.Panel}
1266 */ 1269 */
1267 createPanel: function() 1270 createPanel: function()
1268 { 1271 {
1269 return WebInspector.ProfilesPanel._instance(); 1272 return WebInspector.ProfilesPanel._instance();
1270 } 1273 }
1271 } 1274 }
1275
1276 /**
1277 * @constructor
1278 * @implements {WebInspector.ActionDelegate}
1279 */
1280 WebInspector.ProfilesPanel.RecordActionDelegate = function()
1281 {
1282 }
1283
1284 WebInspector.ProfilesPanel.RecordActionDelegate.prototype = {
1285 /**
1286 * @override
1287 * @param {!WebInspector.Context} context
1288 * @param {string} actionId
1289 */
1290 handleAction: function(context, actionId)
1291 {
1292 var panel = WebInspector.context.flavor(WebInspector.ProfilesPanel);
1293 if (!panel || !(panel instanceof WebInspector.ProfilesPanel))
1294 return;
1295 panel.toggleRecordButton();
1296 }
1297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698