| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 }, | 269 }, |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * @param {boolean} enabled | 272 * @param {boolean} enabled |
| 273 */ | 273 */ |
| 274 setEmulationEnabled: function(enabled) | 274 setEmulationEnabled: function(enabled) |
| 275 { | 275 { |
| 276 if (this.canEmulate()) { | 276 if (this.canEmulate()) { |
| 277 this.settings._emulationEnabled.set(enabled); | 277 this.settings._emulationEnabled.set(enabled); |
| 278 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); | 278 this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.E
mulationStateChanged); |
| 279 if (enabled && this.settings.emulateResolution.get()) |
| 280 this._target.pageAgent().resetScrollAndPageScaleFactor(); |
| 279 } | 281 } |
| 280 }, | 282 }, |
| 281 | 283 |
| 282 /** | 284 /** |
| 283 * @return {boolean} | 285 * @return {boolean} |
| 284 */ | 286 */ |
| 285 responsiveDesignAvailable: function() | 287 responsiveDesignAvailable: function() |
| 286 { | 288 { |
| 287 return this._responsiveDesignAvailable; | 289 return this._responsiveDesignAvailable; |
| 288 }, | 290 }, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 this.settings.deviceHeight.set(device.height); | 327 this.settings.deviceHeight.set(device.height); |
| 326 this.settings.deviceScaleFactor.set(device.deviceScaleFactor); | 328 this.settings.deviceScaleFactor.set(device.deviceScaleFactor); |
| 327 this.settings.emulateTouch.set(device.touch); | 329 this.settings.emulateTouch.set(device.touch); |
| 328 this.settings.emulateMobile.set(device.mobile); | 330 this.settings.emulateMobile.set(device.mobile); |
| 329 delete this._deviceMetricsChangedListenerMuted; | 331 delete this._deviceMetricsChangedListenerMuted; |
| 330 delete this._userAgentChangedListenerMuted; | 332 delete this._userAgentChangedListenerMuted; |
| 331 | 333 |
| 332 if (this._initialized) { | 334 if (this._initialized) { |
| 333 this._deviceMetricsChanged(); | 335 this._deviceMetricsChanged(); |
| 334 this._userAgentChanged(); | 336 this._userAgentChanged(); |
| 335 PageAgent.resetScrollAndPageScaleFactor(); | 337 this._target.pageAgent().resetScrollAndPageScaleFactor(); |
| 336 } | 338 } |
| 337 }, | 339 }, |
| 338 | 340 |
| 339 reset: function() | 341 reset: function() |
| 340 { | 342 { |
| 341 this._deviceMetricsChangedListenerMuted = true; | 343 this._deviceMetricsChangedListenerMuted = true; |
| 342 this._userAgentChangedListenerMuted = true; | 344 this._userAgentChangedListenerMuted = true; |
| 343 this.settings.userAgent.set(""); | 345 this.settings.userAgent.set(""); |
| 344 this.settings.emulateResolution.set(false); | 346 this.settings.emulateResolution.set(false); |
| 345 this.settings.deviceScaleFactor.set(0); | 347 this.settings.deviceScaleFactor.set(0); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 if (this.settings.overrideGeolocation.get()) | 459 if (this.settings.overrideGeolocation.get()) |
| 458 this._geolocationPositionChanged(); | 460 this._geolocationPositionChanged(); |
| 459 | 461 |
| 460 if (this.settings.emulateTouch.get()) | 462 if (this.settings.emulateTouch.get()) |
| 461 this._emulateTouchEventsChanged(); | 463 this._emulateTouchEventsChanged(); |
| 462 | 464 |
| 463 if (this.settings.overrideCSSMedia.get()) | 465 if (this.settings.overrideCSSMedia.get()) |
| 464 this._cssMediaChanged(); | 466 this._cssMediaChanged(); |
| 465 | 467 |
| 466 this._deviceMetricsChanged(); | 468 this._deviceMetricsChanged(); |
| 469 if (this.settings.emulateResolution.get()) |
| 470 this._target.pageAgent().resetScrollAndPageScaleFactor(); |
| 467 | 471 |
| 468 this._userAgentChanged(); | 472 this._userAgentChanged(); |
| 469 | 473 |
| 470 if (this.networkThroughputIsLimited()) | 474 if (this.networkThroughputIsLimited()) |
| 471 this._networkConditionsChanged(); | 475 this._networkConditionsChanged(); |
| 472 }, | 476 }, |
| 473 | 477 |
| 474 _userAgentChanged: function() | 478 _userAgentChanged: function() |
| 475 { | 479 { |
| 476 if (this._userAgentChangedListenerMuted) | 480 if (this._userAgentChangedListenerMuted) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 this._deviceScale = scale; | 569 this._deviceScale = scale; |
| 566 | 570 |
| 567 this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this
)); | 571 this._deviceMetricsThrottler.schedule(setDeviceMetricsOverride.bind(this
)); |
| 568 | 572 |
| 569 /** | 573 /** |
| 570 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 574 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 571 * @this {WebInspector.OverridesSupport} | 575 * @this {WebInspector.OverridesSupport} |
| 572 */ | 576 */ |
| 573 function setDeviceMetricsOverride(finishCallback) | 577 function setDeviceMetricsOverride(finishCallback) |
| 574 { | 578 { |
| 575 PageAgent.setDeviceMetricsOverride( | 579 this._target.pageAgent().setDeviceMetricsOverride( |
| 576 overrideWidth, overrideHeight, this.settings.emulateResolution.g
et() ? this.settings.deviceScaleFactor.get() : 0, | 580 overrideWidth, overrideHeight, this.settings.emulateResolution.g
et() ? this.settings.deviceScaleFactor.get() : 0, |
| 577 this.settings.emulateMobile.get(), this._pageResizer ? false : t
his.settings.deviceFitWindow.get(), scale, 0, 0, | 581 this.settings.emulateMobile.get(), this._pageResizer ? false : t
his.settings.deviceFitWindow.get(), scale, 0, 0, |
| 578 apiCallback.bind(this, finishCallback)); | 582 apiCallback.bind(this, finishCallback)); |
| 579 } | 583 } |
| 580 | 584 |
| 581 /** | 585 /** |
| 582 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 586 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 583 * @this {WebInspector.OverridesSupport} | 587 * @this {WebInspector.OverridesSupport} |
| 584 */ | 588 */ |
| 585 function clearDeviceMetricsOverride(finishCallback) | 589 function clearDeviceMetricsOverride(finishCallback) |
| 586 { | 590 { |
| 587 PageAgent.clearDeviceMetricsOverride(apiCallback.bind(this, finishCa
llback)); | 591 this._target.pageAgent().clearDeviceMetricsOverride(apiCallback.bind
(this, finishCallback)); |
| 588 } | 592 } |
| 589 | 593 |
| 590 /** | 594 /** |
| 591 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 595 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 592 * @param {?Protocol.Error} error | 596 * @param {?Protocol.Error} error |
| 593 * @this {WebInspector.OverridesSupport} | 597 * @this {WebInspector.OverridesSupport} |
| 594 */ | 598 */ |
| 595 function apiCallback(finishCallback, error) | 599 function apiCallback(finishCallback, error) |
| 596 { | 600 { |
| 597 if (error) { | 601 if (error) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 }, | 826 }, |
| 823 | 827 |
| 824 __proto__: WebInspector.Object.prototype | 828 __proto__: WebInspector.Object.prototype |
| 825 } | 829 } |
| 826 | 830 |
| 827 | 831 |
| 828 /** | 832 /** |
| 829 * @type {!WebInspector.OverridesSupport} | 833 * @type {!WebInspector.OverridesSupport} |
| 830 */ | 834 */ |
| 831 WebInspector.overridesSupport; | 835 WebInspector.overridesSupport; |
| OLD | NEW |