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

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 apavlov's comments 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
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data); 156 var bounds = /** @type {{x: number, y: number, width: number, height: nu mber}} */ (event.data);
157 console.timeStamp("AdvancedApp.setInspectedPageBounds"); 157 console.timeStamp("AdvancedApp.setInspectedPageBounds");
158 InspectorFrontendHost.setInspectedPageBounds(bounds); 158 InspectorFrontendHost.setInspectedPageBounds(bounds);
159 }, 159 },
160 160
161 __proto__: WebInspector.App.prototype 161 __proto__: WebInspector.App.prototype
162 }; 162 };
163 163
164 /** 164 /**
165 * @constructor 165 * @constructor
166 * @implements {WebInspector.StatusBarItem.Provider}
167 */
168 WebInspector.AdvancedApp.DeviceCounter = function()
169 {
170 if (!WebInspector.experimentsSettings.devicesPanel.isEnabled() || !(WebInspe ctor.app instanceof WebInspector.AdvancedApp)) {
171 this._counter = null;
172 return;
173 }
174
175 this._counter = new WebInspector.StatusBarCounter(["device-icon-small"]);
176 this._counter.addEventListener("click", showDevices);
177
178 function showDevices()
179 {
180 WebInspector.inspectorView.showViewInDrawer("devices", true);
181 }
182
183 InspectorFrontendHost.setDeviceCountUpdatesEnabled(true);
184 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.DeviceCountUpdated, this._onDeviceCountUpdated, this);
185 }
186
187 WebInspector.AdvancedApp.DeviceCounter.prototype = {
188 /**
189 * @param {!WebInspector.Event} event
190 */
191 _onDeviceCountUpdated: function(event)
192 {
193 var count = /** @type {number} */ (event.data);
194 this._counter.setCounter("device-icon-small", count, WebInspector.UIStri ng(count > 1 ? "%d devices found" : "%d device found", count));
195 WebInspector.inspectorView.toolbarItemResized();
196 },
197
198 /**
199 * @return {?WebInspector.StatusBarItem}
200 */
201 item: function()
202 {
203 return this._counter;
204 }
205 }
206
207 /**
208 * @constructor
166 */ 209 */
167 WebInspector.Toolbox = function() 210 WebInspector.Toolbox = function()
168 { 211 {
169 if (!window.opener) 212 if (!window.opener)
170 return; 213 return;
171 214
172 WebInspector.zoomManager = window.opener.WebInspector.zoomManager; 215 WebInspector.zoomManager = window.opener.WebInspector.zoomManager;
173 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; 216 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport;
174 WebInspector.settings = window.opener.WebInspector.settings; 217 WebInspector.settings = window.opener.WebInspector.settings;
175 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings; 218 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet tings;
176 WebInspector.targetManager = window.opener.WebInspector.targetManager; 219 WebInspector.targetManager = window.opener.WebInspector.targetManager;
177 WebInspector.workspace = window.opener.WebInspector.workspace; 220 WebInspector.workspace = window.opener.WebInspector.workspace;
178 WebInspector.Revealer = window.opener.WebInspector.Revealer; 221 WebInspector.Revealer = window.opener.WebInspector.Revealer;
179 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu; 222 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu;
180 WebInspector.installPortStyles(); 223 WebInspector.installPortStyles();
181 224
182 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app); 225 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We bInspector.app);
183 var rootView = new WebInspector.RootView(); 226 var rootView = new WebInspector.RootView();
184 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ; 227 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder() ;
185 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true)); 228 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp, true));
186 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins pectedPagePlaceholder); 229 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins pectedPagePlaceholder);
187 this._responsiveDesignView.show(rootView.element); 230 this._responsiveDesignView.show(rootView.element);
188 rootView.attachToBody(); 231 rootView.attachToBody();
189 advancedApp._toolboxLoaded(this); 232 advancedApp._toolboxLoaded(this);
190 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698