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

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

Issue 6099016: Drastically reduce the number of redraws when editing content settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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) 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * @param {string} type The content type that we are setting exceptions for. 92 * @param {string} type The content type that we are setting exceptions for.
93 * @param {Array} list An array of pairs, where the first element of each pair 93 * @param {Array} list An array of pairs, where the first element of each pair
94 * is the filter string, and the second is the setting (allow/block). 94 * is the filter string, and the second is the setting (allow/block).
95 */ 95 */
96 ContentSettings.setExceptions = function(type, list) { 96 ContentSettings.setExceptions = function(type, list) {
97 var exceptionsList = 97 var exceptionsList =
98 document.querySelector('div[contentType=' + type + ']' + 98 document.querySelector('div[contentType=' + type + ']' +
99 ' list[mode=normal]'); 99 ' list[mode=normal]');
100 100
101 exceptionsList.reset(); 101 exceptionsList.reset();
102 for (var i = 0; i < list.length; i++) { 102 exceptionsList.addExceptions(list);
arv (Not doing code reviews) 2011/01/12 00:42:32 You could also have used startBatchUpdates() and e
103 exceptionsList.addException(list[i]);
104 }
105 exceptionsList.redraw();
106 }; 103 };
107 104
108 ContentSettings.setOTRExceptions = function(type, list) { 105 ContentSettings.setOTRExceptions = function(type, list) {
109 var exceptionsList = 106 var exceptionsList =
110 document.querySelector('div[contentType=' + type + ']' + 107 document.querySelector('div[contentType=' + type + ']' +
111 ' list[mode=otr]'); 108 ' list[mode=otr]');
112 109
113 exceptionsList.parentNode.classList.remove('hidden'); 110 exceptionsList.parentNode.classList.remove('hidden');
114 111
115 exceptionsList.reset(); 112 exceptionsList.reset();
116 for (var i = 0; i < list.length; i++) { 113 exceptionsList.addExceptions(list);
117 exceptionsList.addException(list[i]);
118 }
119 exceptionsList.redraw();
120 }; 114 };
121 115
122 /** 116 /**
123 * Sets the initial value for the Third Party Cookies checkbox. 117 * Sets the initial value for the Third Party Cookies checkbox.
124 * @param {boolean=} block True if we are blocking third party cookies. 118 * @param {boolean=} block True if we are blocking third party cookies.
125 */ 119 */
126 ContentSettings.setBlockThirdPartyCookies = function(block) { 120 ContentSettings.setBlockThirdPartyCookies = function(block) {
127 $('block-third-party-cookies').checked = block; 121 $('block-third-party-cookies').checked = block;
128 }; 122 };
129 123
(...skipping 13 matching lines...) Expand all
143 'list[mode=' + mode + ']'); 137 'list[mode=' + mode + ']');
144 exceptionsList.patternValidityCheckComplete(pattern, valid); 138 exceptionsList.patternValidityCheckComplete(pattern, valid);
145 }; 139 };
146 140
147 // Export 141 // Export
148 return { 142 return {
149 ContentSettings: ContentSettings 143 ContentSettings: ContentSettings
150 }; 144 };
151 145
152 }); 146 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698