| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @implements {WebInspector.TargetManager.Observer} | 7 * @implements {WebInspector.TargetManager.Observer} |
| 8 */ | 8 */ |
| 9 WebInspector.MultitargetTouchModel = function() | 9 WebInspector.MultitargetTouchModel = function() |
| 10 { | 10 { |
| 11 this._touchEnabled = false; | 11 this._touchEnabled = false; |
| 12 this._touchMobile = false; | 12 this._touchMobile = false; |
| 13 this._customTouchEnabled = false; | 13 this._customTouchEnabled = false; |
| 14 | 14 |
| 15 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Pag
e); | 15 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Browser); |
| 16 } | 16 } |
| 17 | 17 |
| 18 WebInspector.MultitargetTouchModel._symbol = Symbol("MultitargetTouchModel.symbo
l"); | 18 WebInspector.MultitargetTouchModel._symbol = Symbol("MultitargetTouchModel.symbo
l"); |
| 19 | 19 |
| 20 WebInspector.MultitargetTouchModel.prototype = { | 20 WebInspector.MultitargetTouchModel.prototype = { |
| 21 /** | 21 /** |
| 22 * @param {boolean} enabled | 22 * @param {boolean} enabled |
| 23 * @param {boolean} mobile | 23 * @param {boolean} mobile |
| 24 */ | 24 */ |
| 25 setTouchEnabled: function(enabled, mobile) | 25 setTouchEnabled: function(enabled, mobile) |
| 26 { | 26 { |
| 27 this._touchEnabled = enabled; | 27 this._touchEnabled = enabled; |
| 28 this._touchMobile = mobile; | 28 this._touchMobile = mobile; |
| 29 this._updateAllTargets(); | 29 this._updateAllTargets(); |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @param {boolean} enabled | 33 * @param {boolean} enabled |
| 34 */ | 34 */ |
| 35 setCustomTouchEnabled: function(enabled) | 35 setCustomTouchEnabled: function(enabled) |
| 36 { | 36 { |
| 37 this._customTouchEnabled = enabled; | 37 this._customTouchEnabled = enabled; |
| 38 this._updateAllTargets(); | 38 this._updateAllTargets(); |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 _updateAllTargets: function() | 41 _updateAllTargets: function() |
| 42 { | 42 { |
| 43 for (var target of WebInspector.targetManager.targets(WebInspector.Targe
t.Type.Page)) | 43 for (var target of WebInspector.targetManager.targets(WebInspector.Targe
t.Capability.Browser)) |
| 44 this._applyToTarget(target); | 44 this._applyToTarget(target); |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @param {!WebInspector.Target} target | 48 * @param {!WebInspector.Target} target |
| 49 */ | 49 */ |
| 50 _applyToTarget: function(target) | 50 _applyToTarget: function(target) |
| 51 { | 51 { |
| 52 var current = {enabled: this._touchEnabled, configuration : this._touchM
obile ? "mobile" : "desktop"}; | 52 var current = {enabled: this._touchEnabled, configuration : this._touchM
obile ? "mobile" : "desktop"}; |
| 53 if (this._customTouchEnabled) | 53 if (this._customTouchEnabled) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * @return {!WebInspector.MultitargetTouchModel} | 142 * @return {!WebInspector.MultitargetTouchModel} |
| 143 */ | 143 */ |
| 144 WebInspector.MultitargetTouchModel.instance = function() | 144 WebInspector.MultitargetTouchModel.instance = function() |
| 145 { | 145 { |
| 146 if (!WebInspector.MultitargetTouchModel._instance) | 146 if (!WebInspector.MultitargetTouchModel._instance) |
| 147 WebInspector.MultitargetTouchModel._instance = new WebInspector.Multitar
getTouchModel(); | 147 WebInspector.MultitargetTouchModel._instance = new WebInspector.Multitar
getTouchModel(); |
| 148 return /** @type {!WebInspector.MultitargetTouchModel} */ (WebInspector.Mult
itargetTouchModel._instance); | 148 return /** @type {!WebInspector.MultitargetTouchModel} */ (WebInspector.Mult
itargetTouchModel._instance); |
| 149 } | 149 } |
| OLD | NEW |