Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 = userAgentVersion.value; |
| 106 | |
| 107 if (userAgentDescriptor.title === "Chrome") | |
| 108 userAgentValue = WebInspector.BrowserVersionInfo.patchUserAgentW ithChromeVersion(userAgentValue); | |
|
pfeldman
2016/09/14 21:47:10
You can unconditionally do that.
luoe
2016/09/14 22:49:13
Done.
| |
| 109 groupElement.appendChild(new Option(userAgentVersion.title, userAgen tValue)); | |
| 110 } | |
| 106 } | 111 } |
| 107 | 112 |
| 108 userAgentSelectElement.selectedIndex = 0; | 113 userAgentSelectElement.selectedIndex = 0; |
| 109 | 114 |
| 110 var otherUserAgentElement = createElement("input"); | 115 var otherUserAgentElement = createElement("input"); |
| 111 otherUserAgentElement.type = "text"; | 116 otherUserAgentElement.type = "text"; |
| 112 otherUserAgentElement.value = userAgentSetting.get(); | 117 otherUserAgentElement.value = userAgentSetting.get(); |
| 113 otherUserAgentElement.title = userAgentSetting.get(); | 118 otherUserAgentElement.title = userAgentSetting.get(); |
| 114 otherUserAgentElement.placeholder = WebInspector.UIString("Enter a custom us er agent"); | 119 otherUserAgentElement.placeholder = WebInspector.UIString("Enter a custom us er agent"); |
| 115 otherUserAgentElement.required = true; | 120 otherUserAgentElement.required = true; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 if (userAgentSetting.get() !== otherUserAgentElement.value) { | 157 if (userAgentSetting.get() !== otherUserAgentElement.value) { |
| 153 userAgentSetting.set(otherUserAgentElement.value); | 158 userAgentSetting.set(otherUserAgentElement.value); |
| 154 otherUserAgentElement.title = otherUserAgentElement.value; | 159 otherUserAgentElement.title = otherUserAgentElement.value; |
| 155 settingChanged(); | 160 settingChanged(); |
| 156 } | 161 } |
| 157 } | 162 } |
| 158 | 163 |
| 159 return { select: userAgentSelectElement, input: otherUserAgentElement }; | 164 return { select: userAgentSelectElement, input: otherUserAgentElement }; |
| 160 } | 165 } |
| 161 | 166 |
| 162 | |
| 163 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string }>}>} */ | 167 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string }>}>} */ |
| 164 WebInspector.NetworkConfigView._userAgentGroups = [ | 168 WebInspector.NetworkConfigView._userAgentGroups = [ |
| 165 { | 169 { |
| 166 title: "Android", | 170 title: "Android", |
| 167 values: [ | 171 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"}, | 172 {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"} | 173 {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 ] | 174 ] |
| 171 }, | 175 }, |
| 172 { | 176 { |
| 173 title: "BlackBerry", | 177 title: "BlackBerry", |
| 174 values: [ | 178 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+" }, | 179 {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+"}, | 180 {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+"} | 181 {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 ] | 182 ] |
| 179 }, | 183 }, |
| 180 { | 184 { |
| 181 title: "Chrome", | 185 title: "Chrome", |
| 182 values: [ | 186 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"}, | 187 {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"}, | 188 {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"}, | 189 {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"}, | 190 {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"}, | 191 {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"} | 192 {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 ] | 193 ] |
| 190 }, | 194 }, |
| 191 { | 195 { |
| 192 title: "Edge", | 196 title: "Edge", |
| 193 values: [ | 197 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"}, | 198 {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"}, | 199 {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"} | 200 {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 ] | 201 ] |
| 198 }, | 202 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 }, | 241 }, |
| 238 { | 242 { |
| 239 title: "Safari", | 243 title: "Safari", |
| 240 values: [ | 244 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"}, | 245 {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"}, | 246 {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"} | 247 {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 ] | 248 ] |
| 245 } | 249 } |
| 246 ] | 250 ] |
| OLD | NEW |