OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 WebInspector.HandlerRegistry.EventTypes = { | 203 WebInspector.HandlerRegistry.EventTypes = { |
204 HandlersUpdated: "HandlersUpdated" | 204 HandlersUpdated: "HandlersUpdated" |
205 } | 205 } |
206 | 206 |
207 /** | 207 /** |
208 * @constructor | 208 * @constructor |
209 */ | 209 */ |
210 WebInspector.HandlerSelector = function(handlerRegistry) | 210 WebInspector.HandlerSelector = function(handlerRegistry) |
211 { | 211 { |
212 this._handlerRegistry = handlerRegistry; | 212 this._handlerRegistry = handlerRegistry; |
213 this.element = document.createElementWithClass("select", "chrome-select"); | 213 this.element = createElementWithClass("select", "chrome-select"); |
214 this.element.addEventListener("change", this._onChange.bind(this), false); | 214 this.element.addEventListener("change", this._onChange.bind(this), false); |
215 this._update(); | 215 this._update(); |
216 this._handlerRegistry.addEventListener(WebInspector.HandlerRegistry.EventTyp
es.HandlersUpdated, this._update.bind(this)); | 216 this._handlerRegistry.addEventListener(WebInspector.HandlerRegistry.EventTyp
es.HandlersUpdated, this._update.bind(this)); |
217 } | 217 } |
218 | 218 |
219 WebInspector.HandlerSelector.prototype = | 219 WebInspector.HandlerSelector.prototype = |
220 { | 220 { |
221 _update: function() | 221 _update: function() |
222 { | 222 { |
223 this.element.removeChildren(); | 223 this.element.removeChildren(); |
224 var names = this._handlerRegistry.handlerNames; | 224 var names = this._handlerRegistry.handlerNames; |
225 var activeHandler = this._handlerRegistry.activeHandler; | 225 var activeHandler = this._handlerRegistry.activeHandler; |
226 | 226 |
227 for (var i = 0; i < names.length; ++i) { | 227 for (var i = 0; i < names.length; ++i) { |
228 var option = document.createElement("option"); | 228 var option = createElement("option"); |
229 option.textContent = names[i]; | 229 option.textContent = names[i]; |
230 option.selected = activeHandler === names[i]; | 230 option.selected = activeHandler === names[i]; |
231 this.element.appendChild(option); | 231 this.element.appendChild(option); |
232 } | 232 } |
233 this.element.disabled = names.length <= 1; | 233 this.element.disabled = names.length <= 1; |
234 }, | 234 }, |
235 | 235 |
236 _onChange: function(event) | 236 _onChange: function(event) |
237 { | 237 { |
238 var value = event.target.value; | 238 var value = event.target.value; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 return WebInspector.SettingsUI.createCustomSetting(WebInspector.UIString
("Open links in"), handlerSelector.element); | 304 return WebInspector.SettingsUI.createCustomSetting(WebInspector.UIString
("Open links in"), handlerSelector.element); |
305 }, | 305 }, |
306 | 306 |
307 __proto__: WebInspector.UISettingDelegate.prototype | 307 __proto__: WebInspector.UISettingDelegate.prototype |
308 } | 308 } |
309 | 309 |
310 /** | 310 /** |
311 * @type {!WebInspector.HandlerRegistry} | 311 * @type {!WebInspector.HandlerRegistry} |
312 */ | 312 */ |
313 WebInspector.openAnchorLocationRegistry; | 313 WebInspector.openAnchorLocationRegistry; |
OLD | NEW |