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 if (loadTimeData.getBoolean('managedUsersEnabled')) { | 5 if (loadTimeData.getBoolean('managedUsersEnabled')) { |
6 | 6 |
7 cr.define('options', function() { | 7 cr.define('options', function() { |
8 /** @const */ var OptionsPage = options.OptionsPage; | 8 /** @const */ var OptionsPage = options.OptionsPage; |
9 /** @const */ var SettingsDialog = options.SettingsDialog; | 9 /** @const */ var SettingsDialog = options.SettingsDialog; |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 isPassphraseSet: false, | 52 isPassphraseSet: false, |
53 | 53 |
54 /** | 54 /** |
55 * Initialize the page. | 55 * Initialize the page. |
56 * @override | 56 * @override |
57 */ | 57 */ |
58 initializePage: function() { | 58 initializePage: function() { |
59 // Call base class implementation to start preference initialization. | 59 // Call base class implementation to start preference initialization. |
60 SettingsDialog.prototype.initializePage.call(this); | 60 SettingsDialog.prototype.initializePage.call(this); |
61 | 61 |
| 62 var exceptionsButtons = |
| 63 this.pageDiv.querySelectorAll('.exceptions-list-button'); |
| 64 exceptionsButtons[0].onclick = function(event) { |
| 65 var page = ManagedUserSettingsExceptionsArea.getInstance(); |
| 66 var url = page.name; |
| 67 window.history.replaceState({pageName: page.name}, |
| 68 page.title, |
| 69 '/' + url); |
| 70 |
| 71 OptionsPage.navigateToPage('manualExceptions'); |
| 72 uber.invokeMethodOnParent('setPath', {path: url}); |
| 73 uber.invokeMethodOnParent('setTitle', |
| 74 {title: loadTimeData.getString('manualExceptionsTabTitle')}); |
| 75 }; |
| 76 |
62 $('get-content-packs-button').onclick = function(event) { | 77 $('get-content-packs-button').onclick = function(event) { |
63 window.open(loadTimeData.getString('getContentPacksURL')); | 78 window.open(loadTimeData.getString('getContentPacksURL')); |
64 }; | 79 }; |
65 | 80 |
66 $('set-passphrase').onclick = function() { | 81 $('set-passphrase').onclick = function() { |
67 OptionsPage.navigateToPage('setPassphrase'); | 82 OptionsPage.navigateToPage('setPassphrase'); |
68 }; | 83 }; |
69 | 84 |
70 $('use-passphrase-checkbox').onclick = function() { | 85 $('use-passphrase-checkbox').onclick = function() { |
71 $('set-passphrase').disabled = !$('use-passphrase-checkbox').checked; | 86 $('set-passphrase').disabled = !$('use-passphrase-checkbox').checked; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 186 |
172 var ManagedUserSettingsForTesting = { | 187 var ManagedUserSettingsForTesting = { |
173 getSetPassphraseButton: function() { | 188 getSetPassphraseButton: function() { |
174 return $('set-passphrase'); | 189 return $('set-passphrase'); |
175 }, | 190 }, |
176 getUnlockButton: function() { | 191 getUnlockButton: function() { |
177 return $('unlock-settings'); | 192 return $('unlock-settings'); |
178 } | 193 } |
179 }; | 194 }; |
180 | 195 |
| 196 /** |
| 197 * Initializes an exceptions list. |
| 198 * @param {Array} list An array of pairs, where the first element of each pair |
| 199 * is the filter string, and the second is the setting (allow/block). |
| 200 */ |
| 201 ManagedUserSettings.setManualExceptions = function(list) { |
| 202 var exceptionsList = |
| 203 document.querySelector('div#manual-exceptions list'); |
| 204 exceptionsList.setManualExceptions(list); |
| 205 }; |
| 206 |
| 207 /** |
| 208 * The browser's response to a request to check the validity of a given URL |
| 209 * pattern. |
| 210 * @param {string} mode The browser mode. |
| 211 * @param {string} pattern The pattern. |
| 212 * @param {bool} valid Whether said pattern is valid in the context of |
| 213 * a content exception setting. |
| 214 */ |
| 215 ManagedUserSettings.patternValidityCheckComplete = |
| 216 function(pattern, valid) { |
| 217 var exceptionsList = |
| 218 document.querySelector('div#manual-exceptions list'); |
| 219 exceptionsList.patternValidityCheckComplete(pattern, valid); |
| 220 }; |
| 221 |
181 // Export | 222 // Export |
182 return { | 223 return { |
183 ManagedUserSettings: ManagedUserSettings, | 224 ManagedUserSettings: ManagedUserSettings, |
184 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, | 225 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, |
185 ManagedUserAuthentication: ManagedUserAuthentication | 226 ManagedUserAuthentication: ManagedUserAuthentication |
186 }; | 227 }; |
187 }); | 228 }); |
188 | 229 |
189 } | 230 } |
OLD | NEW |