OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SDK.EmulationModel = class extends SDK.SDKModel { | 5 SDK.EmulationModel = class extends SDK.SDKModel { |
6 /** | 6 /** |
7 * @param {!SDK.Target} target | 7 * @param {!SDK.Target} target |
| 8 * @param {!Protocol.Dispatcher} dispatcher |
8 */ | 9 */ |
9 constructor(target) { | 10 constructor(target, dispatcher) { |
10 super(target); | 11 super(target, dispatcher); |
11 this._emulationAgent = target.emulationAgent(); | 12 this._emulationAgent = dispatcher.emulationAgent(); |
12 this._pageAgent = target.pageAgent(); | 13 this._pageAgent = dispatcher.pageAgent(); |
13 this._deviceOrientationAgent = target.deviceOrientationAgent(); | 14 this._deviceOrientationAgent = dispatcher.deviceOrientationAgent(); |
14 this._cssModel = target.model(SDK.CSSModel); | 15 this._cssModel = target.model(SDK.CSSModel); |
15 this._overlayModel = target.model(SDK.OverlayModel); | 16 this._overlayModel = target.model(SDK.OverlayModel); |
16 if (this._overlayModel) | 17 if (this._overlayModel) |
17 this._overlayModel.addEventListener(SDK.OverlayModel.Events.InspectModeWil
lBeToggled, this._updateTouch, this); | 18 this._overlayModel.addEventListener(SDK.OverlayModel.Events.InspectModeWil
lBeToggled, this._updateTouch, this); |
18 | 19 |
19 var disableJavascriptSetting = Common.settings.moduleSetting('javaScriptDisa
bled'); | 20 var disableJavascriptSetting = Common.settings.moduleSetting('javaScriptDisa
bled'); |
20 disableJavascriptSetting.addChangeListener( | 21 disableJavascriptSetting.addChangeListener( |
21 () => this._emulationAgent.setScriptExecutionDisabled(disableJavascriptS
etting.get())); | 22 () => this._emulationAgent.setScriptExecutionDisabled(disableJavascriptS
etting.get())); |
22 if (disableJavascriptSetting.get()) | 23 if (disableJavascriptSetting.get()) |
23 this._emulationAgent.setScriptExecutionDisabled(true); | 24 this._emulationAgent.setScriptExecutionDisabled(true); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value); | 325 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value); |
325 } | 326 } |
326 | 327 |
327 /** | 328 /** |
328 * @return {string} | 329 * @return {string} |
329 */ | 330 */ |
330 toSetting() { | 331 toSetting() { |
331 return JSON.stringify(this); | 332 return JSON.stringify(this); |
332 } | 333 } |
333 }; | 334 }; |
OLD | NEW |