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

Side by Side Diff: chrome/browser/resources/options2/browser_options.js

Issue 10139019: [webui settings] send user profiles info earlier during load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make return type scoped_ptr Created 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/browser_options_handler2.h » ('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) 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 var ArrayDataModel = cr.ui.ArrayDataModel; 7 var ArrayDataModel = cr.ui.ArrayDataModel;
8 var RepeatingButton = cr.ui.RepeatingButton; 8 var RepeatingButton = cr.ui.RepeatingButton;
9 9
10 // 10 //
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 var self = this; 201 var self = this;
202 Preferences.getInstance().addEventListener( 202 Preferences.getInstance().addEventListener(
203 'profile.clear_site_data_on_exit', 203 'profile.clear_site_data_on_exit',
204 function(event) { 204 function(event) {
205 if (event.value && typeof event.value['value'] != 'undefined') { 205 if (event.value && typeof event.value['value'] != 'undefined') {
206 self.clearCookiesOnExit_ = event.value['value'] == true; 206 self.clearCookiesOnExit_ = event.value['value'] == true;
207 } 207 }
208 }); 208 });
209 209
210 // Users section. 210 // Users section.
211 var profilesList = $('profiles-list'); 211 if (typeof templateData.profilesInfo != 'undefined') {
212 options.browser_options.ProfileList.decorate(profilesList); 212 $('profiles-section').hidden = false;
213 profilesList.autoExpands = true;
214 213
215 profilesList.addEventListener('change', 214 var profilesList = $('profiles-list');
216 this.setProfileViewButtonsStatus_); 215 options.browser_options.ProfileList.decorate(profilesList);
217 $('profiles-create').onclick = function(event) { 216 profilesList.autoExpands = true;
218 chrome.send('createProfile'); 217
219 }; 218 this.setProfilesInfo_(templateData.profilesInfo);
220 $('profiles-manage').onclick = function(event) { 219
221 var selectedProfile = self.getSelectedProfileItem_(); 220 profilesList.addEventListener('change',
222 if (selectedProfile) 221 this.setProfileViewButtonsStatus_);
223 ManageProfileOverlay.showManageDialog(selectedProfile); 222 $('profiles-create').onclick = function(event) {
224 }; 223 chrome.send('createProfile');
225 $('profiles-delete').onclick = function(event) { 224 };
226 var selectedProfile = self.getSelectedProfileItem_(); 225 $('profiles-manage').onclick = function(event) {
227 if (selectedProfile) 226 var selectedProfile = self.getSelectedProfileItem_();
228 ManageProfileOverlay.showDeleteDialog(selectedProfile); 227 if (selectedProfile)
229 }; 228 ManageProfileOverlay.showManageDialog(selectedProfile);
229 };
230 $('profiles-delete').onclick = function(event) {
231 var selectedProfile = self.getSelectedProfileItem_();
232 if (selectedProfile)
233 ManageProfileOverlay.showDeleteDialog(selectedProfile);
234 };
235 }
230 236
231 if (cr.isChromeOS) { 237 if (cr.isChromeOS) {
232 if (!UIAccountTweaks.loggedInAsGuest()) { 238 if (!UIAccountTweaks.loggedInAsGuest()) {
233 $('account-picture-wrapper').onclick = function(event) { 239 $('account-picture-wrapper').onclick = function(event) {
234 OptionsPage.navigateToPage('changePicture'); 240 OptionsPage.navigateToPage('changePicture');
235 }; 241 };
236 } 242 }
237 243
238 // Username (canonical email) of the currently logged in user or 244 // Username (canonical email) of the currently logged in user or
239 // |kGuestUser| if a guest session is active. 245 // |kGuestUser| if a guest session is active.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 $('customize-sync').disabled = syncData.hasUnrecoverableError; 663 $('customize-sync').disabled = syncData.hasUnrecoverableError;
658 // Move #enable-auto-login-checkbox to a different location on CrOS. 664 // Move #enable-auto-login-checkbox to a different location on CrOS.
659 if (cr.isChromeOs) { 665 if (cr.isChromeOs) {
660 $('sync-general').insertBefore($('sync-status').nextSibling, 666 $('sync-general').insertBefore($('sync-status').nextSibling,
661 $('enable-auto-login-checkbox')); 667 $('enable-auto-login-checkbox'));
662 } 668 }
663 $('enable-auto-login-checkbox').hidden = !syncData.autoLoginVisible; 669 $('enable-auto-login-checkbox').hidden = !syncData.autoLoginVisible;
664 }, 670 },
665 671
666 /** 672 /**
667 * Display or hide the profiles section of the page. This is used for
668 * multi-profile settings.
669 * @param {boolean} visible True to show the section.
670 * @private
671 */
672 setProfilesSectionVisible_: function(visible) {
673 $('profiles-section').hidden = !visible;
674 },
675
676 /**
677 * Get the start/stop sync button DOM element. Used for testing. 673 * Get the start/stop sync button DOM element. Used for testing.
678 * @return {DOMElement} The start/stop sync button. 674 * @return {DOMElement} The start/stop sync button.
679 * @private 675 * @private
680 */ 676 */
681 getStartStopSyncButton_: function() { 677 getStartStopSyncButton_: function() {
682 return $('start-stop-sync'); 678 return $('start-stop-sync');
683 }, 679 },
684 680
685 /** 681 /**
686 * Event listener for the 'show home button' preference. Shows/hides the 682 * Event listener for the 'show home button' preference. Shows/hides the
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 'setBluetoothState', 1364 'setBluetoothState',
1369 'setCheckRevocationCheckboxState', 1365 'setCheckRevocationCheckboxState',
1370 'setContentFilterSettingsValue', 1366 'setContentFilterSettingsValue',
1371 'setFontSize', 1367 'setFontSize',
1372 'setGtkThemeButtonEnabled', 1368 'setGtkThemeButtonEnabled',
1373 'setHighContrastCheckboxState', 1369 'setHighContrastCheckboxState',
1374 'setInstantFieldTrialStatus', 1370 'setInstantFieldTrialStatus',
1375 'setMetricsReportingCheckboxState', 1371 'setMetricsReportingCheckboxState',
1376 'setMetricsReportingSettingVisibility', 1372 'setMetricsReportingSettingVisibility',
1377 'setProfilesInfo', 1373 'setProfilesInfo',
1378 'setProfilesSectionVisible',
1379 'setScreenMagnifierCheckboxState', 1374 'setScreenMagnifierCheckboxState',
1380 'setSpokenFeedbackCheckboxState', 1375 'setSpokenFeedbackCheckboxState',
1381 'setThemesResetButtonEnabled', 1376 'setThemesResetButtonEnabled',
1382 'setupCloudPrintConnectorSection', 1377 'setupCloudPrintConnectorSection',
1383 'setupPageZoomSelector', 1378 'setupPageZoomSelector',
1384 'setupProxySettingsSection', 1379 'setupProxySettingsSection',
1385 'setVirtualKeyboardCheckboxState', 1380 'setVirtualKeyboardCheckboxState',
1386 'showBluetoothSettings', 1381 'showBluetoothSettings',
1387 'showMouseControls', 1382 'showMouseControls',
1388 'showTouchpadControls', 1383 'showTouchpadControls',
(...skipping 20 matching lines...) Expand all
1409 BrowserOptions.getLoggedInUsername = function() { 1404 BrowserOptions.getLoggedInUsername = function() {
1410 return BrowserOptions.getInstance().username_; 1405 return BrowserOptions.getInstance().username_;
1411 }; 1406 };
1412 } 1407 }
1413 1408
1414 // Export 1409 // Export
1415 return { 1410 return {
1416 BrowserOptions: BrowserOptions 1411 BrowserOptions: BrowserOptions
1417 }; 1412 };
1418 }); 1413 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/browser_options_handler2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698