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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/TouchModel.js

Issue 2731383002: [DevTools] Make touch emulation work with OOPIF. (Closed)
Patch Set: dialog fix to separate patch Created 3 years, 9 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
OLDNEW
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 * @implements {SDK.TargetManager.Observer} 5 * @implements {SDK.TargetManager.Observer}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Emulation.MultitargetTouchModel = class { 8 Emulation.MultitargetTouchModel = class {
9 constructor() { 9 constructor() {
10 this._touchEnabled = false; 10 this._touchEnabled = false;
11 this._touchMobile = false; 11 this._touchMobile = false;
12 this._customTouchEnabled = false; 12 this._customTouchEnabled = false;
13 13
14 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); 14 SDK.targetManager.observeTargets(this, SDK.Target.Capability.TouchEmulation) ;
15 } 15 }
16 16
17 /** 17 /**
18 * @return {!Emulation.MultitargetTouchModel} 18 * @return {!Emulation.MultitargetTouchModel}
19 */ 19 */
20 static instance() { 20 static instance() {
21 if (!Emulation.MultitargetTouchModel._instance) 21 if (!Emulation.MultitargetTouchModel._instance)
22 Emulation.MultitargetTouchModel._instance = new Emulation.MultitargetTouch Model(); 22 Emulation.MultitargetTouchModel._instance = new Emulation.MultitargetTouch Model();
23 return /** @type {!Emulation.MultitargetTouchModel} */ (Emulation.Multitarge tTouchModel._instance); 23 return /** @type {!Emulation.MultitargetTouchModel} */ (Emulation.Multitarge tTouchModel._instance);
24 } 24 }
(...skipping 10 matching lines...) Expand all
35 35
36 /** 36 /**
37 * @param {boolean} enabled 37 * @param {boolean} enabled
38 */ 38 */
39 setCustomTouchEnabled(enabled) { 39 setCustomTouchEnabled(enabled) {
40 this._customTouchEnabled = enabled; 40 this._customTouchEnabled = enabled;
41 this._updateAllTargets(); 41 this._updateAllTargets();
42 } 42 }
43 43
44 _updateAllTargets() { 44 _updateAllTargets() {
45 for (var target of SDK.targetManager.targets(SDK.Target.Capability.Browser)) 45 for (var target of SDK.targetManager.targets(SDK.Target.Capability.TouchEmul ation))
46 this._applyToTarget(target); 46 this._applyToTarget(target);
47 } 47 }
48 48
49 /** 49 /**
50 * @param {!SDK.Target} target 50 * @param {!SDK.Target} target
51 */ 51 */
52 _applyToTarget(target) { 52 _applyToTarget(target) {
53 var current = {enabled: this._touchEnabled, configuration: this._touchMobile ? 'mobile' : 'desktop'}; 53 var current = {enabled: this._touchEnabled, configuration: this._touchMobile ? 'mobile' : 'desktop'};
54 if (this._customTouchEnabled) 54 if (this._customTouchEnabled)
55 current = {enabled: true, configuration: 'mobile'}; 55 current = {enabled: true, configuration: 'mobile'};
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 var domModel = SDK.DOMModel.fromTarget(target); 130 var domModel = SDK.DOMModel.fromTarget(target);
131 if (domModel) 131 if (domModel)
132 domModel.removeEventListener(SDK.DOMModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this); 132 domModel.removeEventListener(SDK.DOMModel.Events.InspectModeWillBeToggled, this._inspectModeToggled, this);
133 } 133 }
134 }; 134 };
135 135
136 Emulation.MultitargetTouchModel._symbol = Symbol('MultitargetTouchModel.symbol') ; 136 Emulation.MultitargetTouchModel._symbol = Symbol('MultitargetTouchModel.symbol') ;
137 137
138 /** @type {?Emulation.MultitargetTouchModel} */ 138 /** @type {?Emulation.MultitargetTouchModel} */
139 Emulation.MultitargetTouchModel._instance = null; 139 Emulation.MultitargetTouchModel._instance = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698