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 DeletableItemList = options.DeletableItemList; | 6 const DeletableItemList = options.DeletableItemList; |
7 const DeletableItem = options.DeletableItem; | 7 const DeletableItem = options.DeletableItem; |
8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
561 | 561 |
562 initializePage: function() { | 562 initializePage: function() { |
563 OptionsPage.prototype.initializePage.call(this); | 563 OptionsPage.prototype.initializePage.call(this); |
564 | 564 |
565 var exceptionsLists = this.pageDiv.querySelectorAll('list'); | 565 var exceptionsLists = this.pageDiv.querySelectorAll('list'); |
566 for (var i = 0; i < exceptionsLists.length; i++) { | 566 for (var i = 0; i < exceptionsLists.length; i++) { |
567 options.contentSettings.ExceptionsList.decorate(exceptionsLists[i]); | 567 options.contentSettings.ExceptionsList.decorate(exceptionsLists[i]); |
568 } | 568 } |
569 | 569 |
570 ContentSettingsExceptionsArea.hideOTRLists(); | 570 ContentSettingsExceptionsArea.hideOTRLists(); |
571 this.showList('cookies'); | |
571 }, | 572 }, |
572 | 573 |
573 /** | 574 /** |
574 * Shows one list and hides all others. | 575 * Shows one list and hides all others. |
575 * @param {string} type The content type. | 576 * @param {string} type The content type. |
576 */ | 577 */ |
577 showList: function(type) { | 578 showList: function(type) { |
578 var header = this.pageDiv.querySelector('h1'); | 579 var header = this.pageDiv.querySelector('h1'); |
579 header.textContent = templateData[type + '_header']; | 580 header.textContent = templateData[type + '_header']; |
580 | 581 |
581 var divs = this.pageDiv.querySelectorAll('div[contentType]'); | 582 var divs = this.pageDiv.querySelectorAll('div[contentType]'); |
582 for (var i = 0; i < divs.length; i++) { | 583 for (var i = 0; i < divs.length; i++) { |
583 if (divs[i].getAttribute('contentType') == type) | 584 if (divs[i].getAttribute('contentType') == type) |
584 divs[i].classList.remove('hidden'); | 585 divs[i].classList.remove('hidden'); |
585 else | 586 else |
586 divs[i].classList.add('hidden'); | 587 divs[i].classList.add('hidden'); |
587 } | 588 } |
588 }, | 589 }, |
590 | |
591 /** | |
592 * Handles a hash value in the URL (such as bar in | |
593 * chrome://options/foo#bar). | |
594 * @param {string} hash The hash value. | |
595 */ | |
596 handleHash: function(hash) { | |
sky
2011/01/31 20:36:25
Or this.
| |
597 this.showList(hash); | |
598 }, | |
589 }; | 599 }; |
590 | 600 |
591 /** | 601 /** |
592 * Called when the last incognito window is closed. | 602 * Called when the last incognito window is closed. |
593 */ | 603 */ |
594 ContentSettingsExceptionsArea.OTRProfileDestroyed = function() { | 604 ContentSettingsExceptionsArea.OTRProfileDestroyed = function() { |
595 this.hideOTRLists(); | 605 this.hideOTRLists(); |
596 }; | 606 }; |
597 | 607 |
598 /** | 608 /** |
599 * Clears and hides the incognito exceptions lists. | 609 * Clears and hides the incognito exceptions lists. |
600 */ | 610 */ |
601 ContentSettingsExceptionsArea.hideOTRLists = function() { | 611 ContentSettingsExceptionsArea.hideOTRLists = function() { |
602 var otrLists = document.querySelectorAll('list[mode=otr]'); | 612 var otrLists = document.querySelectorAll('list[mode=otr]'); |
603 | 613 |
604 for (var i = 0; i < otrLists.length; i++) { | 614 for (var i = 0; i < otrLists.length; i++) { |
605 otrLists[i].reset(); | 615 otrLists[i].reset(); |
606 otrLists[i].parentNode.classList.add('hidden'); | 616 otrLists[i].parentNode.classList.add('hidden'); |
607 } | 617 } |
608 }; | 618 }; |
609 | 619 |
610 return { | 620 return { |
611 ExceptionsListItem: ExceptionsListItem, | 621 ExceptionsListItem: ExceptionsListItem, |
612 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 622 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
613 ExceptionsList: ExceptionsList, | 623 ExceptionsList: ExceptionsList, |
614 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 624 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
615 }; | 625 }; |
616 }); | 626 }); |
OLD | NEW |