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', 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 var manageHandlersButton = | 48 var manageHandlersButton = |
49 this.pageDiv.querySelector('#manage-handlers-button'); | 49 this.pageDiv.querySelector('#manage-handlers-button'); |
50 if (manageHandlersButton) { | 50 if (manageHandlersButton) { |
51 manageHandlersButton.onclick = function(event) { | 51 manageHandlersButton.onclick = function(event) { |
52 OptionsPage.navigateToPage('handlers'); | 52 OptionsPage.navigateToPage('handlers'); |
53 }; | 53 }; |
54 } | 54 } |
55 | 55 |
56 // Cookies filter page --------------------------------------------------- | 56 // Cookies filter page --------------------------------------------------- |
57 $('block-third-party-cookies').onclick = function(event) { | |
58 chrome.send('setAllowThirdPartyCookies', | |
59 [String($('block-third-party-cookies').checked)]); | |
60 }; | |
61 | |
62 $('show-cookies-button').onclick = function(event) { | 57 $('show-cookies-button').onclick = function(event) { |
63 chrome.send('coreOptionsUserMetricsAction', ['Options_ShowCookies']); | 58 chrome.send('coreOptionsUserMetricsAction', ['Options_ShowCookies']); |
64 OptionsPage.navigateToPage('cookies'); | 59 OptionsPage.navigateToPage('cookies'); |
65 }; | 60 }; |
66 | 61 |
67 if (!templateData.enable_click_to_play) | 62 if (!templateData.enable_click_to_play) |
68 $('click_to_play').style.display = 'none'; | 63 $('click_to_play').style.display = 'none'; |
69 }, | 64 }, |
70 }; | 65 }; |
71 | 66 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 ContentSettings.setOTRExceptions = function(type, list) { | 109 ContentSettings.setOTRExceptions = function(type, list) { |
115 var exceptionsList = | 110 var exceptionsList = |
116 document.querySelector('div[contentType=' + type + ']' + | 111 document.querySelector('div[contentType=' + type + ']' + |
117 ' list[mode=otr]'); | 112 ' list[mode=otr]'); |
118 | 113 |
119 exceptionsList.parentNode.hidden = false; | 114 exceptionsList.parentNode.hidden = false; |
120 exceptionsList.setExceptions(list); | 115 exceptionsList.setExceptions(list); |
121 }; | 116 }; |
122 | 117 |
123 /** | 118 /** |
124 * Sets the initial value for the Third Party Cookies checkbox. | |
125 * @param {boolean=} block True if we are blocking third party cookies. | |
126 */ | |
127 ContentSettings.setBlockThirdPartyCookies = function(block) { | |
128 $('block-third-party-cookies').checked = block; | |
129 }; | |
130 | |
131 /** | |
132 * The browser's response to a request to check the validity of a given URL | 119 * The browser's response to a request to check the validity of a given URL |
133 * pattern. | 120 * pattern. |
134 * @param {string} type The content type. | 121 * @param {string} type The content type. |
135 * @param {string} mode The browser mode. | 122 * @param {string} mode The browser mode. |
136 * @param {string} pattern The pattern. | 123 * @param {string} pattern The pattern. |
137 * @param {bool} valid Whether said pattern is valid in the context of | 124 * @param {bool} valid Whether said pattern is valid in the context of |
138 * a content exception setting. | 125 * a content exception setting. |
139 */ | 126 */ |
140 ContentSettings.patternValidityCheckComplete = | 127 ContentSettings.patternValidityCheckComplete = |
141 function(type, mode, pattern, valid) { | 128 function(type, mode, pattern, valid) { |
142 var exceptionsList = | 129 var exceptionsList = |
143 document.querySelector('div[contentType=' + type + '] ' + | 130 document.querySelector('div[contentType=' + type + '] ' + |
144 'list[mode=' + mode + ']'); | 131 'list[mode=' + mode + ']'); |
145 exceptionsList.patternValidityCheckComplete(pattern, valid); | 132 exceptionsList.patternValidityCheckComplete(pattern, valid); |
146 }; | 133 }; |
147 | 134 |
148 // Export | 135 // Export |
149 return { | 136 return { |
150 ContentSettings: ContentSettings | 137 ContentSettings: ContentSettings |
151 }; | 138 }; |
152 | 139 |
153 }); | 140 }); |
OLD | NEW |