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

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 457
458 this._toolbarElement = createElementWithClass("div", "profiles-toolbar"); 458 this._toolbarElement = createElementWithClass("div", "profiles-toolbar");
459 mainContainer.element.insertBefore(this._toolbarElement, mainContainer.eleme nt.firstChild); 459 mainContainer.element.insertBefore(this._toolbarElement, mainContainer.eleme nt.firstChild);
460 460
461 this.panelSidebarElement().classList.add("profiles-sidebar-tree-box"); 461 this.panelSidebarElement().classList.add("profiles-sidebar-tree-box");
462 var toolbarContainerLeft = createElementWithClass("div", "profiles-toolbar") ; 462 var toolbarContainerLeft = createElementWithClass("div", "profiles-toolbar") ;
463 this.panelSidebarElement().insertBefore(toolbarContainerLeft, this.panelSide barElement().firstChild); 463 this.panelSidebarElement().insertBefore(toolbarContainerLeft, this.panelSide barElement().firstChild);
464 var toolbar = new WebInspector.Toolbar(toolbarContainerLeft); 464 var toolbar = new WebInspector.Toolbar(toolbarContainerLeft);
465 465
466 this.recordButton = new WebInspector.ToolbarButton("", "record-toolbar-item" ); 466 this.recordButton = new WebInspector.ToolbarButton("", "record-toolbar-item" );
467 this.recordButton.addEventListener("click", this.toggleRecordButton, this); 467 this.recordButton.setAction("profiler.toggle-recording");
468 toolbar.appendToolbarItem(this.recordButton); 468 toolbar.appendToolbarItem(this.recordButton);
469 469
470 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");
471 this.clearResultsButton.addEventListener("click", this._reset, this); 471 this.clearResultsButton.addEventListener("click", this._reset, this);
472 toolbar.appendToolbarItem(this.clearResultsButton); 472 toolbar.appendToolbarItem(this.clearResultsButton);
473 473
474 this._profileTypeToolbar = new WebInspector.Toolbar(this._toolbarElement); 474 this._profileTypeToolbar = new WebInspector.Toolbar(this._toolbarElement);
475 this._profileViewToolbar = new WebInspector.Toolbar(this._toolbarElement); 475 this._profileViewToolbar = new WebInspector.Toolbar(this._toolbarElement);
476 476
477 this._profileGroups = {}; 477 this._profileGroups = {};
478 this._launcherView = new WebInspector.MultiProfileLauncherView(this); 478 this._launcherView = new WebInspector.MultiProfileLauncherView(this);
479 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this); 479 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
480 480
481 this._profileToView = []; 481 this._profileToView = [];
482 this._typeIdToSidebarSection = {}; 482 this._typeIdToSidebarSection = {};
483 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 483 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
484 for (var i = 0; i < types.length; i++) 484 for (var i = 0; i < types.length; i++)
485 this._registerProfileType(types[i]); 485 this._registerProfileType(types[i]);
486 this._launcherView.restoreSelectedProfileType(); 486 this._launcherView.restoreSelectedProfileType();
487 this.profilesItemTreeElement.select(); 487 this.profilesItemTreeElement.select();
488 this._showLauncherView(); 488 this._showLauncherView();
489 489
490 this._createFileSelectorElement(); 490 this._createFileSelectorElement();
491 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true); 491 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true);
492 this._registerShortcuts();
493 492
494 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this); 493 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this);
495 } 494 }
496 495
497 WebInspector.ProfilesPanel.prototype = { 496 WebInspector.ProfilesPanel.prototype = {
498 /** 497 /**
499 * @override 498 * @override
500 * @return {?WebInspector.SearchableView} 499 * @return {?WebInspector.SearchableView}
501 */ 500 */
502 searchableView: function() 501 searchableView: function()
(...skipping 16 matching lines...) Expand all
519 var type = types[i]; 518 var type = types[i];
520 var extension = type.fileExtension(); 519 var extension = type.fileExtension();
521 if (!extension) 520 if (!extension)
522 continue; 521 continue;
523 if (fileName.endsWith(type.fileExtension())) 522 if (fileName.endsWith(type.fileExtension()))
524 return type; 523 return type;
525 } 524 }
526 return null; 525 return null;
527 }, 526 },
528 527
529 _registerShortcuts: function()
530 {
531 this.registerShortcuts(WebInspector.ShortcutsScreen.ProfilesPanelShortcu ts.StartStopRecording, this.toggleRecordButton.bind(this));
532 },
533
534 /** 528 /**
535 * @param {!File} file 529 * @param {!File} file
536 */ 530 */
537 _loadFromFile: function(file) 531 _loadFromFile: function(file)
538 { 532 {
539 this._createFileSelectorElement(); 533 this._createFileSelectorElement();
540 534
541 var profileType = this._findProfileTypeByExtension(file.name); 535 var profileType = this._findProfileTypeByExtension(file.name);
542 if (!profileType) { 536 if (!profileType) {
543 var extensions = []; 537 var extensions = [];
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 WebInspector.ProfilesPanelFactory.prototype = { 1255 WebInspector.ProfilesPanelFactory.prototype = {
1262 /** 1256 /**
1263 * @override 1257 * @override
1264 * @return {!WebInspector.Panel} 1258 * @return {!WebInspector.Panel}
1265 */ 1259 */
1266 createPanel: function() 1260 createPanel: function()
1267 { 1261 {
1268 return WebInspector.ProfilesPanel._instance(); 1262 return WebInspector.ProfilesPanel._instance();
1269 } 1263 }
1270 } 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