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

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

Issue 6285003: DOMUI: Use dispatchSimpleEvent instead of programatically clicking the checkbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix. 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/pref_ui.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // State variables. 9 // State variables.
10 var syncEnabled = false; 10 var syncEnabled = false;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 }, 93 },
94 94
95 /** 95 /**
96 * Updates the sync datatype checkboxes based on the selected sync option. 96 * Updates the sync datatype checkboxes based on the selected sync option.
97 * @private 97 * @private
98 */ 98 */
99 updateSyncSelection_: function() { 99 updateSyncSelection_: function() {
100 var idx = $('sync-select').selectedIndex; 100 var idx = $('sync-select').selectedIndex;
101 var syncCheckboxes = $('sync-table').getElementsByTagName('input'); 101 var syncCheckboxes = $('sync-table').getElementsByTagName('input');
102 if (idx == 0) { 102 if (idx == 0) {
103 // 'Choose what to sync.'
103 for (var i = 0; i < syncCheckboxes.length; i++) { 104 for (var i = 0; i < syncCheckboxes.length; i++) {
104 syncCheckboxes[i].disabled = false; 105 syncCheckboxes[i].disabled = false;
105 } 106 }
106 } else if (idx == 1) { 107 } else if (idx == 1) {
108 // 'Everything' is synced.
107 for (var i = 0; i < syncCheckboxes.length; i++) { 109 for (var i = 0; i < syncCheckboxes.length; i++) {
108 // Merely setting checked = true is not enough to trigger the pref 110 if (!syncCheckboxes[i].checked) {
109 // being set; thus, we simulate the click. 111 syncCheckboxes[i].checked = true;
110 if (!syncCheckboxes[i].checked) 112
111 syncCheckboxes[i].click(); 113 // Merely setting checked = true is not enough to trigger the pref
114 // being set; thus, we dispatch a change event to notify
115 // PrefCheckbox |checked| has changed.
116 cr.dispatchSimpleEvent(syncCheckboxes[i], 'change');
arv (Not doing code reviews) 2011/01/21 23:57:29 This seems backwards. We should not dispatch fake
117 }
112 118
113 syncCheckboxes[i].disabled = true; 119 syncCheckboxes[i].disabled = true;
114 } 120 }
115 } 121 }
116 }, 122 },
117 123
118 showStopSyncingOverlay_: function(event) { 124 showStopSyncingOverlay_: function(event) {
119 AlertOverlay.show(localStrings.getString('stop_syncing_title'), 125 AlertOverlay.show(localStrings.getString('stop_syncing_title'),
120 localStrings.getString('stop_syncing_explanation'), 126 localStrings.getString('stop_syncing_explanation'),
121 localStrings.getString('stop_syncing_confirm'), 127 localStrings.getString('stop_syncing_confirm'),
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 PersonalOptions.getInstance()[name + '_'](value); 244 PersonalOptions.getInstance()[name + '_'](value);
239 }; 245 };
240 }); 246 });
241 247
242 // Export 248 // Export
243 return { 249 return {
244 PersonalOptions: PersonalOptions 250 PersonalOptions: PersonalOptions
245 }; 251 };
246 252
247 }); 253 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/pref_ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698