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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js

Issue 2300403003: DevTools: patch browser's Chrome version into Chrome user agents for emulation (Closed)
Patch Set: address comments 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 (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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.NetworkConfigView = function() 9 WebInspector.NetworkConfigView = function()
10 { 10 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 */ 91 */
92 WebInspector.NetworkConfigView.createUserAgentSelectAndInput = function() 92 WebInspector.NetworkConfigView.createUserAgentSelectAndInput = function()
93 { 93 {
94 var userAgentSetting = WebInspector.settings.createSetting("customUserAgent" , ""); 94 var userAgentSetting = WebInspector.settings.createSetting("customUserAgent" , "");
95 var userAgentSelectElement = createElement("select"); 95 var userAgentSelectElement = createElement("select");
96 96
97 const customOverride = {title: WebInspector.UIString("Custom..."), value: "c ustom"}; 97 const customOverride = {title: WebInspector.UIString("Custom..."), value: "c ustom"};
98 userAgentSelectElement.appendChild(new Option(customOverride.title, customOv erride.value)); 98 userAgentSelectElement.appendChild(new Option(customOverride.title, customOv erride.value));
99 99
100 var groups = WebInspector.NetworkConfigView._userAgentGroups; 100 var groups = WebInspector.NetworkConfigView._userAgentGroups;
101 for (var userAgentDescriptor of WebInspector.NetworkConfigView._userAgentGro ups) { 101 for (var userAgentDescriptor of groups) {
102 var groupElement = userAgentSelectElement.createChild("optgroup"); 102 var groupElement = userAgentSelectElement.createChild("optgroup");
103 groupElement.label = userAgentDescriptor.title; 103 groupElement.label = userAgentDescriptor.title;
104 for (var userAgentVersion of userAgentDescriptor.values) 104 for (var userAgentVersion of userAgentDescriptor.values) {
105 groupElement.appendChild(new Option(userAgentVersion.title, userAgen tVersion.value)); 105 var userAgentValue = WebInspector.BrowserVersionInfo.patchUserAgentW ithChromeVersion(userAgentVersion.value);
106 groupElement.appendChild(new Option(userAgentVersion.title, userAgen tValue));
107 }
106 } 108 }
107 109
108 userAgentSelectElement.selectedIndex = 0; 110 userAgentSelectElement.selectedIndex = 0;
109 111
110 var otherUserAgentElement = createElement("input"); 112 var otherUserAgentElement = createElement("input");
111 otherUserAgentElement.type = "text"; 113 otherUserAgentElement.type = "text";
112 otherUserAgentElement.value = userAgentSetting.get(); 114 otherUserAgentElement.value = userAgentSetting.get();
113 otherUserAgentElement.title = userAgentSetting.get(); 115 otherUserAgentElement.title = userAgentSetting.get();
114 otherUserAgentElement.placeholder = WebInspector.UIString("Enter a custom us er agent"); 116 otherUserAgentElement.placeholder = WebInspector.UIString("Enter a custom us er agent");
115 otherUserAgentElement.required = true; 117 otherUserAgentElement.required = true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (userAgentSetting.get() !== otherUserAgentElement.value) { 154 if (userAgentSetting.get() !== otherUserAgentElement.value) {
153 userAgentSetting.set(otherUserAgentElement.value); 155 userAgentSetting.set(otherUserAgentElement.value);
154 otherUserAgentElement.title = otherUserAgentElement.value; 156 otherUserAgentElement.title = otherUserAgentElement.value;
155 settingChanged(); 157 settingChanged();
156 } 158 }
157 } 159 }
158 160
159 return { select: userAgentSelectElement, input: otherUserAgentElement }; 161 return { select: userAgentSelectElement, input: otherUserAgentElement };
160 } 162 }
161 163
162
163 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string }>}>} */ 164 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string }>}>} */
164 WebInspector.NetworkConfigView._userAgentGroups = [ 165 WebInspector.NetworkConfigView._userAgentGroups = [
165 { 166 {
166 title: "Android", 167 title: "Android",
167 values: [ 168 values: [
168 {title: "Android (4.0.2) Browser \u2014 Galaxy Nexus", value: "Mozil la/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/5 34.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"}, 169 {title: "Android (4.0.2) Browser \u2014 Galaxy Nexus", value: "Mozil la/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/5 34.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30"},
169 {title: "Android (2.3) Browser \u2014 Nexus S", value: "Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"} 170 {title: "Android (2.3) Browser \u2014 Nexus S", value: "Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"}
170 ] 171 ]
171 }, 172 },
172 { 173 {
173 title: "BlackBerry", 174 title: "BlackBerry",
174 values: [ 175 values: [
175 {title: "BlackBerry \u2014 BB10", value: "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+" }, 176 {title: "BlackBerry \u2014 BB10", value: "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+" },
176 {title: "BlackBerry \u2014 PlayBook 2.1", value: "Mozilla/5.0 (PlayB ook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Versi on/7.2.1.0 Safari/536.2+"}, 177 {title: "BlackBerry \u2014 PlayBook 2.1", value: "Mozilla/5.0 (PlayB ook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Versi on/7.2.1.0 Safari/536.2+"},
177 {title: "BlackBerry \u2014 9900", value: "Mozilla/5.0 (BlackBerry; U ; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0. 187 Mobile Safari/534.11+"} 178 {title: "BlackBerry \u2014 9900", value: "Mozilla/5.0 (BlackBerry; U ; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0. 187 Mobile Safari/534.11+"}
178 ] 179 ]
179 }, 180 },
180 { 181 {
181 title: "Chrome", 182 title: "Chrome",
182 values: [ 183 values: [
183 {title: "Chrome 52 \u2014 Android Mobile", value: "Mozilla/5.0 (Linu x; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chr ome/52.0.2725.0 Mobile Safari/537.36"}, 184 {title: "Chrome \u2014 Android Mobile", value: "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome /55.0.2860.0 Mobile Safari/537.36"},
pfeldman 2016/09/15 21:44:07 ditto
luoe 2016/09/15 23:18:08 Done.
184 {title: "Chrome 52 \u2014 Android Tablet", value: "Mozilla/5.0 (Linu x; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chr ome/52.0.2725.0 Safari/537.36"}, 185 {title: "Chrome \u2014 Android Tablet", value: "Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome /55.0.2860.0 Safari/537.36"},
185 {title: "Chrome 52 \u2014 iPhone", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/52.0.27 25.0 Mobile/13B143 Safari/601.1.46"}, 186 {title: "Chrome \u2014 iPhone", value: "Mozilla/5.0 (iPhone; CPU iPh one OS 9_1 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/55.0.2860. 0 Mobile/13B143 Safari/601.1.46"},
186 {title: "Chrome 52 \u2014 iPad", value: "Mozilla/5.0 (iPad; CPU OS 9 _1 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/52.0.2725.0 Mobile /13B143 Safari/601.1.46"}, 187 {title: "Chrome \u2014 iPad", value: "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/55.0.2860.0 Mobile/13 B143 Safari/601.1.46"},
187 {title: "Chrome 52 \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Inte l Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2725.0 Sa fari/537.36"}, 188 {title: "Chrome \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel M ac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2860.0 Safar i/537.36"},
188 {title: "Chrome 52 \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2725.0 Safari/53 7.36"} 189 {title: "Chrome \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10. 0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2860.0 Safari/537.3 6"}
189 ] 190 ]
190 }, 191 },
191 { 192 {
192 title: "Edge", 193 title: "Edge",
193 values: [ 194 values: [
194 {title: "Edge \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/ 537.36 Edge/12.10240"}, 195 {title: "Edge \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/ 537.36 Edge/12.10240"},
195 {title: "Edge \u2014 Mobile", value: "Mozilla/5.0 (Windows Phone 10. 0; Android 4.2.1; Microsoft; Lumia 640 XL LTE) AppleWebKit/537.36 (KHTML, like G ecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166"}, 196 {title: "Edge \u2014 Mobile", value: "Mozilla/5.0 (Windows Phone 10. 0; Android 4.2.1; Microsoft; Lumia 640 XL LTE) AppleWebKit/537.36 (KHTML, like G ecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166"},
196 {title: "Edge \u2014 XBox", value: "Mozilla/5.0 (Windows NT 10.0; Wi n64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.231 1.135 Safari/537.36 Edge/13.10586"} 197 {title: "Edge \u2014 XBox", value: "Mozilla/5.0 (Windows NT 10.0; Wi n64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.231 1.135 Safari/537.36 Edge/13.10586"}
197 ] 198 ]
198 }, 199 },
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 }, 238 },
238 { 239 {
239 title: "Safari", 240 title: "Safari",
240 values: [ 241 values: [
241 {title: "Safari \u2014 iPad iOS 9", value: "Mozilla/5.0 (iPad; CPU O S 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile /13B137 Safari/601.1"}, 242 {title: "Safari \u2014 iPad iOS 9", value: "Mozilla/5.0 (iPad; CPU O S 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile /13B137 Safari/601.1"},
242 {title: "Safari \u2014 iPhone iOS 9", value: "Mozilla/5.0 (iPhone; C PU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version /9.0 Mobile/13B137 Safari/601.1"}, 243 {title: "Safari \u2014 iPhone iOS 9", value: "Mozilla/5.0 (iPhone; C PU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version /9.0 Mobile/13B137 Safari/601.1"},
243 {title: "Safari \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel M ac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7 046A194A"} 244 {title: "Safari \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel M ac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7 046A194A"}
244 ] 245 ]
245 } 246 }
246 ] 247 ]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698