| OLD | NEW |
| 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 Loading... |
| 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 | |
| 246 */ | 203 */ |
| 247 WebInspector.Toolbox = function() | 204 WebInspector.Toolbox = function() |
| 248 { | 205 { |
| 249 if (!window.opener) | 206 if (!window.opener) |
| 250 return; | 207 return; |
| 251 | 208 |
| 252 WebInspector.zoomManager = window.opener.WebInspector.zoomManager; | 209 WebInspector.zoomManager = window.opener.WebInspector.zoomManager; |
| 253 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; | 210 WebInspector.overridesSupport = window.opener.WebInspector.overridesSupport; |
| 254 WebInspector.settings = window.opener.WebInspector.settings; | 211 WebInspector.settings = window.opener.WebInspector.settings; |
| 255 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet
tings; | 212 WebInspector.experimentsSettings = window.opener.WebInspector.experimentsSet
tings; |
| 256 WebInspector.targetManager = window.opener.WebInspector.targetManager; | 213 WebInspector.targetManager = window.opener.WebInspector.targetManager; |
| 257 WebInspector.workspace = window.opener.WebInspector.workspace; | 214 WebInspector.workspace = window.opener.WebInspector.workspace; |
| 258 WebInspector.Revealer = window.opener.WebInspector.Revealer; | 215 WebInspector.Revealer = window.opener.WebInspector.Revealer; |
| 259 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu; | 216 WebInspector.ContextMenu = window.opener.WebInspector.ContextMenu; |
| 260 WebInspector.installPortStyles(); | 217 WebInspector.installPortStyles(); |
| 261 | 218 |
| 262 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We
bInspector.app); | 219 var advancedApp = /** @type {!WebInspector.AdvancedApp} */ (window.opener.We
bInspector.app); |
| 263 var rootView = new WebInspector.RootView(); | 220 var rootView = new WebInspector.RootView(); |
| 264 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder()
; | 221 this._inspectedPagePlaceholder = new WebInspector.InspectedPagePlaceholder()
; |
| 265 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl
aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp,
true)); | 222 this._inspectedPagePlaceholder.addEventListener(WebInspector.InspectedPagePl
aceholder.Events.Update, advancedApp._onSetInspectedPageBounds.bind(advancedApp,
true)); |
| 266 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins
pectedPagePlaceholder); | 223 this._responsiveDesignView = new WebInspector.ResponsiveDesignView(this._ins
pectedPagePlaceholder); |
| 267 this._responsiveDesignView.show(rootView.element); | 224 this._responsiveDesignView.show(rootView.element); |
| 268 rootView.attachToBody(); | 225 rootView.attachToBody(); |
| 269 advancedApp._toolboxLoaded(this); | 226 advancedApp._toolboxLoaded(this); |
| 270 } | 227 } |
| 271 | 228 |
| 272 /** | 229 /** |
| 273 * @constructor | 230 * @constructor |
| 274 * @implements {WebInspector.StatusBarItem.Provider} | 231 * @implements {WebInspector.StatusBarButton.Provider} |
| 275 */ | 232 */ |
| 276 WebInspector.AdvancedApp.EmulationButtonProvider = function() | 233 WebInspector.AdvancedApp.EmulationButtonProvider = function() |
| 277 { | 234 { |
| 278 } | 235 } |
| 279 | 236 |
| 280 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { | 237 WebInspector.AdvancedApp.EmulationButtonProvider.prototype = { |
| 281 /** | 238 /** |
| 282 * @return {?WebInspector.StatusBarItem} | 239 * @return {?WebInspector.StatusBarButton} |
| 283 */ | 240 */ |
| 284 item: function() | 241 button: function() |
| 285 { | 242 { |
| 286 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 243 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 287 return null; | 244 return null; |
| 288 return WebInspector.app._toggleEmulationButton || null; | 245 return WebInspector.app._toggleEmulationButton || null; |
| 289 } | 246 } |
| 290 } | 247 } |
| 291 | 248 |
| 292 /** | 249 /** |
| 293 * @constructor | 250 * @constructor |
| 294 * @implements {WebInspector.ActionDelegate} | 251 * @implements {WebInspector.ActionDelegate} |
| 295 */ | 252 */ |
| 296 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate = function() | 253 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate = function() |
| 297 { | 254 { |
| 298 } | 255 } |
| 299 | 256 |
| 300 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = { | 257 WebInspector.AdvancedApp.ToggleDeviceModeActionDelegate.prototype = { |
| 301 /** | 258 /** |
| 302 * @return {boolean} | 259 * @return {boolean} |
| 303 */ | 260 */ |
| 304 handleAction: function() | 261 handleAction: function() |
| 305 { | 262 { |
| 306 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) | 263 if (!WebInspector.overridesSupport.responsiveDesignAvailable()) |
| 307 return false; | 264 return false; |
| 308 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) | 265 if (!(WebInspector.app instanceof WebInspector.AdvancedApp)) |
| 309 return false; | 266 return false; |
| 310 WebInspector.app._toggleEmulationEnabled(); | 267 WebInspector.app._toggleEmulationEnabled(); |
| 311 return true; | 268 return true; |
| 312 } | 269 } |
| 313 } | 270 } |
| OLD | NEW |