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

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

Issue 2300403003: DevTools: patch browser's Chrome version into Chrome user agents for emulation (Closed)
Patch Set: renames Created 4 years, 3 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 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698