| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 otherUserAgentElement.addEventListener("keyup", textChanged, false); | 119 otherUserAgentElement.addEventListener("keyup", textChanged, false); |
| 120 | 120 |
| 121 function userAgentSelected() | 121 function userAgentSelected() |
| 122 { | 122 { |
| 123 var value = userAgentSelectElement.options[userAgentSelectElement.select
edIndex].value; | 123 var value = userAgentSelectElement.options[userAgentSelectElement.select
edIndex].value; |
| 124 if (value !== customOverride.value) { | 124 if (value !== customOverride.value) { |
| 125 userAgentSetting.set(value); | 125 userAgentSetting.set(value); |
| 126 otherUserAgentElement.value = value; | 126 otherUserAgentElement.value = value; |
| 127 otherUserAgentElement.title = value; | 127 otherUserAgentElement.title = value; |
| 128 } else { | 128 } else { |
| 129 otherUserAgentElement.focus(); | 129 otherUserAgentElement.select(); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 function settingChanged() | 133 function settingChanged() |
| 134 { | 134 { |
| 135 var value = userAgentSetting.get(); | 135 var value = userAgentSetting.get(); |
| 136 var options = userAgentSelectElement.options; | 136 var options = userAgentSelectElement.options; |
| 137 var selectionRestored = false; | 137 var selectionRestored = false; |
| 138 for (var i = 0; i < options.length; ++i) { | 138 for (var i = 0; i < options.length; ++i) { |
| 139 if (options[i].value === value) { | 139 if (options[i].value === value) { |
| 140 userAgentSelectElement.selectedIndex = i; | 140 userAgentSelectElement.selectedIndex = i; |
| 141 selectionRestored = true; | 141 selectionRestored = true; |
| 142 break; | 142 break; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (!selectionRestored) | 146 if (!selectionRestored) |
| 147 userAgentSelectElement.selectedIndex = 0; | 147 userAgentSelectElement.selectedIndex = 0; |
| 148 | |
| 149 if (otherUserAgentElement.value !== value) { | |
| 150 otherUserAgentElement.value = value; | |
| 151 otherUserAgentElement.title = value; | |
| 152 } | |
| 153 } | 148 } |
| 154 | 149 |
| 155 function textChanged() | 150 function textChanged() |
| 156 { | 151 { |
| 157 if (userAgentSetting.get() !== otherUserAgentElement.value) { | 152 if (userAgentSetting.get() !== otherUserAgentElement.value) { |
| 158 userAgentSetting.set(otherUserAgentElement.value); | 153 userAgentSetting.set(otherUserAgentElement.value); |
| 154 otherUserAgentElement.title = otherUserAgentElement.value; |
| 159 settingChanged(); | 155 settingChanged(); |
| 160 } | 156 } |
| 161 } | 157 } |
| 162 | 158 |
| 163 return { select: userAgentSelectElement, input: otherUserAgentElement }; | 159 return { select: userAgentSelectElement, input: otherUserAgentElement }; |
| 164 } | 160 } |
| 165 | 161 |
| 166 | 162 |
| 167 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string
}>}>} */ | 163 /** @type {!Array.<{title: string, values: !Array.<{title: string, value: string
}>}>} */ |
| 168 WebInspector.NetworkConfigView._userAgentGroups = [ | 164 WebInspector.NetworkConfigView._userAgentGroups = [ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 * @param {!WebInspector.Context} context | 259 * @param {!WebInspector.Context} context |
| 264 * @param {string} actionId | 260 * @param {string} actionId |
| 265 * @return {boolean} | 261 * @return {boolean} |
| 266 */ | 262 */ |
| 267 handleAction: function(context, actionId) | 263 handleAction: function(context, actionId) |
| 268 { | 264 { |
| 269 WebInspector.inspectorView.showViewInDrawer("network.config"); | 265 WebInspector.inspectorView.showViewInDrawer("network.config"); |
| 270 return true; | 266 return true; |
| 271 } | 267 } |
| 272 } | 268 } |
| OLD | NEW |