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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js

Issue 2881453003: DevTools: update buttons to new style (Closed)
Patch Set: fix test Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 29 matching lines...) Expand all
40 this._panel = profilesPanel; 40 this._panel = profilesPanel;
41 this.element.classList.add('profile-launcher-view', 'panel-enabler-view'); 41 this.element.classList.add('profile-launcher-view', 'panel-enabler-view');
42 42
43 this._contentElement = this.element.createChild('div', 'profile-launcher-vie w-content'); 43 this._contentElement = this.element.createChild('div', 'profile-launcher-vie w-content');
44 this._innerContentElement = this._contentElement.createChild('div'); 44 this._innerContentElement = this._contentElement.createChild('div');
45 var controlDiv = this._contentElement.createChild('div', 'hbox profile-launc her-control'); 45 var controlDiv = this._contentElement.createChild('div', 'hbox profile-launc her-control');
46 var targetDiv = controlDiv.createChild('div', 'hbox profile-launcher-target' ); 46 var targetDiv = controlDiv.createChild('div', 'hbox profile-launcher-target' );
47 targetDiv.createChild('div').textContent = Common.UIString('Target:'); 47 targetDiv.createChild('div').textContent = Common.UIString('Target:');
48 var targetsSelect = targetDiv.createChild('select', 'chrome-select'); 48 var targetsSelect = targetDiv.createChild('select', 'chrome-select');
49 new Profiler.TargetsComboBoxController(targetsSelect, targetDiv); 49 new Profiler.TargetsComboBoxController(targetsSelect, targetDiv);
50 this._controlButton = UI.createTextButton('', this._controlButtonClicked.bin d(this), 'profile-launcher-button'); 50 this._controlButton =
51 UI.createTextButton('', this._controlButtonClicked.bind(this), 'profile- launcher-button', true /* primary */);
51 this._contentElement.appendChild(this._controlButton); 52 this._contentElement.appendChild(this._controlButton);
52 this._recordButtonEnabled = true; 53 this._recordButtonEnabled = true;
53 this._loadButton = 54 this._loadButton =
54 UI.createTextButton(Common.UIString('Load'), this._loadButtonClicked.bin d(this), 'profile-launcher-button'); 55 UI.createTextButton(Common.UIString('Load'), this._loadButtonClicked.bin d(this), 'profile-launcher-button');
55 this._contentElement.appendChild(this._loadButton); 56 this._contentElement.appendChild(this._loadButton);
56 57
57 this._selectedProfileTypeSetting = Common.settings.createSetting('selectedPr ofileType', 'CPU'); 58 this._selectedProfileTypeSetting = Common.settings.createSetting('selectedPr ofileType', 'CPU');
58 this._header = this._innerContentElement.createChild('h1'); 59 this._header = this._innerContentElement.createChild('h1');
59 this._profileTypeSelectorForm = this._innerContentElement.createChild('form' ); 60 this._profileTypeSelectorForm = this._innerContentElement.createChild('form' );
60 this._innerContentElement.createChild('div', 'flexible-space'); 61 this._innerContentElement.createChild('div', 'flexible-space');
61 /** @type {!Map<string, !HTMLOptionElement>} */ 62 /** @type {!Map<string, !HTMLOptionElement>} */
62 this._typeIdToOptionElement = new Map(); 63 this._typeIdToOptionElement = new Map();
63 } 64 }
64 65
65 _loadButtonClicked() { 66 _loadButtonClicked() {
66 this._panel.showLoadFromFileDialog(); 67 this._panel.showLoadFromFileDialog();
67 } 68 }
68 69
69 _updateControls() { 70 _updateControls() {
70 if (this._isEnabled && this._recordButtonEnabled) 71 if (this._isEnabled && this._recordButtonEnabled)
71 this._controlButton.removeAttribute('disabled'); 72 this._controlButton.removeAttribute('disabled');
72 else 73 else
73 this._controlButton.setAttribute('disabled', ''); 74 this._controlButton.setAttribute('disabled', '');
74 this._controlButton.title = this._recordButtonEnabled ? '' : UI.anotherProfi lerActiveLabel(); 75 this._controlButton.title = this._recordButtonEnabled ? '' : UI.anotherProfi lerActiveLabel();
75 if (this._isInstantProfile) { 76 if (this._isInstantProfile) {
76 this._controlButton.classList.remove('running'); 77 this._controlButton.classList.remove('running');
78 this._controlButton.classList.add('primary-button');
77 this._controlButton.textContent = Common.UIString('Take snapshot'); 79 this._controlButton.textContent = Common.UIString('Take snapshot');
78 } else if (this._isProfiling) { 80 } else if (this._isProfiling) {
79 this._controlButton.classList.add('running'); 81 this._controlButton.classList.add('running');
82 this._controlButton.classList.remove('primary-button');
80 this._controlButton.textContent = Common.UIString('Stop'); 83 this._controlButton.textContent = Common.UIString('Stop');
81 } else { 84 } else {
82 this._controlButton.classList.remove('running'); 85 this._controlButton.classList.remove('running');
86 this._controlButton.classList.add('primary-button');
83 this._controlButton.textContent = Common.UIString('Start'); 87 this._controlButton.textContent = Common.UIString('Start');
84 } 88 }
85 for (var item of this._typeIdToOptionElement.values()) 89 for (var item of this._typeIdToOptionElement.values())
86 item.disabled = !!this._isProfiling; 90 item.disabled = !!this._isProfiling;
87 } 91 }
88 92
89 profileStarted() { 93 profileStarted() {
90 this._isProfiling = true; 94 this._isProfiling = true;
91 this._updateControls(); 95 this._updateControls();
92 } 96 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 this._isEnabled = profileType.isEnabled(); 155 this._isEnabled = profileType.isEnabled();
152 this._updateControls(); 156 this._updateControls();
153 this._selectedProfileTypeSetting.set(profileType.id); 157 this._selectedProfileTypeSetting.set(profileType.id);
154 } 158 }
155 }; 159 };
156 160
157 /** @enum {symbol} */ 161 /** @enum {symbol} */
158 Profiler.ProfileLauncherView.Events = { 162 Profiler.ProfileLauncherView.Events = {
159 ProfileTypeSelected: Symbol('ProfileTypeSelected') 163 ProfileTypeSelected: Symbol('ProfileTypeSelected')
160 }; 164 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698