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

Side by Side Diff: Source/devtools/front_end/main/AdvancedApp.js

Issue 408853002: [DevTools] Make toolbar counters declarative. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed comment Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.App} 7 * @extends {WebInspector.App}
8 */ 8 */
9 WebInspector.AdvancedApp = function() 9 WebInspector.AdvancedApp = function()
10 { 10 {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data); 193 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data);
194 console.timeStamp("AdvancedApp.setInspectedPageBounds"); 194 console.timeStamp("AdvancedApp.setInspectedPageBounds");
195 InspectorFrontendHost.setInspectedPageBounds(bounds); 195 InspectorFrontendHost.setInspectedPageBounds(bounds);
196 }, 196 },
197 197
198 __proto__: WebInspector.App.prototype 198 __proto__: WebInspector.App.prototype
199 }; 199 };
200 200
201 /** 201 /**
202 * @constructor 202 * @constructor
203 * @implements {WebInspector.StatusBarItem.Provider}
204 */
205 WebInspector.AdvancedApp.DeviceCounter = function()
206 {
207 if (!WebInspector.experimentsSettings.devicesPanel.isEnabled() || !(WebInspe ctor.app instanceof WebInspector.AdvancedApp)) {
208 this._counter = null;
209 return;
210 }
211
212 this._counter = new WebInspector.StatusBarCounter(["device-icon-small"]);
213 this._counter.addEventListener("click", showDevices);
214
215 function showDevices()
216 {
217 WebInspector.inspectorView.showViewInDrawer("devices", true);
218 }
219
220 InspectorFrontendHost.setDeviceCountUpdatesEnabled(true);
221 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.DeviceCountUpdated, this._onDeviceCountUpdated, this);
222 }
223
224 WebInspector.AdvancedApp.DeviceCounter.prototype = {
225 /**
226 * @param {!WebInspector.Event} event
227 */
228 _onDeviceCountUpdated: function(event)
229 {
230 var count = /** @type {number} */ (event.data);
231 this._counter.setCounter("device-icon-small", count, WebInspector.UIStri ng(count > 1 ? "%d devices found" : "%d device found", count));
232 WebInspector.inspectorView.toolbarItemResized();
233 },
234
235 /**
236 * @return {?WebInspector.StatusBarItem}
237 */
238 item: function()
239 {
240 return this._counter;
241 }
242 }
243
244 /**
245 * @constructor
203 */ 246 */
204 WebInspector.Toolbox = function() 247 WebInspector.Toolbox = function()
205 { 248 {
206 if (!window.opener) 249 if (!window.opener)
207 return; 250 return;
208 251
209 WebInspector.zoomManager = window.opener.WebInspector.zoomManager; 252 WebInspector.zoomManager = window.opener.WebInspector.zoomManager;
210 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; 253 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport;
211 WebInspector.settings = window.opener.WebInspector.settings; 254 WebInspector.settings = window.opener.WebInspector.settings;
212 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings; 255 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings;
213 WebInspector.targetManager = window.opener.WebInspector.targetManager; 256 WebInspector.targetManager = window.opener.WebInspector.targetManager;
214 WebInspector.workspace = window.opener.WebInspector.workspace; 257 WebInspector.workspace = window.opener.WebInspector.workspace;
215 WebInspector.Revealer = window.opener.WebInspector.Revealer; 258 WebInspector.Revealer = window.opener.WebInspector.Revealer;
216 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu; 259 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu;
217 WebInspector.installPortStyles(); 260 WebInspector.installPortStyles();
218 261
219 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app); 262 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app);
220 var rootView = new WebInspector.RootView(); 263 var rootView = new WebInspector.RootView();
221 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ; 264 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ;
222 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true)); 265 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true));
223 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins pectedPagePlaceholder); 266 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins pectedPagePlaceholder);
224 this._responsiveDesignView.show(rootView.element); 267 this._responsiveDesignView.show(rootView.element);
225 rootView.attachToBody(); 268 rootView.attachToBody();
226 advancedApp._toolboxLoaded(this); 269 advancedApp._toolboxLoaded(this);
227 } 270 }
228 271
229 /** 272 /**
230 * @constructor 273 * @constructor
231 * @implements {WebInspector.StatusBarButton.Provider} 274 * @implements {WebInspector.StatusBarItem.Provider}
232 */ 275 */
233 WebInspector.AdvancedApp.EmulationButtonProvider = function() 276 WebInspector.AdvancedApp.EmulationButtonProvider = function()
234 { 277 {
235 } 278 }
236 279
237 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { 280 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = {
238 /** 281 /**
239 * @return {?WebInspector.StatusBarButton} 282 * @return {?WebInspector.StatusBarItem}
240 */ 283 */
241 button: function() 284 item: function()
242 { 285 {
243 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) 286 if (!(WebInspector.app instanceof WebInspector.AdvancedApp))
244 return null; 287 return null;
245 return WebInspector.app._toggleEmulationButton || null; 288 return WebInspector.app._toggleEmulationButton || null;
246 } 289 }
247 } 290 }
248 291
249 /** 292 /**
250 * @constructor 293 * @constructor
251 * @implements {WebInspector.ActionDelegate} 294 * @implements {WebInspector.ActionDelegate}
252 */ 295 */
253 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate = function() 296 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate = function()
254 { 297 {
255 } 298 }
256 299
257 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = { 300 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = {
258 /** 301 /**
259 * @return {boolean} 302 * @return {boolean}
260 */ 303 */
261 handleAction: function() 304 handleAction: function()
262 { 305 {
263 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) 306 if (!WebInspector.overridesSupport.responsiveDesignAvailable())
264 return false; 307 return false;
265 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) 308 if (!(WebInspector.app instanceof WebInspector.AdvancedApp))
266 return false; 309 return false;
267 WebInspector.app._toggleEmulationEnabled(); 310 WebInspector.app._toggleEmulationEnabled();
268 return true; 311 return true;
269 } 312 }
270 } 313 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/front_end/main/Main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698