| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 WebInspector.OverridesUI = {} | 5 WebInspector.OverridesUI = {} |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 * @param {!Element} rotateButton | 9 * @param {!Element} rotateButton |
| 10 * @param {?function(!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.
Mode)} callback |
| 10 */ | 11 */ |
| 11 WebInspector.DeviceSelect = function(rotateButton) | 12 WebInspector.DeviceSelect = function(rotateButton, callback) |
| 12 { | 13 { |
| 13 this._callback = null; | 14 this._callback = callback; |
| 14 this._rotateButton = rotateButton; | 15 this._rotateButton = rotateButton; |
| 15 this.element = createElement("p"); | 16 this.element = createElement("p"); |
| 16 | 17 |
| 17 this._deviceSelectElement = this.element.createChild("select", "device-selec
t"); | 18 this._deviceSelectElement = this.element.createChild("select", "device-selec
t"); |
| 18 this._deviceSelectElement.addEventListener("change", this._deviceSelected.bi
nd(this), false); | 19 this._deviceSelectElement.addEventListener("change", this._deviceSelected.bi
nd(this), false); |
| 19 | 20 |
| 20 var container = this.element.createChild("div", "mode-container"); | 21 var container = this.element.createChild("div", "mode-container"); |
| 21 container.appendChild(this._rotateButton); | 22 container.appendChild(this._rotateButton); |
| 22 this._rotateButton.addEventListener("click", this._rotateButtonClicked.bind(
this), false); | 23 this._rotateButton.addEventListener("click", this._rotateButtonClicked.bind(
this), false); |
| 23 this._rotateButton.title = WebInspector.UIString("Change orientation"); | 24 this._rotateButton.title = WebInspector.UIString("Change orientation"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 WebInspector.overridesSupport.settings.emulateMobile.addChangeListener(this.
_emulatedSettingChanged, this); | 39 WebInspector.overridesSupport.settings.emulateMobile.addChangeListener(this.
_emulatedSettingChanged, this); |
| 39 WebInspector.overridesSupport.settings.emulateTouch.addChangeListener(this._
emulatedSettingChanged, this); | 40 WebInspector.overridesSupport.settings.emulateTouch.addChangeListener(this._
emulatedSettingChanged, this); |
| 40 WebInspector.overridesSupport.settings.userAgent.addChangeListener(this._emu
latedSettingChanged, this); | 41 WebInspector.overridesSupport.settings.userAgent.addChangeListener(this._emu
latedSettingChanged, this); |
| 41 | 42 |
| 42 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic
esList.Events.CustomDevicesUpdated, this._deviceListChanged, this); | 43 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic
esList.Events.CustomDevicesUpdated, this._deviceListChanged, this); |
| 43 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic
esList.Events.StandardDevicesUpdated, this._deviceListChanged, this); | 44 WebInspector.emulatedDevicesList.addEventListener(WebInspector.EmulatedDevic
esList.Events.StandardDevicesUpdated, this._deviceListChanged, this); |
| 44 this._deviceListChanged(); | 45 this._deviceListChanged(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 WebInspector.DeviceSelect.prototype = { | 48 WebInspector.DeviceSelect.prototype = { |
| 48 /** | |
| 49 * @param {function(!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevi
ce.Mode)=} callback | |
| 50 */ | |
| 51 setCallback: function(callback) | |
| 52 { | |
| 53 this._callback = callback; | |
| 54 }, | |
| 55 | |
| 56 _deviceListChanged: function() | 49 _deviceListChanged: function() |
| 57 { | 50 { |
| 58 this._deviceSelectElement.removeChildren(); | 51 this._deviceSelectElement.removeChildren(); |
| 59 | 52 |
| 60 var selectDeviceOption = new Option(WebInspector.UIString("<Select model
>"), WebInspector.UIString("<Select model>")); | 53 var selectDeviceOption = new Option(WebInspector.UIString("<Select model
>"), WebInspector.UIString("<Select model>")); |
| 61 selectDeviceOption.device = null; | 54 selectDeviceOption.device = null; |
| 62 selectDeviceOption.disabled = true; | 55 selectDeviceOption.disabled = true; |
| 63 this._deviceSelectElement.appendChild(selectDeviceOption); | 56 this._deviceSelectElement.appendChild(selectDeviceOption); |
| 64 | 57 |
| 65 this._addDeviceGroup(WebInspector.UIString("Custom"), WebInspector.emula
tedDevicesList.custom()); | 58 this._addDeviceGroup(WebInspector.UIString("Custom"), WebInspector.emula
tedDevicesList.custom()); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 {title: "iPhone \u2014 iOS 7", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_
0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/1
1A4449d Safari/9537.53"}, | 353 {title: "iPhone \u2014 iOS 7", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_
0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/1
1A4449d Safari/9537.53"}, |
| 361 {title: "iPhone \u2014 iOS 6", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_
0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A53
76e Safari/8536.25"}, | 354 {title: "iPhone \u2014 iOS 6", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_
0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A53
76e Safari/8536.25"}, |
| 362 {title: "MeeGo \u2014 Nokia N9", value: "Mozilla/5.0 (MeeGo; NokiaN9) AppleW
ebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13"}, | 355 {title: "MeeGo \u2014 Nokia N9", value: "Mozilla/5.0 (MeeGo; NokiaN9) AppleW
ebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13"}, |
| 363 {title: "Opera 18 \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel Mac OS
X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.
36 OPR/18.0.1284.68"}, | 356 {title: "Opera 18 \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel Mac OS
X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.
36 OPR/18.0.1284.68"}, |
| 364 {title: "Opera 18 \u2014 Windows", value: "Mozilla/5.0 (Windows NT 6.1) Appl
eWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.12
84.68"}, | 357 {title: "Opera 18 \u2014 Windows", value: "Mozilla/5.0 (Windows NT 6.1) Appl
eWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36 OPR/18.0.12
84.68"}, |
| 365 {title: "Opera 12 \u2014 Mac", value: "Opera/9.80 (Macintosh; Intel Mac OS X
10.9.1) Presto/2.12.388 Version/12.16"}, | 358 {title: "Opera 12 \u2014 Mac", value: "Opera/9.80 (Macintosh; Intel Mac OS X
10.9.1) Presto/2.12.388 Version/12.16"}, |
| 366 {title: "Opera 12 \u2014 Windows", value: "Opera/9.80 (Windows NT 6.1) Prest
o/2.12.388 Version/12.16"}, | 359 {title: "Opera 12 \u2014 Windows", value: "Opera/9.80 (Windows NT 6.1) Prest
o/2.12.388 Version/12.16"}, |
| 367 {title: "Silk \u2014 Kindle Fire (Desktop view)", value: "Mozilla/5.0 (Linux
; U; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13
Safari/535.19 Silk-Accelerated=true"}, | 360 {title: "Silk \u2014 Kindle Fire (Desktop view)", value: "Mozilla/5.0 (Linux
; U; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13
Safari/535.19 Silk-Accelerated=true"}, |
| 368 {title: "Silk \u2014 Kindle Fire (Mobile view)", value: "Mozilla/5.0 (Linux;
U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Ge
cko) Silk/3.13 Mobile Safari/535.19 Silk-Accelerated=true"} | 361 {title: "Silk \u2014 Kindle Fire (Mobile view)", value: "Mozilla/5.0 (Linux;
U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Ge
cko) Silk/3.13 Mobile Safari/535.19 Silk-Accelerated=true"} |
| 369 ]; | 362 ]; |
| OLD | NEW |