| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.SensorsView = class extends WebInspector.VBox { | 7 Emulation.SensorsView = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(true); | 9 super(true); |
| 10 this.registerRequiredCSS('emulation/sensors.css'); | 10 this.registerRequiredCSS('emulation/sensors.css'); |
| 11 this.contentElement.classList.add('sensors-view'); | 11 this.contentElement.classList.add('sensors-view'); |
| 12 | 12 |
| 13 this._geolocationSetting = WebInspector.settings.createSetting('emulation.ge
olocationOverride', ''); | 13 this._geolocationSetting = Common.settings.createSetting('emulation.geolocat
ionOverride', ''); |
| 14 this._geolocation = WebInspector.Geolocation.parseSetting(this._geolocationS
etting.get()); | 14 this._geolocation = Emulation.Geolocation.parseSetting(this._geolocationSett
ing.get()); |
| 15 this._geolocationOverrideEnabled = false; | 15 this._geolocationOverrideEnabled = false; |
| 16 this._createGeolocationSection(this._geolocation); | 16 this._createGeolocationSection(this._geolocation); |
| 17 | 17 |
| 18 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); | 18 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); |
| 19 | 19 |
| 20 this._deviceOrientationSetting = WebInspector.settings.createSetting('emulat
ion.deviceOrientationOverride', ''); | 20 this._deviceOrientationSetting = Common.settings.createSetting('emulation.de
viceOrientationOverride', ''); |
| 21 this._deviceOrientation = WebInspector.DeviceOrientation.parseSetting(this._
deviceOrientationSetting.get()); | 21 this._deviceOrientation = Emulation.DeviceOrientation.parseSetting(this._dev
iceOrientationSetting.get()); |
| 22 this._deviceOrientationOverrideEnabled = false; | 22 this._deviceOrientationOverrideEnabled = false; |
| 23 this._createDeviceOrientationSection(); | 23 this._createDeviceOrientationSection(); |
| 24 | 24 |
| 25 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); | 25 this.contentElement.createChild('div').classList.add('panel-section-separato
r'); |
| 26 | 26 |
| 27 this._appendTouchControl(); | 27 this._appendTouchControl(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * @return {!WebInspector.SensorsView} | 31 * @return {!Emulation.SensorsView} |
| 32 */ | 32 */ |
| 33 static instance() { | 33 static instance() { |
| 34 if (!WebInspector.SensorsView._instanceObject) | 34 if (!Emulation.SensorsView._instanceObject) |
| 35 WebInspector.SensorsView._instanceObject = new WebInspector.SensorsView(); | 35 Emulation.SensorsView._instanceObject = new Emulation.SensorsView(); |
| 36 return WebInspector.SensorsView._instanceObject; | 36 return Emulation.SensorsView._instanceObject; |
| 37 } | 37 } |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * @param {!WebInspector.Geolocation} geolocation | 40 * @param {!Emulation.Geolocation} geolocation |
| 41 */ | 41 */ |
| 42 _createGeolocationSection(geolocation) { | 42 _createGeolocationSection(geolocation) { |
| 43 var geogroup = this.contentElement.createChild('section', 'sensors-group'); | 43 var geogroup = this.contentElement.createChild('section', 'sensors-group'); |
| 44 geogroup.createChild('div', 'sensors-group-title').textContent = WebInspecto
r.UIString('Geolocation'); | 44 geogroup.createChild('div', 'sensors-group-title').textContent = Common.UISt
ring('Geolocation'); |
| 45 var fields = geogroup.createChild('div', 'geo-fields'); | 45 var fields = geogroup.createChild('div', 'geo-fields'); |
| 46 | 46 |
| 47 const noOverrideOption = { | 47 const noOverrideOption = { |
| 48 title: WebInspector.UIString('No override'), | 48 title: Common.UIString('No override'), |
| 49 location: WebInspector.SensorsView.NonPresetOptions.NoOverride | 49 location: Emulation.SensorsView.NonPresetOptions.NoOverride |
| 50 }; | 50 }; |
| 51 const customLocationOption = { | 51 const customLocationOption = { |
| 52 title: WebInspector.UIString('Custom location...'), | 52 title: Common.UIString('Custom location...'), |
| 53 location: WebInspector.SensorsView.NonPresetOptions.Custom | 53 location: Emulation.SensorsView.NonPresetOptions.Custom |
| 54 }; | 54 }; |
| 55 this._locationSelectElement = this.contentElement.createChild('select', 'chr
ome-select'); | 55 this._locationSelectElement = this.contentElement.createChild('select', 'chr
ome-select'); |
| 56 this._locationSelectElement.appendChild(new Option(noOverrideOption.title, n
oOverrideOption.location)); | 56 this._locationSelectElement.appendChild(new Option(noOverrideOption.title, n
oOverrideOption.location)); |
| 57 this._locationSelectElement.appendChild(new Option(customLocationOption.titl
e, customLocationOption.location)); | 57 this._locationSelectElement.appendChild(new Option(customLocationOption.titl
e, customLocationOption.location)); |
| 58 | 58 |
| 59 var locationGroups = WebInspector.SensorsView.PresetLocations; | 59 var locationGroups = Emulation.SensorsView.PresetLocations; |
| 60 for (var i = 0; i < locationGroups.length; ++i) { | 60 for (var i = 0; i < locationGroups.length; ++i) { |
| 61 var group = locationGroups[i].value; | 61 var group = locationGroups[i].value; |
| 62 var groupElement = this._locationSelectElement.createChild('optgroup'); | 62 var groupElement = this._locationSelectElement.createChild('optgroup'); |
| 63 groupElement.label = locationGroups[i].title; | 63 groupElement.label = locationGroups[i].title; |
| 64 for (var j = 0; j < group.length; ++j) | 64 for (var j = 0; j < group.length; ++j) |
| 65 groupElement.appendChild(new Option(group[j].title, group[j].location)); | 65 groupElement.appendChild(new Option(group[j].title, group[j].location)); |
| 66 } | 66 } |
| 67 this._locationSelectElement.selectedIndex = 0; | 67 this._locationSelectElement.selectedIndex = 0; |
| 68 fields.appendChild(this._locationSelectElement); | 68 fields.appendChild(this._locationSelectElement); |
| 69 this._locationSelectElement.addEventListener('change', this._geolocationSele
ctChanged.bind(this)); | 69 this._locationSelectElement.addEventListener('change', this._geolocationSele
ctChanged.bind(this)); |
| 70 | 70 |
| 71 // Validated input fieldset. | 71 // Validated input fieldset. |
| 72 this._fieldsetElement = fields.createChild('fieldset'); | 72 this._fieldsetElement = fields.createChild('fieldset'); |
| 73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled; | 73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled; |
| 74 this._fieldsetElement.id = 'geolocation-override-section'; | 74 this._fieldsetElement.id = 'geolocation-override-section'; |
| 75 | 75 |
| 76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group'
); | 76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group'
); |
| 77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group
'); | 77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group
'); |
| 78 | 78 |
| 79 this._latitudeInput = latitudeGroup.createChild('input'); | 79 this._latitudeInput = latitudeGroup.createChild('input'); |
| 80 this._latitudeInput.setAttribute('type', 'number'); | 80 this._latitudeInput.setAttribute('type', 'number'); |
| 81 this._latitudeInput.value = 0; | 81 this._latitudeInput.value = 0; |
| 82 this._latitudeSetter = WebInspector.bindInput( | 82 this._latitudeSetter = UI.bindInput( |
| 83 this._latitudeInput, this._applyGeolocationUserInput.bind(this), WebInsp
ector.Geolocation.latitudeValidator, | 83 this._latitudeInput, this._applyGeolocationUserInput.bind(this), Emulati
on.Geolocation.latitudeValidator, |
| 84 true); | 84 true); |
| 85 this._latitudeSetter(String(geolocation.latitude)); | 85 this._latitudeSetter(String(geolocation.latitude)); |
| 86 | 86 |
| 87 this._longitudeInput = longitudeGroup.createChild('input'); | 87 this._longitudeInput = longitudeGroup.createChild('input'); |
| 88 this._longitudeInput.setAttribute('type', 'number'); | 88 this._longitudeInput.setAttribute('type', 'number'); |
| 89 this._longitudeInput.value = 0; | 89 this._longitudeInput.value = 0; |
| 90 this._longitudeSetter = WebInspector.bindInput( | 90 this._longitudeSetter = UI.bindInput( |
| 91 this._longitudeInput, this._applyGeolocationUserInput.bind(this), WebIns
pector.Geolocation.longitudeValidator, | 91 this._longitudeInput, this._applyGeolocationUserInput.bind(this), Emulat
ion.Geolocation.longitudeValidator, |
| 92 true); | 92 true); |
| 93 this._longitudeSetter(String(geolocation.longitude)); | 93 this._longitudeSetter(String(geolocation.longitude)); |
| 94 | 94 |
| 95 latitudeGroup.createChild('div', 'latlong-title').textContent = WebInspector
.UIString('Latitude'); | 95 latitudeGroup.createChild('div', 'latlong-title').textContent = Common.UIStr
ing('Latitude'); |
| 96 longitudeGroup.createChild('div', 'latlong-title').textContent = WebInspecto
r.UIString('Longitude'); | 96 longitudeGroup.createChild('div', 'latlong-title').textContent = Common.UISt
ring('Longitude'); |
| 97 } | 97 } |
| 98 | 98 |
| 99 _geolocationSelectChanged() { | 99 _geolocationSelectChanged() { |
| 100 this._fieldsetElement.disabled = false; | 100 this._fieldsetElement.disabled = false; |
| 101 var value = this._locationSelectElement.options[this._locationSelectElement.
selectedIndex].value; | 101 var value = this._locationSelectElement.options[this._locationSelectElement.
selectedIndex].value; |
| 102 if (value === WebInspector.SensorsView.NonPresetOptions.NoOverride) { | 102 if (value === Emulation.SensorsView.NonPresetOptions.NoOverride) { |
| 103 this._geolocationOverrideEnabled = false; | 103 this._geolocationOverrideEnabled = false; |
| 104 this._fieldsetElement.disabled = true; | 104 this._fieldsetElement.disabled = true; |
| 105 } else if (value === WebInspector.SensorsView.NonPresetOptions.Custom) { | 105 } else if (value === Emulation.SensorsView.NonPresetOptions.Custom) { |
| 106 this._geolocationOverrideEnabled = true; | 106 this._geolocationOverrideEnabled = true; |
| 107 } else if (value === WebInspector.SensorsView.NonPresetOptions.Unavailable)
{ | 107 } else if (value === Emulation.SensorsView.NonPresetOptions.Unavailable) { |
| 108 this._geolocationOverrideEnabled = true; | 108 this._geolocationOverrideEnabled = true; |
| 109 this._geolocation = new WebInspector.Geolocation(0, 0, true); | 109 this._geolocation = new Emulation.Geolocation(0, 0, true); |
| 110 } else { | 110 } else { |
| 111 this._geolocationOverrideEnabled = true; | 111 this._geolocationOverrideEnabled = true; |
| 112 var coordinates = JSON.parse(value); | 112 var coordinates = JSON.parse(value); |
| 113 this._geolocation = new WebInspector.Geolocation(coordinates[0], coordinat
es[1], false); | 113 this._geolocation = new Emulation.Geolocation(coordinates[0], coordinates[
1], false); |
| 114 this._latitudeSetter(coordinates[0]); | 114 this._latitudeSetter(coordinates[0]); |
| 115 this._longitudeSetter(coordinates[1]); | 115 this._longitudeSetter(coordinates[1]); |
| 116 } | 116 } |
| 117 | 117 |
| 118 this._applyGeolocation(); | 118 this._applyGeolocation(); |
| 119 if (value === WebInspector.SensorsView.NonPresetOptions.Custom) | 119 if (value === Emulation.SensorsView.NonPresetOptions.Custom) |
| 120 this._latitudeInput.focus(); | 120 this._latitudeInput.focus(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 _applyGeolocationUserInput() { | 123 _applyGeolocationUserInput() { |
| 124 var geolocation = WebInspector.Geolocation.parseUserInput( | 124 var geolocation = Emulation.Geolocation.parseUserInput( |
| 125 this._latitudeInput.value.trim(), this._longitudeInput.value.trim(), '')
; | 125 this._latitudeInput.value.trim(), this._longitudeInput.value.trim(), '')
; |
| 126 if (!geolocation) | 126 if (!geolocation) |
| 127 return; | 127 return; |
| 128 | 128 |
| 129 this._setSelectElementLabel(this._locationSelectElement, WebInspector.Sensor
sView.NonPresetOptions.Custom); | 129 this._setSelectElementLabel(this._locationSelectElement, Emulation.SensorsVi
ew.NonPresetOptions.Custom); |
| 130 this._geolocation = geolocation; | 130 this._geolocation = geolocation; |
| 131 this._applyGeolocation(); | 131 this._applyGeolocation(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 _applyGeolocation() { | 134 _applyGeolocation() { |
| 135 if (this._geolocationOverrideEnabled) { | 135 if (this._geolocationOverrideEnabled) { |
| 136 this._geolocationSetting.set(this._geolocation.toSetting()); | 136 this._geolocationSetting.set(this._geolocation.toSetting()); |
| 137 this._geolocation.apply(); | 137 this._geolocation.apply(); |
| 138 } else { | 138 } else { |
| 139 this._geolocation.clear(); | 139 this._geolocation.clear(); |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 _createDeviceOrientationSection() { | 143 _createDeviceOrientationSection() { |
| 144 var orientationGroup = this.contentElement.createChild('section', 'sensors-g
roup'); | 144 var orientationGroup = this.contentElement.createChild('section', 'sensors-g
roup'); |
| 145 orientationGroup.createChild('div', 'sensors-group-title').textContent = Web
Inspector.UIString('Orientation'); | 145 orientationGroup.createChild('div', 'sensors-group-title').textContent = Com
mon.UIString('Orientation'); |
| 146 var orientationContent = orientationGroup.createChild('div', 'orientation-co
ntent'); | 146 var orientationContent = orientationGroup.createChild('div', 'orientation-co
ntent'); |
| 147 var fields = orientationContent.createChild('div', 'orientation-fields'); | 147 var fields = orientationContent.createChild('div', 'orientation-fields'); |
| 148 | 148 |
| 149 const orientationOffOption = { | 149 const orientationOffOption = { |
| 150 title: WebInspector.UIString('Off'), | 150 title: Common.UIString('Off'), |
| 151 orientation: WebInspector.SensorsView.NonPresetOptions.NoOverride | 151 orientation: Emulation.SensorsView.NonPresetOptions.NoOverride |
| 152 }; | 152 }; |
| 153 const customOrientationOption = { | 153 const customOrientationOption = { |
| 154 title: WebInspector.UIString('Custom orientation...'), | 154 title: Common.UIString('Custom orientation...'), |
| 155 orientation: WebInspector.SensorsView.NonPresetOptions.Custom | 155 orientation: Emulation.SensorsView.NonPresetOptions.Custom |
| 156 }; | 156 }; |
| 157 this._orientationSelectElement = this.contentElement.createChild('select', '
chrome-select'); | 157 this._orientationSelectElement = this.contentElement.createChild('select', '
chrome-select'); |
| 158 this._orientationSelectElement.appendChild( | 158 this._orientationSelectElement.appendChild( |
| 159 new Option(orientationOffOption.title, orientationOffOption.orientation)
); | 159 new Option(orientationOffOption.title, orientationOffOption.orientation)
); |
| 160 this._orientationSelectElement.appendChild( | 160 this._orientationSelectElement.appendChild( |
| 161 new Option(customOrientationOption.title, customOrientationOption.orient
ation)); | 161 new Option(customOrientationOption.title, customOrientationOption.orient
ation)); |
| 162 | 162 |
| 163 var orientationGroups = WebInspector.SensorsView.PresetOrientations; | 163 var orientationGroups = Emulation.SensorsView.PresetOrientations; |
| 164 for (var i = 0; i < orientationGroups.length; ++i) { | 164 for (var i = 0; i < orientationGroups.length; ++i) { |
| 165 var groupElement = this._orientationSelectElement.createChild('optgroup'); | 165 var groupElement = this._orientationSelectElement.createChild('optgroup'); |
| 166 groupElement.label = orientationGroups[i].title; | 166 groupElement.label = orientationGroups[i].title; |
| 167 var group = orientationGroups[i].value; | 167 var group = orientationGroups[i].value; |
| 168 for (var j = 0; j < group.length; ++j) | 168 for (var j = 0; j < group.length; ++j) |
| 169 groupElement.appendChild(new Option(group[j].title, group[j].orientation
)); | 169 groupElement.appendChild(new Option(group[j].title, group[j].orientation
)); |
| 170 } | 170 } |
| 171 this._orientationSelectElement.selectedIndex = 0; | 171 this._orientationSelectElement.selectedIndex = 0; |
| 172 fields.appendChild(this._orientationSelectElement); | 172 fields.appendChild(this._orientationSelectElement); |
| 173 this._orientationSelectElement.addEventListener('change', this._orientationS
electChanged.bind(this)); | 173 this._orientationSelectElement.addEventListener('change', this._orientationS
electChanged.bind(this)); |
| 174 | 174 |
| 175 this._deviceOrientationFieldset = this._createDeviceOrientationOverrideEleme
nt(this._deviceOrientation); | 175 this._deviceOrientationFieldset = this._createDeviceOrientationOverrideEleme
nt(this._deviceOrientation); |
| 176 | 176 |
| 177 this._stageElement = orientationContent.createChild('div', 'orientation-stag
e'); | 177 this._stageElement = orientationContent.createChild('div', 'orientation-stag
e'); |
| 178 this._stageElement.title = WebInspector.UIString('Shift+drag horizontally to
rotate around the y-axis'); | 178 this._stageElement.title = Common.UIString('Shift+drag horizontally to rotat
e around the y-axis'); |
| 179 this._orientationLayer = this._stageElement.createChild('div', 'orientation-
layer'); | 179 this._orientationLayer = this._stageElement.createChild('div', 'orientation-
layer'); |
| 180 this._boxElement = this._orientationLayer.createChild('section', 'orientatio
n-box orientation-element'); | 180 this._boxElement = this._orientationLayer.createChild('section', 'orientatio
n-box orientation-element'); |
| 181 | 181 |
| 182 this._boxElement.createChild('section', 'orientation-front orientation-eleme
nt'); | 182 this._boxElement.createChild('section', 'orientation-front orientation-eleme
nt'); |
| 183 this._boxElement.createChild('section', 'orientation-top orientation-element
'); | 183 this._boxElement.createChild('section', 'orientation-top orientation-element
'); |
| 184 this._boxElement.createChild('section', 'orientation-back orientation-elemen
t'); | 184 this._boxElement.createChild('section', 'orientation-back orientation-elemen
t'); |
| 185 this._boxElement.createChild('section', 'orientation-left orientation-elemen
t'); | 185 this._boxElement.createChild('section', 'orientation-left orientation-elemen
t'); |
| 186 this._boxElement.createChild('section', 'orientation-right orientation-eleme
nt'); | 186 this._boxElement.createChild('section', 'orientation-right orientation-eleme
nt'); |
| 187 this._boxElement.createChild('section', 'orientation-bottom orientation-elem
ent'); | 187 this._boxElement.createChild('section', 'orientation-bottom orientation-elem
ent'); |
| 188 | 188 |
| 189 WebInspector.installDragHandle( | 189 UI.installDragHandle( |
| 190 this._stageElement, this._onBoxDragStart.bind(this), this._onBoxDrag.bin
d(this), null, '-webkit-grabbing', | 190 this._stageElement, this._onBoxDragStart.bind(this), this._onBoxDrag.bin
d(this), null, '-webkit-grabbing', |
| 191 '-webkit-grab'); | 191 '-webkit-grab'); |
| 192 | 192 |
| 193 fields.appendChild(this._deviceOrientationFieldset); | 193 fields.appendChild(this._deviceOrientationFieldset); |
| 194 this._enableOrientationFields(true); | 194 this._enableOrientationFields(true); |
| 195 this._setBoxOrientation(this._deviceOrientation, false); | 195 this._setBoxOrientation(this._deviceOrientation, false); |
| 196 } | 196 } |
| 197 | 197 |
| 198 /** | 198 /** |
| 199 * @param {?boolean} disable | 199 * @param {?boolean} disable |
| 200 */ | 200 */ |
| 201 _enableOrientationFields(disable) { | 201 _enableOrientationFields(disable) { |
| 202 if (disable) { | 202 if (disable) { |
| 203 this._deviceOrientationFieldset.disabled = true; | 203 this._deviceOrientationFieldset.disabled = true; |
| 204 this._stageElement.classList.add('disabled'); | 204 this._stageElement.classList.add('disabled'); |
| 205 } else { | 205 } else { |
| 206 this._deviceOrientationFieldset.disabled = false; | 206 this._deviceOrientationFieldset.disabled = false; |
| 207 this._stageElement.classList.remove('disabled'); | 207 this._stageElement.classList.remove('disabled'); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 _orientationSelectChanged() { | 211 _orientationSelectChanged() { |
| 212 var value = this._orientationSelectElement.options[this._orientationSelectEl
ement.selectedIndex].value; | 212 var value = this._orientationSelectElement.options[this._orientationSelectEl
ement.selectedIndex].value; |
| 213 this._enableOrientationFields(false); | 213 this._enableOrientationFields(false); |
| 214 | 214 |
| 215 if (value === WebInspector.SensorsView.NonPresetOptions.NoOverride) { | 215 if (value === Emulation.SensorsView.NonPresetOptions.NoOverride) { |
| 216 this._deviceOrientationOverrideEnabled = false; | 216 this._deviceOrientationOverrideEnabled = false; |
| 217 this._enableOrientationFields(true); | 217 this._enableOrientationFields(true); |
| 218 } else if (value === WebInspector.SensorsView.NonPresetOptions.Custom) { | 218 } else if (value === Emulation.SensorsView.NonPresetOptions.Custom) { |
| 219 this._deviceOrientationOverrideEnabled = true; | 219 this._deviceOrientationOverrideEnabled = true; |
| 220 this._alphaElement.focus(); | 220 this._alphaElement.focus(); |
| 221 } else { | 221 } else { |
| 222 var parsedValue = JSON.parse(value); | 222 var parsedValue = JSON.parse(value); |
| 223 this._deviceOrientationOverrideEnabled = true; | 223 this._deviceOrientationOverrideEnabled = true; |
| 224 this._deviceOrientation = new WebInspector.DeviceOrientation(parsedValue[0
], parsedValue[1], parsedValue[2]); | 224 this._deviceOrientation = new Emulation.DeviceOrientation(parsedValue[0],
parsedValue[1], parsedValue[2]); |
| 225 this._setDeviceOrientation( | 225 this._setDeviceOrientation( |
| 226 this._deviceOrientation, WebInspector.SensorsView.DeviceOrientationMod
ificationSource.SelectPreset); | 226 this._deviceOrientation, Emulation.SensorsView.DeviceOrientationModifi
cationSource.SelectPreset); |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 _applyDeviceOrientation() { | 230 _applyDeviceOrientation() { |
| 231 if (this._deviceOrientationOverrideEnabled) { | 231 if (this._deviceOrientationOverrideEnabled) { |
| 232 this._deviceOrientationSetting.set(this._deviceOrientation.toSetting()); | 232 this._deviceOrientationSetting.set(this._deviceOrientation.toSetting()); |
| 233 this._deviceOrientation.apply(); | 233 this._deviceOrientation.apply(); |
| 234 } else { | 234 } else { |
| 235 this._deviceOrientation.clear(); | 235 this._deviceOrientation.clear(); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 /** | 239 /** |
| 240 * @param {!Element} selectElement | 240 * @param {!Element} selectElement |
| 241 * @param {string} labelValue | 241 * @param {string} labelValue |
| 242 */ | 242 */ |
| 243 _setSelectElementLabel(selectElement, labelValue) { | 243 _setSelectElementLabel(selectElement, labelValue) { |
| 244 var optionValues = Array.prototype.map.call(selectElement.options, x => x.va
lue); | 244 var optionValues = Array.prototype.map.call(selectElement.options, x => x.va
lue); |
| 245 selectElement.selectedIndex = optionValues.indexOf(labelValue); | 245 selectElement.selectedIndex = optionValues.indexOf(labelValue); |
| 246 } | 246 } |
| 247 | 247 |
| 248 _applyDeviceOrientationUserInput() { | 248 _applyDeviceOrientationUserInput() { |
| 249 this._setDeviceOrientation( | 249 this._setDeviceOrientation( |
| 250 WebInspector.DeviceOrientation.parseUserInput( | 250 Emulation.DeviceOrientation.parseUserInput( |
| 251 this._alphaElement.value.trim(), this._betaElement.value.trim(), thi
s._gammaElement.value.trim()), | 251 this._alphaElement.value.trim(), this._betaElement.value.trim(), thi
s._gammaElement.value.trim()), |
| 252 WebInspector.SensorsView.DeviceOrientationModificationSource.UserInput); | 252 Emulation.SensorsView.DeviceOrientationModificationSource.UserInput); |
| 253 this._setSelectElementLabel(this._orientationSelectElement, WebInspector.Sen
sorsView.NonPresetOptions.Custom); | 253 this._setSelectElementLabel(this._orientationSelectElement, Emulation.Sensor
sView.NonPresetOptions.Custom); |
| 254 } | 254 } |
| 255 | 255 |
| 256 _resetDeviceOrientation() { | 256 _resetDeviceOrientation() { |
| 257 this._setDeviceOrientation( | 257 this._setDeviceOrientation( |
| 258 new WebInspector.DeviceOrientation(0, 90, 0), | 258 new Emulation.DeviceOrientation(0, 90, 0), |
| 259 WebInspector.SensorsView.DeviceOrientationModificationSource.ResetButton
); | 259 Emulation.SensorsView.DeviceOrientationModificationSource.ResetButton); |
| 260 this._setSelectElementLabel(this._orientationSelectElement, '[0, 90, 0]'); | 260 this._setSelectElementLabel(this._orientationSelectElement, '[0, 90, 0]'); |
| 261 } | 261 } |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @param {?WebInspector.DeviceOrientation} deviceOrientation | 264 * @param {?Emulation.DeviceOrientation} deviceOrientation |
| 265 * @param {!WebInspector.SensorsView.DeviceOrientationModificationSource} modi
ficationSource | 265 * @param {!Emulation.SensorsView.DeviceOrientationModificationSource} modific
ationSource |
| 266 */ | 266 */ |
| 267 _setDeviceOrientation(deviceOrientation, modificationSource) { | 267 _setDeviceOrientation(deviceOrientation, modificationSource) { |
| 268 if (!deviceOrientation) | 268 if (!deviceOrientation) |
| 269 return; | 269 return; |
| 270 | 270 |
| 271 /** | 271 /** |
| 272 * @param {number} angle | 272 * @param {number} angle |
| 273 * @return {number} | 273 * @return {number} |
| 274 */ | 274 */ |
| 275 function roundAngle(angle) { | 275 function roundAngle(angle) { |
| 276 return Math.round(angle * 10000) / 10000; | 276 return Math.round(angle * 10000) / 10000; |
| 277 } | 277 } |
| 278 | 278 |
| 279 if (modificationSource !== WebInspector.SensorsView.DeviceOrientationModific
ationSource.UserInput) { | 279 if (modificationSource !== Emulation.SensorsView.DeviceOrientationModificati
onSource.UserInput) { |
| 280 this._alphaSetter(roundAngle(deviceOrientation.alpha)); | 280 this._alphaSetter(roundAngle(deviceOrientation.alpha)); |
| 281 this._betaSetter(roundAngle(deviceOrientation.beta)); | 281 this._betaSetter(roundAngle(deviceOrientation.beta)); |
| 282 this._gammaSetter(roundAngle(deviceOrientation.gamma)); | 282 this._gammaSetter(roundAngle(deviceOrientation.gamma)); |
| 283 } | 283 } |
| 284 | 284 |
| 285 var animate = modificationSource !== WebInspector.SensorsView.DeviceOrientat
ionModificationSource.UserDrag; | 285 var animate = modificationSource !== Emulation.SensorsView.DeviceOrientation
ModificationSource.UserDrag; |
| 286 this._setBoxOrientation(deviceOrientation, animate); | 286 this._setBoxOrientation(deviceOrientation, animate); |
| 287 | 287 |
| 288 this._deviceOrientation = deviceOrientation; | 288 this._deviceOrientation = deviceOrientation; |
| 289 this._applyDeviceOrientation(); | 289 this._applyDeviceOrientation(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 /** | 292 /** |
| 293 * @param {!Element} parentElement | 293 * @param {!Element} parentElement |
| 294 * @param {!Element} input | 294 * @param {!Element} input |
| 295 * @param {string} label | 295 * @param {string} label |
| 296 * @return {function(string)} | 296 * @return {function(string)} |
| 297 */ | 297 */ |
| 298 _createAxisInput(parentElement, input, label) { | 298 _createAxisInput(parentElement, input, label) { |
| 299 var div = parentElement.createChild('div', 'orientation-axis-input-container
'); | 299 var div = parentElement.createChild('div', 'orientation-axis-input-container
'); |
| 300 div.appendChild(input); | 300 div.appendChild(input); |
| 301 div.createTextChild(label); | 301 div.createTextChild(label); |
| 302 input.type = 'number'; | 302 input.type = 'number'; |
| 303 return WebInspector.bindInput( | 303 return UI.bindInput( |
| 304 input, this._applyDeviceOrientationUserInput.bind(this), WebInspector.De
viceOrientation.validator, true); | 304 input, this._applyDeviceOrientationUserInput.bind(this), Emulation.Devic
eOrientation.validator, true); |
| 305 } | 305 } |
| 306 | 306 |
| 307 /** | 307 /** |
| 308 * @param {!WebInspector.DeviceOrientation} deviceOrientation | 308 * @param {!Emulation.DeviceOrientation} deviceOrientation |
| 309 * @return {!Element} | 309 * @return {!Element} |
| 310 */ | 310 */ |
| 311 _createDeviceOrientationOverrideElement(deviceOrientation) { | 311 _createDeviceOrientationOverrideElement(deviceOrientation) { |
| 312 var fieldsetElement = createElement('fieldset'); | 312 var fieldsetElement = createElement('fieldset'); |
| 313 fieldsetElement.classList.add('device-orientation-override-section'); | 313 fieldsetElement.classList.add('device-orientation-override-section'); |
| 314 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell
'); | 314 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell
'); |
| 315 | 315 |
| 316 this._alphaElement = createElement('input'); | 316 this._alphaElement = createElement('input'); |
| 317 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, W
ebInspector.UIString('\u03B1 (alpha)')); | 317 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, C
ommon.UIString('\u03B1 (alpha)')); |
| 318 this._alphaSetter(String(deviceOrientation.alpha)); | 318 this._alphaSetter(String(deviceOrientation.alpha)); |
| 319 | 319 |
| 320 this._betaElement = createElement('input'); | 320 this._betaElement = createElement('input'); |
| 321 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Web
Inspector.UIString('\u03B2 (beta)')); | 321 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Com
mon.UIString('\u03B2 (beta)')); |
| 322 this._betaSetter(String(deviceOrientation.beta)); | 322 this._betaSetter(String(deviceOrientation.beta)); |
| 323 | 323 |
| 324 this._gammaElement = createElement('input'); | 324 this._gammaElement = createElement('input'); |
| 325 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, W
ebInspector.UIString('\u03B3 (gamma)')); | 325 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, C
ommon.UIString('\u03B3 (gamma)')); |
| 326 this._gammaSetter(String(deviceOrientation.gamma)); | 326 this._gammaSetter(String(deviceOrientation.gamma)); |
| 327 | 327 |
| 328 cellElement.appendChild(createTextButton( | 328 cellElement.appendChild(createTextButton( |
| 329 WebInspector.UIString('Reset'), this._resetDeviceOrientation.bind(this),
'orientation-reset-button')); | 329 Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orie
ntation-reset-button')); |
| 330 return fieldsetElement; | 330 return fieldsetElement; |
| 331 } | 331 } |
| 332 | 332 |
| 333 /** | 333 /** |
| 334 * @param {!WebInspector.DeviceOrientation} deviceOrientation | 334 * @param {!Emulation.DeviceOrientation} deviceOrientation |
| 335 * @param {boolean} animate | 335 * @param {boolean} animate |
| 336 */ | 336 */ |
| 337 _setBoxOrientation(deviceOrientation, animate) { | 337 _setBoxOrientation(deviceOrientation, animate) { |
| 338 if (animate) | 338 if (animate) |
| 339 this._stageElement.classList.add('is-animating'); | 339 this._stageElement.classList.add('is-animating'); |
| 340 else | 340 else |
| 341 this._stageElement.classList.remove('is-animating'); | 341 this._stageElement.classList.remove('is-animating'); |
| 342 | 342 |
| 343 // The CSS transform should not depend on matrix3d, which does not interpola
te well. | 343 // The CSS transform should not depend on matrix3d, which does not interpola
te well. |
| 344 var matrix = new WebKitCSSMatrix(); | 344 var matrix = new WebKitCSSMatrix(); |
| 345 this._boxMatrix = matrix.rotate(-deviceOrientation.beta, deviceOrientation.g
amma, -deviceOrientation.alpha); | 345 this._boxMatrix = matrix.rotate(-deviceOrientation.beta, deviceOrientation.g
amma, -deviceOrientation.alpha); |
| 346 var eulerAngles = | 346 var eulerAngles = |
| 347 new WebInspector.Geometry.EulerAngles(deviceOrientation.alpha, deviceOri
entation.beta, deviceOrientation.gamma); | 347 new Common.Geometry.EulerAngles(deviceOrientation.alpha, deviceOrientati
on.beta, deviceOrientation.gamma); |
| 348 this._orientationLayer.style.transform = eulerAngles.toRotate3DString(); | 348 this._orientationLayer.style.transform = eulerAngles.toRotate3DString(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * @param {!MouseEvent} event | 352 * @param {!MouseEvent} event |
| 353 * @return {boolean} | 353 * @return {boolean} |
| 354 */ | 354 */ |
| 355 _onBoxDrag(event) { | 355 _onBoxDrag(event) { |
| 356 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y); | 356 var mouseMoveVector = this._calculateRadiusVector(event.x, event.y); |
| 357 if (!mouseMoveVector) | 357 if (!mouseMoveVector) |
| 358 return true; | 358 return true; |
| 359 | 359 |
| 360 event.consume(true); | 360 event.consume(true); |
| 361 var axis, angle; | 361 var axis, angle; |
| 362 if (event.shiftKey) { | 362 if (event.shiftKey) { |
| 363 axis = new WebInspector.Geometry.Vector(0, 0, -1); | 363 axis = new Common.Geometry.Vector(0, 0, -1); |
| 364 angle = (this._mouseDownVector.x - mouseMoveVector.x) * WebInspector.Senso
rsView.ShiftDragOrientationSpeed; | 364 angle = (this._mouseDownVector.x - mouseMoveVector.x) * Emulation.SensorsV
iew.ShiftDragOrientationSpeed; |
| 365 } else { | 365 } else { |
| 366 axis = WebInspector.Geometry.crossProduct(this._mouseDownVector, mouseMove
Vector); | 366 axis = Common.Geometry.crossProduct(this._mouseDownVector, mouseMoveVector
); |
| 367 angle = WebInspector.Geometry.calculateAngle(this._mouseDownVector, mouseM
oveVector); | 367 angle = Common.Geometry.calculateAngle(this._mouseDownVector, mouseMoveVec
tor); |
| 368 } | 368 } |
| 369 | 369 |
| 370 // The mouse movement vectors occur in the screen space, which is offset by
90 degrees from | 370 // The mouse movement vectors occur in the screen space, which is offset by
90 degrees from |
| 371 // the actual device orientation. | 371 // the actual device orientation. |
| 372 var currentMatrix = new WebKitCSSMatrix(); | 372 var currentMatrix = new WebKitCSSMatrix(); |
| 373 currentMatrix = currentMatrix.rotate(-90, 0, 0) | 373 currentMatrix = currentMatrix.rotate(-90, 0, 0) |
| 374 .rotateAxisAngle(axis.x, axis.y, axis.z, angle) | 374 .rotateAxisAngle(axis.x, axis.y, axis.z, angle) |
| 375 .rotate(90, 0, 0) | 375 .rotate(90, 0, 0) |
| 376 .multiply(this._originalBoxMatrix); | 376 .multiply(this._originalBoxMatrix); |
| 377 | 377 |
| 378 var eulerAngles = WebInspector.Geometry.EulerAngles.fromRotationMatrix(curre
ntMatrix); | 378 var eulerAngles = Common.Geometry.EulerAngles.fromRotationMatrix(currentMatr
ix); |
| 379 var newOrientation = new WebInspector.DeviceOrientation(-eulerAngles.alpha,
-eulerAngles.beta, eulerAngles.gamma); | 379 var newOrientation = new Emulation.DeviceOrientation(-eulerAngles.alpha, -eu
lerAngles.beta, eulerAngles.gamma); |
| 380 this._setDeviceOrientation(newOrientation, WebInspector.SensorsView.DeviceOr
ientationModificationSource.UserDrag); | 380 this._setDeviceOrientation(newOrientation, Emulation.SensorsView.DeviceOrien
tationModificationSource.UserDrag); |
| 381 this._setSelectElementLabel(this._orientationSelectElement, WebInspector.Sen
sorsView.NonPresetOptions.Custom); | 381 this._setSelectElementLabel(this._orientationSelectElement, Emulation.Sensor
sView.NonPresetOptions.Custom); |
| 382 return false; | 382 return false; |
| 383 } | 383 } |
| 384 | 384 |
| 385 /** | 385 /** |
| 386 * @param {!MouseEvent} event | 386 * @param {!MouseEvent} event |
| 387 * @return {boolean} | 387 * @return {boolean} |
| 388 */ | 388 */ |
| 389 _onBoxDragStart(event) { | 389 _onBoxDragStart(event) { |
| 390 if (!this._deviceOrientationOverrideEnabled) | 390 if (!this._deviceOrientationOverrideEnabled) |
| 391 return false; | 391 return false; |
| 392 | 392 |
| 393 this._mouseDownVector = this._calculateRadiusVector(event.x, event.y); | 393 this._mouseDownVector = this._calculateRadiusVector(event.x, event.y); |
| 394 this._originalBoxMatrix = this._boxMatrix; | 394 this._originalBoxMatrix = this._boxMatrix; |
| 395 | 395 |
| 396 if (!this._mouseDownVector) | 396 if (!this._mouseDownVector) |
| 397 return false; | 397 return false; |
| 398 | 398 |
| 399 event.consume(true); | 399 event.consume(true); |
| 400 return true; | 400 return true; |
| 401 } | 401 } |
| 402 | 402 |
| 403 /** | 403 /** |
| 404 * @param {number} x | 404 * @param {number} x |
| 405 * @param {number} y | 405 * @param {number} y |
| 406 * @return {?WebInspector.Geometry.Vector} | 406 * @return {?Common.Geometry.Vector} |
| 407 */ | 407 */ |
| 408 _calculateRadiusVector(x, y) { | 408 _calculateRadiusVector(x, y) { |
| 409 var rect = this._stageElement.getBoundingClientRect(); | 409 var rect = this._stageElement.getBoundingClientRect(); |
| 410 var radius = Math.max(rect.width, rect.height) / 2; | 410 var radius = Math.max(rect.width, rect.height) / 2; |
| 411 var sphereX = (x - rect.left - rect.width / 2) / radius; | 411 var sphereX = (x - rect.left - rect.width / 2) / radius; |
| 412 var sphereY = (y - rect.top - rect.height / 2) / radius; | 412 var sphereY = (y - rect.top - rect.height / 2) / radius; |
| 413 var sqrSum = sphereX * sphereX + sphereY * sphereY; | 413 var sqrSum = sphereX * sphereX + sphereY * sphereY; |
| 414 if (sqrSum > 0.5) | 414 if (sqrSum > 0.5) |
| 415 return new WebInspector.Geometry.Vector(sphereX, sphereY, 0.5 / Math.sqrt(
sqrSum)); | 415 return new Common.Geometry.Vector(sphereX, sphereY, 0.5 / Math.sqrt(sqrSum
)); |
| 416 | 416 |
| 417 return new WebInspector.Geometry.Vector(sphereX, sphereY, Math.sqrt(1 - sqrS
um)); | 417 return new Common.Geometry.Vector(sphereX, sphereY, Math.sqrt(1 - sqrSum)); |
| 418 } | 418 } |
| 419 | 419 |
| 420 _appendTouchControl() { | 420 _appendTouchControl() { |
| 421 var groupElement = this.contentElement.createChild('div', 'sensors-group'); | 421 var groupElement = this.contentElement.createChild('div', 'sensors-group'); |
| 422 var title = groupElement.createChild('div', 'sensors-group-title'); | 422 var title = groupElement.createChild('div', 'sensors-group-title'); |
| 423 var fieldsElement = groupElement.createChild('div', 'sensors-group-fields'); | 423 var fieldsElement = groupElement.createChild('div', 'sensors-group-fields'); |
| 424 | 424 |
| 425 title.textContent = WebInspector.UIString('Touch'); | 425 title.textContent = Common.UIString('Touch'); |
| 426 var select = fieldsElement.createChild('select', 'chrome-select'); | 426 var select = fieldsElement.createChild('select', 'chrome-select'); |
| 427 select.appendChild(new Option(WebInspector.UIString('Device-based'), 'auto')
); | 427 select.appendChild(new Option(Common.UIString('Device-based'), 'auto')); |
| 428 select.appendChild(new Option(WebInspector.UIString('Force enabled'), 'enabl
ed')); | 428 select.appendChild(new Option(Common.UIString('Force enabled'), 'enabled')); |
| 429 select.addEventListener('change', applyTouch, false); | 429 select.addEventListener('change', applyTouch, false); |
| 430 | 430 |
| 431 function applyTouch() { | 431 function applyTouch() { |
| 432 WebInspector.MultitargetTouchModel.instance().setCustomTouchEnabled(select
.value === 'enabled'); | 432 Emulation.MultitargetTouchModel.instance().setCustomTouchEnabled(select.va
lue === 'enabled'); |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 /** @enum {string} */ | 437 /** @enum {string} */ |
| 438 WebInspector.SensorsView.DeviceOrientationModificationSource = { | 438 Emulation.SensorsView.DeviceOrientationModificationSource = { |
| 439 UserInput: 'userInput', | 439 UserInput: 'userInput', |
| 440 UserDrag: 'userDrag', | 440 UserDrag: 'userDrag', |
| 441 ResetButton: 'resetButton', | 441 ResetButton: 'resetButton', |
| 442 SelectPreset: 'selectPreset' | 442 SelectPreset: 'selectPreset' |
| 443 }; | 443 }; |
| 444 | 444 |
| 445 /** {string} */ | 445 /** {string} */ |
| 446 WebInspector.SensorsView.NonPresetOptions = { | 446 Emulation.SensorsView.NonPresetOptions = { |
| 447 'NoOverride': 'noOverride', | 447 'NoOverride': 'noOverride', |
| 448 'Custom': 'custom', | 448 'Custom': 'custom', |
| 449 'Unavailable': 'unavailable' | 449 'Unavailable': 'unavailable' |
| 450 }; | 450 }; |
| 451 | 451 |
| 452 /** @type {!Array.<{title: string, value: !Array.<{title: string, location: stri
ng}>}>} */ | 452 /** @type {!Array.<{title: string, value: !Array.<{title: string, location: stri
ng}>}>} */ |
| 453 WebInspector.SensorsView.PresetLocations = [ | 453 Emulation.SensorsView.PresetLocations = [ |
| 454 { | 454 { |
| 455 title: 'Presets', | 455 title: 'Presets', |
| 456 value: [ | 456 value: [ |
| 457 {title: WebInspector.UIString('Berlin'), location: '[52.520007, 13.404954]
'}, | 457 {title: Common.UIString('Berlin'), location: '[52.520007, 13.404954]'}, |
| 458 {title: WebInspector.UIString('London'), location: '[51.507351, -0.127758]
'}, | 458 {title: Common.UIString('London'), location: '[51.507351, -0.127758]'}, |
| 459 {title: WebInspector.UIString('Moscow'), location: '[55.755826, 37.617300]
'}, | 459 {title: Common.UIString('Moscow'), location: '[55.755826, 37.617300]'}, |
| 460 {title: WebInspector.UIString('Mountain View'), location: '[37.386052, -12
2.083851]'}, | 460 {title: Common.UIString('Mountain View'), location: '[37.386052, -122.0838
51]'}, |
| 461 {title: WebInspector.UIString('Mumbai'), location: '[19.075984, 72.877656]
'}, | 461 {title: Common.UIString('Mumbai'), location: '[19.075984, 72.877656]'}, |
| 462 {title: WebInspector.UIString('San Francisco'), location: '[37.774929, -12
2.419416]'}, | 462 {title: Common.UIString('San Francisco'), location: '[37.774929, -122.4194
16]'}, |
| 463 {title: WebInspector.UIString('Shanghai'), location: '[31.230416, 121.4737
01]'}, | 463 {title: Common.UIString('Shanghai'), location: '[31.230416, 121.473701]'}, |
| 464 {title: WebInspector.UIString('São Paulo'), location: '[-23.550520, -46.63
3309]'}, | 464 {title: Common.UIString('São Paulo'), location: '[-23.550520, -46.633309]'
}, |
| 465 {title: WebInspector.UIString('Tokyo'), location: '[35.689487, 139.691706]
'}, | 465 {title: Common.UIString('Tokyo'), location: '[35.689487, 139.691706]'}, |
| 466 ] | 466 ] |
| 467 }, | 467 }, |
| 468 { | 468 { |
| 469 title: 'Error', | 469 title: 'Error', |
| 470 value: [{ | 470 value: [{ |
| 471 title: WebInspector.UIString('Location unavailable'), | 471 title: Common.UIString('Location unavailable'), |
| 472 location: WebInspector.SensorsView.NonPresetOptions.Unavailable | 472 location: Emulation.SensorsView.NonPresetOptions.Unavailable |
| 473 }] | 473 }] |
| 474 } | 474 } |
| 475 ]; | 475 ]; |
| 476 | 476 |
| 477 /** @type {!Array.<{title: string, value: !Array.<{title: string, orientation: !
WebInspector.DeviceOrientation}>}>} */ | 477 /** @type {!Array.<{title: string, value: !Array.<{title: string, orientation: !
Emulation.DeviceOrientation}>}>} */ |
| 478 WebInspector.SensorsView.PresetOrientations = [{ | 478 Emulation.SensorsView.PresetOrientations = [{ |
| 479 title: 'Presets', | 479 title: 'Presets', |
| 480 value: [ | 480 value: [ |
| 481 {title: WebInspector.UIString('Portrait'), orientation: '[0, 90, 0]'}, | 481 {title: Common.UIString('Portrait'), orientation: '[0, 90, 0]'}, |
| 482 {title: WebInspector.UIString('Portrait upside down'), orientation: '[180, -
90, 0]'}, | 482 {title: Common.UIString('Portrait upside down'), orientation: '[180, -90, 0]
'}, |
| 483 {title: WebInspector.UIString('Landscape left'), orientation: '[0, 90, -90]'
}, | 483 {title: Common.UIString('Landscape left'), orientation: '[0, 90, -90]'}, |
| 484 {title: WebInspector.UIString('Landscape right'), orientation: '[0, 90, 90]'
}, | 484 {title: Common.UIString('Landscape right'), orientation: '[0, 90, 90]'}, |
| 485 {title: WebInspector.UIString('Display up'), orientation: '[0, 0, 0]'}, | 485 {title: Common.UIString('Display up'), orientation: '[0, 0, 0]'}, |
| 486 {title: WebInspector.UIString('Display down'), orientation: '[0, 180, 0]'} | 486 {title: Common.UIString('Display down'), orientation: '[0, 180, 0]'} |
| 487 ] | 487 ] |
| 488 }]; | 488 }]; |
| 489 | 489 |
| 490 | 490 |
| 491 /** | 491 /** |
| 492 * @implements {WebInspector.ActionDelegate} | 492 * @implements {UI.ActionDelegate} |
| 493 * @unrestricted | 493 * @unrestricted |
| 494 */ | 494 */ |
| 495 WebInspector.SensorsView.ShowActionDelegate = class { | 495 Emulation.SensorsView.ShowActionDelegate = class { |
| 496 /** | 496 /** |
| 497 * @override | 497 * @override |
| 498 * @param {!WebInspector.Context} context | 498 * @param {!UI.Context} context |
| 499 * @param {string} actionId | 499 * @param {string} actionId |
| 500 * @return {boolean} | 500 * @return {boolean} |
| 501 */ | 501 */ |
| 502 handleAction(context, actionId) { | 502 handleAction(context, actionId) { |
| 503 WebInspector.viewManager.showView('sensors'); | 503 UI.viewManager.showView('sensors'); |
| 504 return true; | 504 return true; |
| 505 } | 505 } |
| 506 }; | 506 }; |
| 507 | 507 |
| 508 WebInspector.SensorsView.ShiftDragOrientationSpeed = 16; | 508 Emulation.SensorsView.ShiftDragOrientationSpeed = 16; |
| OLD | NEW |