| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 */ var InlineEditableItemList = options.InlineEditableItemList; | 6 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 __proto__: OptionsPage.prototype, | 515 __proto__: OptionsPage.prototype, |
| 516 | 516 |
| 517 initializePage: function() { | 517 initializePage: function() { |
| 518 OptionsPage.prototype.initializePage.call(this); | 518 OptionsPage.prototype.initializePage.call(this); |
| 519 | 519 |
| 520 var exceptionsLists = this.pageDiv.querySelectorAll('list'); | 520 var exceptionsLists = this.pageDiv.querySelectorAll('list'); |
| 521 for (var i = 0; i < exceptionsLists.length; i++) { | 521 for (var i = 0; i < exceptionsLists.length; i++) { |
| 522 options.contentSettings.ExceptionsList.decorate(exceptionsLists[i]); | 522 options.contentSettings.ExceptionsList.decorate(exceptionsLists[i]); |
| 523 } | 523 } |
| 524 | 524 |
| 525 ContentSettingsExceptionsArea.hideOTRLists(); | 525 ContentSettingsExceptionsArea.hideOTRLists(false); |
| 526 | 526 |
| 527 // If the user types in the URL without a hash, show just cookies. | 527 // If the user types in the URL without a hash, show just cookies. |
| 528 this.showList('cookies'); | 528 this.showList('cookies'); |
| 529 | 529 |
| 530 $('content-settings-exceptions-overlay-confirm').onclick = | 530 $('content-settings-exceptions-overlay-confirm').onclick = |
| 531 OptionsPage.closeOverlay.bind(OptionsPage); | 531 OptionsPage.closeOverlay.bind(OptionsPage); |
| 532 }, | 532 }, |
| 533 | 533 |
| 534 /** | 534 /** |
| 535 * Shows one list and hides all others. | 535 * Shows one list and hides all others. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 557 var hash = location.hash; | 557 var hash = location.hash; |
| 558 if (hash) | 558 if (hash) |
| 559 this.showList(hash.slice(1)); | 559 this.showList(hash.slice(1)); |
| 560 }, | 560 }, |
| 561 }; | 561 }; |
| 562 | 562 |
| 563 /** | 563 /** |
| 564 * Called when the last incognito window is closed. | 564 * Called when the last incognito window is closed. |
| 565 */ | 565 */ |
| 566 ContentSettingsExceptionsArea.OTRProfileDestroyed = function() { | 566 ContentSettingsExceptionsArea.OTRProfileDestroyed = function() { |
| 567 this.hideOTRLists(); | 567 this.hideOTRLists(true); |
| 568 }; | 568 }; |
| 569 | 569 |
| 570 /** | 570 /** |
| 571 * Clears and hides the incognito exceptions lists. | 571 * Hides the incognito exceptions lists and optionally clears them as well. |
| 572 * @param {boolean} clear Whether to clear the lists. |
| 572 */ | 573 */ |
| 573 ContentSettingsExceptionsArea.hideOTRLists = function() { | 574 ContentSettingsExceptionsArea.hideOTRLists = function(clear) { |
| 574 var otrLists = document.querySelectorAll('list[mode=otr]'); | 575 var otrLists = document.querySelectorAll('list[mode=otr]'); |
| 575 | 576 |
| 576 for (var i = 0; i < otrLists.length; i++) { | 577 for (var i = 0; i < otrLists.length; i++) { |
| 577 otrLists[i].reset(); | |
| 578 otrLists[i].parentNode.hidden = true; | 578 otrLists[i].parentNode.hidden = true; |
| 579 if (clear) |
| 580 otrLists[i].reset(); |
| 579 } | 581 } |
| 580 }; | 582 }; |
| 581 | 583 |
| 582 return { | 584 return { |
| 583 ExceptionsListItem: ExceptionsListItem, | 585 ExceptionsListItem: ExceptionsListItem, |
| 584 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 586 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
| 585 ExceptionsList: ExceptionsList, | 587 ExceptionsList: ExceptionsList, |
| 586 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 588 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
| 587 }; | 589 }; |
| 588 }); | 590 }); |
| OLD | NEW |