OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 ////////////////////////////////////////////////////////////////////////////// | 9 ////////////////////////////////////////////////////////////////////////////// |
10 // ContentSettings class: | 10 // ContentSettings class: |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 cr.addSingletonGetter(ContentSettings); | 22 cr.addSingletonGetter(ContentSettings); |
23 | 23 |
24 ContentSettings.prototype = { | 24 ContentSettings.prototype = { |
25 __proto__: OptionsPage.prototype, | 25 __proto__: OptionsPage.prototype, |
26 | 26 |
27 initializePage: function() { | 27 initializePage: function() { |
28 OptionsPage.prototype.initializePage.call(this); | 28 OptionsPage.prototype.initializePage.call(this); |
29 | 29 |
30 chrome.send('getContentFilterSettings'); | 30 chrome.send('getContentFilterSettings'); |
31 this.showTab($('cookies-nav-tab')); | |
32 | |
33 var self = this; | |
34 $('content-settings-nav-tabs').onclick = function(event) { | |
35 self.showTab(event.srcElement); | |
36 }; | |
37 | 31 |
38 // Cookies filter page --------------------------------------------------- | 32 // Cookies filter page --------------------------------------------------- |
39 $('cookies-exceptions-button').onclick = function(event) { | 33 $('cookies-exceptions-button').onclick = function(event) { |
40 // TODO(estade): show exceptions page. | 34 // TODO(estade): show exceptions page. |
41 }; | 35 }; |
42 | 36 |
43 $('block-third-party-cookies').onclick = function(event) { | 37 $('block-third-party-cookies').onclick = function(event) { |
44 chrome.send('setAllowThirdPartyCookies', | 38 chrome.send('setAllowThirdPartyCookies', |
45 [String($('block-third-party-cookies').checked)]); | 39 [String($('block-third-party-cookies').checked)]); |
46 }; | 40 }; |
47 | 41 |
48 $('show-cookies-button').onclick = function(event) { | 42 $('show-cookies-button').onclick = function(event) { |
49 // TODO(estade): show cookies and other site data page. | 43 // TODO(estade): show cookies and other site data page. |
50 }; | 44 }; |
51 | 45 |
52 // Images filter page ---------------------------------------------------- | 46 // Images filter page ---------------------------------------------------- |
53 $('images-exceptions-button').onclick = function(event) { | 47 $('images-exceptions-button').onclick = function(event) { |
54 // TODO(estade): show a dialog. | 48 // TODO(estade): show a dialog. |
55 // TODO(estade): remove this hack. | 49 // TODO(estade): remove this hack. |
56 imagesExceptionsList.redraw(); | 50 imagesExceptionsList.redraw(); |
57 }; | 51 }; |
58 | 52 |
59 options.contentSettings.ExceptionsArea.decorate( | 53 options.contentSettings.ExceptionsArea.decorate( |
60 $('imagesExceptionsArea')); | 54 $('imagesExceptionsArea')); |
61 }, | 55 }, |
62 | |
63 /** | |
64 * Shows the tab contents for the given navigation tab. | |
65 * @param {!Element} tab The tab that the user clicked. | |
66 */ | |
67 showTab: function(tab) { | |
68 if (!tab.classList.contains('inactive-tab')) | |
69 return; | |
70 | |
71 if (this.activeNavTab != null) { | |
72 this.activeNavTab.classList.remove('active-tab'); | |
73 $(this.activeNavTab.getAttribute('tab-contents')).classList. | |
74 remove('active-tab-contents'); | |
75 } | |
76 | |
77 tab.classList.add('active-tab'); | |
78 $(tab.getAttribute('tab-contents')).classList.add('active-tab-contents'); | |
79 this.activeNavTab = tab; | |
80 } | |
81 }; | 56 }; |
82 | 57 |
83 /** | 58 /** |
84 * Sets the initial values for all the content settings radios. | 59 * Sets the initial values for all the content settings radios. |
85 * @param {Object} dict A mapping from radio groups to the checked value for | 60 * @param {Object} dict A mapping from radio groups to the checked value for |
86 * that group. | 61 * that group. |
87 */ | 62 */ |
88 ContentSettings.setInitialContentFilterSettingsValue = function(dict) { | 63 ContentSettings.setInitialContentFilterSettingsValue = function(dict) { |
89 for (var group in dict) { | 64 for (var group in dict) { |
90 document.querySelector('input[type=radio][name=' + group + | 65 document.querySelector('input[type=radio][name=' + group + |
(...skipping 21 matching lines...) Expand all Loading... |
112 $('block-third-party-cookies').checked = block; | 87 $('block-third-party-cookies').checked = block; |
113 }; | 88 }; |
114 | 89 |
115 // Export | 90 // Export |
116 return { | 91 return { |
117 ContentSettings: ContentSettings | 92 ContentSettings: ContentSettings |
118 }; | 93 }; |
119 | 94 |
120 }); | 95 }); |
121 | 96 |
OLD | NEW |