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

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: 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 (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.MultitargetNetworkManager.patchUse rAgentWithChromeVersion(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 /%s Mobile Safari/537.36"},
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 /%s 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/%s 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/%s Mobile/13B143 Safa ri/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/%s Safari/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/%s Safari/537.36"}
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 },
199 { 200 {
200 title: "Firefox", 201 title: "Firefox",
201 values: [ 202 values: [
202 {title: "Firefox 46 \u2014 Android Mobile", value: "Mozilla/5.0 (And roid 4.4; Mobile; rv:46.0) Gecko/46.0 Firefox/46.0"}, 203 {title: "Firefox \u2014 Android Mobile", value: "Mozilla/5.0 (Androi d 4.4; Mobile; rv:46.0) Gecko/46.0 Firefox/46.0"},
203 {title: "Firefox 46 \u2014 Android Tablet", value: "Mozilla/5.0 (And roid 4.4; Tablet; rv:46.0) Gecko/46.0 Firefox/46.0"}, 204 {title: "Firefox \u2014 Android Tablet", value: "Mozilla/5.0 (Androi d 4.4; Tablet; rv:46.0) Gecko/46.0 Firefox/46.0"},
204 {title: "Firefox 46 \u2014 iPhone", value: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4"}, 205 {title: "Firefox \u2014 iPhone", value: "Mozilla/5.0 (iPhone; CPU iP hone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mob ile/12F69 Safari/600.1.4"},
205 {title: "Firefox 46 \u2014 iPad", value: "Mozilla/5.0 (iPad; CPU iPh one OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobi le/12F69 Safari/600.1.4"}, 206 {title: "Firefox \u2014 iPad", value: "Mozilla/5.0 (iPad; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/ 12F69 Safari/600.1.4"},
206 {title: "Firefox 46 \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Int el Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"}, 207 {title: "Firefox \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0"},
207 {title: "Firefox 46 \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0"} 208 {title: "Firefox \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10 .0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0"}
208 ] 209 ]
209 }, 210 },
210 { 211 {
211 title: "Googlebot", 212 title: "Googlebot",
212 values: [ 213 values: [
213 {title: "Googlebot", value: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"}, 214 {title: "Googlebot", value: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"},
214 {title: "Googlebot Smartphone", value: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0 .2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com /bot.html)"} 215 {title: "Googlebot Smartphone", value: "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0 .2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com /bot.html)"}
215 ] 216 ]
216 }, 217 },
217 { 218 {
218 title: "Internet Explorer", 219 title: "Internet Explorer",
219 values: [ 220 values: [
220 {title: "Internet Explorer 11", value: "Mozilla/5.0 (Windows NT 10.0 ; WOW64; Trident/7.0; rv:11.0) like Gecko"}, 221 {title: "Internet Explorer 11", value: "Mozilla/5.0 (Windows NT 10.0 ; WOW64; Trident/7.0; rv:11.0) like Gecko"},
221 {title: "Internet Explorer 10", value: "Mozilla/5.0 (compatible; MSI E 10.0; Windows NT 6.1; WOW64; Trident/6.0)"}, 222 {title: "Internet Explorer 10", value: "Mozilla/5.0 (compatible; MSI E 10.0; Windows NT 6.1; WOW64; Trident/6.0)"},
222 {title: "Internet Explorer 9", value: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"}, 223 {title: "Internet Explorer 9", value: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"},
223 {title: "Internet Explorer 8", value: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"}, 224 {title: "Internet Explorer 8", value: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)"},
224 {title: "Internet Explorer 7", value: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"} 225 {title: "Internet Explorer 7", value: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"}
225 ] 226 ]
226 }, 227 },
227 { 228 {
228 title: "Opera", 229 title: "Opera",
229 values: [ 230 values: [
230 {title: "Opera 37 \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Sa fari/537.36 OPR/37.0.2178.31"}, 231 {title: "Opera \u2014 Mac", value: "Mozilla/5.0 (Macintosh; Intel Ma c OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safar i/537.36 OPR/37.0.2178.31"},
231 {title: "Opera 37 \u2014 Windows", value: "Mozilla/5.0 (Windows NT 1 0.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/53 7.36 OPR/37.0.2178.31"}, 232 {title: "Opera \u2014 Windows", value: "Mozilla/5.0 (Windows NT 10.0 ; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.3 6 OPR/37.0.2178.31"},
232 {title: "Opera 12 \u2014 Mac", value: "Opera/9.80 (Macintosh; Intel Mac OS X 10.9.1) Presto/2.12.388 Version/12.16"}, 233 {title: "Opera (Presto) \u2014 Mac", value: "Opera/9.80 (Macintosh; Intel Mac OS X 10.9.1) Presto/2.12.388 Version/12.16"},
233 {title: "Opera 12 \u2014 Windows", value: "Opera/9.80 (Windows NT 6. 1) Presto/2.12.388 Version/12.16"}, 234 {title: "Opera (Presto) \u2014 Windows", value: "Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16"},
234 {title: "Opera Mobile \u2014 Android Mobile", value: "Opera/12.02 (A ndroid 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/1 2.02"}, 235 {title: "Opera Mobile \u2014 Android Mobile", value: "Opera/12.02 (A ndroid 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/1 2.02"},
235 {title: "Opera Mini \u2014 iOS", value: "Opera/9.80 (iPhone; Opera M ini/8.0.0/34.2336; U; en) Presto/2.8.119 Version/11.10"} 236 {title: "Opera Mini \u2014 iOS", value: "Opera/9.80 (iPhone; Opera M ini/8.0.0/34.2336; U; en) Presto/2.8.119 Version/11.10"}
236 ] 237 ]
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