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

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, 4 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 WebInspector.ProfilesPanelFactory.prototype = { 1255 WebInspector.ProfilesPanelFactory.prototype = {
1263 /** 1256 /**
1264 * @override 1257 * @override
1265 * @return {!WebInspector.Panel} 1258 * @return {!WebInspector.Panel}
1266 */ 1259 */
1267 createPanel: function() 1260 createPanel: function()
1268 { 1261 {
1269 return WebInspector.ProfilesPanel._instance(); 1262 return WebInspector.ProfilesPanel._instance();
1270 } 1263 }
1271 } 1264 }
1265
1266 /**
1267 * @constructor
1268 * @implements {WebInspector.ActionDelegate}
1269 */
1270 WebInspector.ProfilesPanel.RecordActionDelegate = function()
1271 {
1272 }
1273
1274 WebInspector.ProfilesPanel.RecordActionDelegate.prototype = {
1275 /**
1276 * @override
1277 * @param {!WebInspector.Context} context
1278 * @param {string} actionId
1279 */
1280 handleAction: function(context, actionId)
1281 {
1282 if (WebInspector.inspectorView.currentPanel().name !== "profiles")
1283 return;
1284 WebInspector.ProfilesPanel._instance().toggleRecordButton();
1285 }
1286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698