OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options.contentSettings', function() { | 5 cr.define('options.contentSettings', function() { |
6 const InlineEditableItemList = options.InlineEditableItemList; | 6 const InlineEditableItemList = options.InlineEditableItemList; |
7 const InlineEditableItem = options.InlineEditableItem; | 7 const InlineEditableItem = options.InlineEditableItem; |
8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 parentNode = parentNode.parentNode) { | 338 parentNode = parentNode.parentNode) { |
339 if (parentNode.hasAttribute('contentType')) { | 339 if (parentNode.hasAttribute('contentType')) { |
340 this.contentType = parentNode.getAttribute('contentType'); | 340 this.contentType = parentNode.getAttribute('contentType'); |
341 break; | 341 break; |
342 } | 342 } |
343 } | 343 } |
344 | 344 |
345 this.mode = this.getAttribute('mode'); | 345 this.mode = this.getAttribute('mode'); |
346 | 346 |
347 var exceptionList = this; | 347 var exceptionList = this; |
348 function handleBlur(e) { | |
349 // When the blur event happens we do not know who is getting focus so we | |
350 // delay this a bit until we know if the new focus node is outside the | |
351 // list. | |
352 var doc = e.target.ownerDocument; | |
353 window.setTimeout(function() { | |
354 var activeElement = doc.activeElement; | |
355 if (!exceptionList.contains(activeElement)) | |
356 exceptionList.selectionModel.unselectAll(); | |
357 }, 50); | |
358 } | |
359 | |
360 this.addEventListener('blur', handleBlur, true); | |
361 | 348 |
362 // Whether the exceptions in this list allow an 'Ask every time' option. | 349 // Whether the exceptions in this list allow an 'Ask every time' option. |
363 this.enableAskOption = (this.contentType == 'plugins' && | 350 this.enableAskOption = (this.contentType == 'plugins' && |
364 templateData.enable_click_to_play); | 351 templateData.enable_click_to_play); |
365 | 352 |
366 this.autoExpands = true; | 353 this.autoExpands = true; |
367 this.reset(); | 354 this.reset(); |
368 }, | 355 }, |
369 | 356 |
370 /** | 357 /** |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 528 } |
542 }; | 529 }; |
543 | 530 |
544 return { | 531 return { |
545 ExceptionsListItem: ExceptionsListItem, | 532 ExceptionsListItem: ExceptionsListItem, |
546 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 533 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
547 ExceptionsList: ExceptionsList, | 534 ExceptionsList: ExceptionsList, |
548 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 535 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
549 }; | 536 }; |
550 }); | 537 }); |
OLD | NEW |