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

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

Issue 2137773002: [DevTools] Replace the target type with capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {number} alpha 7 * @param {number} alpha
8 * @param {number} beta 8 * @param {number} beta
9 * @param {number} gamma 9 * @param {number} gamma
10 */ 10 */
11 WebInspector.DeviceOrientation = function(alpha, beta, gamma) 11 WebInspector.DeviceOrientation = function(alpha, beta, gamma)
12 { 12 {
13 this.alpha = alpha; 13 this.alpha = alpha;
14 this.beta = beta; 14 this.beta = beta;
15 this.gamma = gamma; 15 this.gamma = gamma;
16 } 16 }
17 17
18 WebInspector.DeviceOrientation.prototype = { 18 WebInspector.DeviceOrientation.prototype = {
19 /** 19 /**
20 * @return {string} 20 * @return {string}
21 */ 21 */
22 toSetting: function() 22 toSetting: function()
23 { 23 {
24 return JSON.stringify(this); 24 return JSON.stringify(this);
25 }, 25 },
26 26
27 apply: function() 27 apply: function()
28 { 28 {
29 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Type.Page)) 29 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Capability.Browser))
30 target.deviceOrientationAgent().setDeviceOrientationOverride(this.al pha, this.beta, this.gamma); 30 target.deviceOrientationAgent().setDeviceOrientationOverride(this.al pha, this.beta, this.gamma);
31 }, 31 },
32 32
33 clear: function() 33 clear: function()
34 { 34 {
35 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Type.Page)) 35 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Capability.Browser))
36 target.deviceOrientationAgent().clearDeviceOrientationOverride(); 36 target.deviceOrientationAgent().clearDeviceOrientationOverride();
37 } 37 }
38 } 38 }
39 39
40 /** 40 /**
41 * @return {!WebInspector.DeviceOrientation} 41 * @return {!WebInspector.DeviceOrientation}
42 */ 42 */
43 WebInspector.DeviceOrientation.parseSetting = function(value) 43 WebInspector.DeviceOrientation.parseSetting = function(value)
44 { 44 {
45 if (value) { 45 if (value) {
(...skipping 26 matching lines...) Expand all
72 } 72 }
73 73
74 /** 74 /**
75 * @param {string} value 75 * @param {string} value
76 * @return {boolean} 76 * @return {boolean}
77 */ 77 */
78 WebInspector.DeviceOrientation.validator = function(value) 78 WebInspector.DeviceOrientation.validator = function(value)
79 { 79 {
80 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value); 80 return /^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value);
81 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698