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

Side by Side Diff: tracing/tracing/ui/side_panel/side_panel_container.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/range.html"> 8 <link rel="import" href="/tracing/base/range.html">
9 <link rel="import" href="/tracing/ui/side_panel/side_panel.html"> 9 <link rel="import" href="/tracing/ui/side_panel/side_panel.html">
10 <link rel="import" href="/tracing/ui/side_panel/side_panel_registry.html"> 10 <link rel="import" href="/tracing/ui/side_panel/side_panel_registry.html">
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 this.brushingStateController_ = brushingStateController; 103 this.brushingStateController_ = brushingStateController;
104 if (this.brushingStateController) { 104 if (this.brushingStateController) {
105 this.brushingStateController_.addEventListener( 105 this.brushingStateController_.addEventListener(
106 'change', this.onSelectionChanged_); 106 'change', this.onSelectionChanged_);
107 this.brushingStateController_.addEventListener( 107 this.brushingStateController_.addEventListener(
108 'model-changed', this.onModelChanged_); 108 'model-changed', this.onModelChanged_);
109 } 109 }
110 }, 110 },
111 111
112 get selection() {
113 return this.brushingStateController_.selection;
114 },
115
116 onSelectionChanged_: function() { 112 onSelectionChanged_: function() {
117 if (this.activePanel) 113 if (this.activePanel)
118 this.activePanel.selection = this.selection; 114 this.activePanel.selection = this.selection;
119 }, 115 },
120 116
121 get model() { 117 get model() {
122 return this.brushingStateController_.model; 118 return this.brushingStateController_.model;
123 }, 119 },
124 120
125 onModelChanged_: function() { 121 onModelChanged_: function() {
126 this.activePanelType_ = undefined; 122 this.activePanelType_ = undefined;
127 this.updateContents_(); 123 this.updateContents_();
128 }, 124 },
129 125
130 get expanded() { 126 get expanded() {
131 this.hasAttribute('expanded'); 127 this.hasAttribute('expanded');
132 }, 128 },
133 129
134 get activePanel() { 130 get activePanel() {
135 if (Polymer.dom(this.activePanelContainer_).children.length < 2) 131 if (Polymer.dom(this.activePanelContainer_).children.length < 2)
136 return undefined; 132 return undefined;
137 return this.activePanelContainer_.children[1]; 133 return this.activePanelContainer_.children[1];
138 }, 134 },
139 135
140 get activePanelType() { 136 get activePanel() {
141 return this.activePanelType_; 137 if (Polymer.dom(this.activePanelContainer_).children.length < 2)
138 return undefined;
139 return Polymer.dom(this.activePanelContainer_).children[1];
142 }, 140 },
143 141
144 set activePanelType(panelType) { 142 set activePanelType(panelType) {
145 if (this.model === undefined) 143 if (this.model === undefined)
146 throw new Error('Cannot activate panel without a model'); 144 throw new Error('Cannot activate panel without a model');
147 145
148 var panel = undefined; 146 var panel = undefined;
149 if (panelType) 147 if (panelType)
150 panel = document.createElement(panelType); 148 panel = document.createElement(panelType);
151 149
152 if (panel !== undefined && !panel.supportsModel(this.model)) 150 if (panel !== undefined && !panel.supportsModel(this.model))
153 throw new Error('Cannot activate panel: does not support this model'); 151 throw new Error('Cannot activate panel: does not support this model');
154 152
155 if (this.activePanelType) { 153 if (this.activePanelType) {
156 Polymer.dom(this.getLabelElementForPanelType_( 154 Polymer.dom(this.getLabelElementForPanelType_(
157 this.activePanelType)).removeAttribute('selected'); 155 this.activePanelType)).removeAttribute('selected');
158 } 156 }
159 Polymer.dom(this.activePanelContainer_).textContent = ''; 157 Polymer.dom(this.activePanelContainer_).textContent = '';
160 158
159 if (this.activePanelType) {
160 this.getLabelElementForPanelType_(
161 this.activePanelType).removeAttribute('selected');
162 }
163
161 if (this.activePanel) 164 if (this.activePanel)
162 Polymer.dom(this.activePanelContainer_).removeChild(this.activePanel); 165 this.activePanelContainer_.removeChild(this.activePanel);
163 166
164 if (panelType === undefined) { 167 if (panelType === undefined) {
165 Polymer.dom(this).removeAttribute('expanded'); 168 Polymer.dom(this).removeAttribute('expanded');
166 this.activePanelType_ = undefined; 169 this.activePanelType_ = undefined;
167 return; 170 return;
168 } 171 }
169 172
170 Polymer.dom(this.getLabelElementForPanelType_(panelType)). 173 Polymer.dom(this.getLabelElementForPanelType_(panelType)).
171 setAttribute('selected', true); 174 setAttribute('selected', true);
172 Polymer.dom(this).setAttribute('expanded', true); 175 Polymer.dom(this).setAttribute('expanded', true);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 215
213 var supported = panel.supportsModel(this.model); 216 var supported = panel.supportsModel(this.model);
214 if (this.model && supported.supported) { 217 if (this.model && supported.supported) {
215 supportedPanelTypes.push(panelType); 218 supportedPanelTypes.push(panelType);
216 Polymer.dom(labelEl).setAttribute('enabled', true); 219 Polymer.dom(labelEl).setAttribute('enabled', true);
217 labelEl.addEventListener('click', function(panelType) { 220 labelEl.addEventListener('click', function(panelType) {
218 this.activePanelType = 221 this.activePanelType =
219 this.activePanelType === panelType ? undefined : panelType; 222 this.activePanelType === panelType ? undefined : panelType;
220 }.bind(this, panelType)); 223 }.bind(this, panelType));
221 } else { 224 } else {
222 labelEl.title = 'Not supported for the current trace: ' + 225 if (this.activePanel)
223 supported.reason; 226 this.activePanelContainer_.removeChild(this.activePanel);
224 labelEl.style.display = 'none'; 227 this.removeAttribute('expanded');
225 } 228 }
226 Polymer.dom(this.tabStrip_).appendChild(labelEl); 229 Polymer.dom(this.tabStrip_).appendChild(labelEl);
227 } 230 }
228 231
229 // Restore the active panel, or collapse 232 // Restore the active panel, or collapse
230 if (previouslyActivePanelType && 233 if (previouslyActivePanelType &&
231 supportedPanelTypes.indexOf(previouslyActivePanelType) != -1) { 234 supportedPanelTypes.indexOf(previouslyActivePanelType) != -1) {
232 this.activePanelType = previouslyActivePanelType; 235 this.activePanelType = previouslyActivePanelType;
233 Polymer.dom(this).setAttribute('expanded', true); 236 Polymer.dom(this).setAttribute('expanded', true);
234 } else { 237 } else {
(...skipping 10 matching lines...) Expand all
245 248
246 set rangeOfInterest(range) { 249 set rangeOfInterest(range) {
247 if (range == undefined) 250 if (range == undefined)
248 throw new Error('Must not be undefined'); 251 throw new Error('Must not be undefined');
249 this.rangeOfInterest_ = range; 252 this.rangeOfInterest_ = range;
250 if (this.activePanel) 253 if (this.activePanel)
251 this.activePanel.rangeOfInterest = range; 254 this.activePanel.rangeOfInterest = range;
252 } 255 }
253 }); 256 });
254 </script> 257 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/side_panel/metrics_side_panel.html ('k') | tracing/tracing/ui/tracks/cpu_usage_track.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698