Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: chrome/browser/resources/options/managed_user_settings.js

Issue 12594029: Create interface to manage manual exceptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Canonical form Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 = $('manual-exceptions');
Bernhard Bauer 2013/04/02 11:08:36 I think you could inline this now.
Sergiu 2013/04/02 14:55:38 Done.
203 exceptionsList.setManualExceptions(list);
204 };
205
206 /**
207 * The browser's response to a request to check the validity of a given URL
208 * pattern.
209 * @param {string} mode The browser mode.
210 * @param {string} pattern The pattern.
211 * @param {bool} valid Whether said pattern is valid in the context of
212 * a content exception setting.
213 */
214 ManagedUserSettings.patternValidityCheckComplete =
215 function(pattern, valid) {
216 var exceptionsList = $('manual-exceptions');
217 exceptionsList.patternValidityCheckComplete(pattern, valid);
218 };
219
181 // Export 220 // Export
182 return { 221 return {
183 ManagedUserSettings: ManagedUserSettings, 222 ManagedUserSettings: ManagedUserSettings,
184 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting, 223 ManagedUserSettingsForTesting: ManagedUserSettingsForTesting,
185 ManagedUserAuthentication: ManagedUserAuthentication 224 ManagedUserAuthentication: ManagedUserAuthentication
186 }; 225 };
187 }); 226 });
188 227
189 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698