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

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: use sprintf, default chrome version for fallback 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 result.userAgent = /** @type {string} */ (parseValue(json, "user-agent", "string"));
143 result.userAgent = WebInspector.BrowserVersionInfo.patchUserAgentWithCur rentVersion(result.userAgent, "Chrome");
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 519
519 /** 520 /**
520 * @return {!WebInspector.EmulatedDevicesList} 521 * @return {!WebInspector.EmulatedDevicesList}
521 */ 522 */
522 WebInspector.EmulatedDevicesList.instance = function() 523 WebInspector.EmulatedDevicesList.instance = function()
523 { 524 {
524 if (!WebInspector.EmulatedDevicesList._instance) 525 if (!WebInspector.EmulatedDevicesList._instance)
525 WebInspector.EmulatedDevicesList._instance = new WebInspector.EmulatedDe vicesList(); 526 WebInspector.EmulatedDevicesList._instance = new WebInspector.EmulatedDe vicesList();
526 return /** @type {!WebInspector.EmulatedDevicesList} */ (WebInspector.Emulat edDevicesList._instance); 527 return /** @type {!WebInspector.EmulatedDevicesList} */ (WebInspector.Emulat edDevicesList._instance);
527 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698