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) { | |
James Hawkins
2013/04/02 15:57:33
This seems fragile; why are we only adding onclick
Sergiu
2013/04/02 17:14:09
Yeah, that wasn't exactly right since there is onl
| |
65 var page = ManagedUserSettingsExceptionsArea.getInstance(); | |
66 var url = page.name; | |
67 window.history.replaceState({pageName: page.name}, | |
James Hawkins
2013/04/02 15:57:33
What's with this replaceState?
Sergiu
2013/04/02 17:14:09
I thought this was needed by looking at the conten
| |
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 $('manual-exceptions').setManualExceptions(list); | |
203 }; | |
204 | |
205 /** | |
206 * The browser's response to a request to check the validity of a given URL | |
207 * pattern. | |
208 * @param {string} mode The browser mode. | |
209 * @param {string} pattern The pattern. | |
210 * @param {bool} valid Whether said pattern is valid in the context of | |
211 * a content exception setting. | |
212 */ | |
213 ManagedUserSettings.patternValidityCheckComplete = | |
214 function(pattern, valid) { | |
215 $('manual-exceptions').patternValidityCheckComplete(pattern, valid); | |
216 }; | |
217 | |
181 // Export | 218 // Export |
182 return { | 219 return { |
183 ManagedUserSettings: ManagedUserSettings, | 220 ManagedUserSettings: ManagedUserSettings, |
184 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, | 221 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, |
185 ManagedUserAuthentication: ManagedUserAuthentication | 222 ManagedUserAuthentication: ManagedUserAuthentication |
186 }; | 223 }; |
187 }); | 224 }); |
188 | 225 |
189 } | 226 } |
OLD | NEW |