| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 */ | 7 */ |
| 8 WebInspector.EmulatedDevice = function() | 8 WebInspector.EmulatedDevice = function() |
| 9 { | 9 { |
| 10 /** @type {string} */ | 10 /** @type {string} */ |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (result.outlineInsets.left < 0 || result.outlineInsets.top <
0) | 132 if (result.outlineInsets.left < 0 || result.outlineInsets.top <
0) |
| 133 throw new Error("Emulated device has wrong outline insets"); | 133 throw new Error("Emulated device has wrong outline insets"); |
| 134 result.outlineImage = /** @type {string} */ (parseValue(json["ou
tline"], "image", "string")); | 134 result.outlineImage = /** @type {string} */ (parseValue(json["ou
tline"], "image", "string")); |
| 135 } | 135 } |
| 136 return /** @type {!WebInspector.EmulatedDevice.Orientation} */ (resu
lt); | 136 return /** @type {!WebInspector.EmulatedDevice.Orientation} */ (resu
lt); |
| 137 } | 137 } |
| 138 | 138 |
| 139 var result = new WebInspector.EmulatedDevice(); | 139 var result = new WebInspector.EmulatedDevice(); |
| 140 result.title = /** @type {string} */ (parseValue(json, "title", "string"
)); | 140 result.title = /** @type {string} */ (parseValue(json, "title", "string"
)); |
| 141 result.type = /** @type {string} */ (parseValue(json, "type", "string"))
; | 141 result.type = /** @type {string} */ (parseValue(json, "type", "string"))
; |
| 142 result.userAgent = /** @type {string} */ (parseValue(json, "user-agent",
"string")); | 142 var rawUserAgent = /** @type {string} */ (parseValue(json, "user-agent",
"string")); |
| 143 result.userAgent = WebInspector.MultitargetNetworkManager.patchUserAgent
WithChromeVersion(rawUserAgent); |
| 143 | 144 |
| 144 var capabilities = parseValue(json, "capabilities", "object", []); | 145 var capabilities = parseValue(json, "capabilities", "object", []); |
| 145 if (!Array.isArray(capabilities)) | 146 if (!Array.isArray(capabilities)) |
| 146 throw new Error("Emulated device capabilities must be an array"); | 147 throw new Error("Emulated device capabilities must be an array"); |
| 147 result.capabilities = []; | 148 result.capabilities = []; |
| 148 for (var i = 0; i < capabilities.length; ++i) { | 149 for (var i = 0; i < capabilities.length; ++i) { |
| 149 if (typeof capabilities[i] !== "string") | 150 if (typeof capabilities[i] !== "string") |
| 150 throw new Error("Emulated device capability must be a string"); | 151 throw new Error("Emulated device capability must be a string"); |
| 151 result.capabilities.push(capabilities[i]); | 152 result.capabilities.push(capabilities[i]); |
| 152 } | 153 } |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 520 |
| 520 /** | 521 /** |
| 521 * @return {!WebInspector.EmulatedDevicesList} | 522 * @return {!WebInspector.EmulatedDevicesList} |
| 522 */ | 523 */ |
| 523 WebInspector.EmulatedDevicesList.instance = function() | 524 WebInspector.EmulatedDevicesList.instance = function() |
| 524 { | 525 { |
| 525 if (!WebInspector.EmulatedDevicesList._instance) | 526 if (!WebInspector.EmulatedDevicesList._instance) |
| 526 WebInspector.EmulatedDevicesList._instance = new WebInspector.EmulatedDe
vicesList(); | 527 WebInspector.EmulatedDevicesList._instance = new WebInspector.EmulatedDe
vicesList(); |
| 527 return /** @type {!WebInspector.EmulatedDevicesList} */ (WebInspector.Emulat
edDevicesList._instance); | 528 return /** @type {!WebInspector.EmulatedDevicesList} */ (WebInspector.Emulat
edDevicesList._instance); |
| 528 } | 529 } |
| OLD | NEW |