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

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

Issue 863063002: Don't allow profile deletion in Metro mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ifdefs Created 5 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
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.exportPath('options'); 5 cr.exportPath('options');
6 6
7 /** 7 /**
8 * @typedef {{actionLinkText: (string|undefined), 8 * @typedef {{actionLinkText: (string|undefined),
9 * childUser: (boolean|undefined), 9 * childUser: (boolean|undefined),
10 * hasError: (boolean|undefined), 10 * hasError: (boolean|undefined),
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 this.setDefaultSearchEngine_); 317 this.setDefaultSearchEngine_);
318 318
319 // Users section. 319 // Users section.
320 if (loadTimeData.valueExists('profilesInfo')) { 320 if (loadTimeData.valueExists('profilesInfo')) {
321 $('profiles-section').hidden = false; 321 $('profiles-section').hidden = false;
322 this.maybeShowUserSection_(); 322 this.maybeShowUserSection_();
323 323
324 var profilesList = $('profiles-list'); 324 var profilesList = $('profiles-list');
325 options.browser_options.ProfileList.decorate(profilesList); 325 options.browser_options.ProfileList.decorate(profilesList);
326 profilesList.autoExpands = true; 326 profilesList.autoExpands = true;
327 profilesList.canDeleteItems = true;
327 328
328 // The profiles info data in |loadTimeData| might be stale. 329 // The profiles info data in |loadTimeData| might be stale.
329 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo')); 330 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo'));
330 chrome.send('requestProfilesInfo'); 331 chrome.send('requestProfilesInfo');
331 332
332 profilesList.addEventListener('change', 333 profilesList.addEventListener('change',
333 this.setProfileViewButtonsStatus_); 334 this.setProfileViewButtonsStatus_);
334 $('profiles-create').onclick = function(event) { 335 $('profiles-create').onclick = function(event) {
335 ManageProfileOverlay.showCreateDialog(); 336 ManageProfileOverlay.showCreateDialog();
336 }; 337 };
337 if (OptionsPage.isSettingsApp()) { 338 if (OptionsPage.isSettingsApp()) {
338 $('profiles-app-list-switch').onclick = function(event) { 339 $('profiles-app-list-switch').onclick = function(event) {
339 var selectedProfile = self.getSelectedProfileItem_(); 340 var selectedProfile = self.getSelectedProfileItem_();
340 chrome.send('switchAppListProfile', [selectedProfile.filePath]); 341 chrome.send('switchAppListProfile', [selectedProfile.filePath]);
341 }; 342 };
342 } 343 }
343 $('profiles-manage').onclick = function(event) { 344 $('profiles-manage').onclick = function(event) {
344 ManageProfileOverlay.showManageDialog(); 345 ManageProfileOverlay.showManageDialog();
345 }; 346 };
346 $('profiles-delete').onclick = function(event) { 347 $('profiles-delete').onclick = function(event) {
347 var selectedProfile = self.getSelectedProfileItem_(); 348 var selectedProfile = self.getSelectedProfileItem_();
348 if (selectedProfile) 349 if (selectedProfile)
349 ManageProfileOverlay.showDeleteDialog(selectedProfile); 350 ManageProfileOverlay.showDeleteDialog(selectedProfile);
350 }; 351 };
351 if (loadTimeData.getBoolean('profileIsSupervised')) { 352 if (loadTimeData.getBoolean('profileIsSupervised')) {
352 $('profiles-create').disabled = true; 353 $('profiles-create').disabled = true;
353 $('profiles-delete').disabled = true; 354 $('profiles-delete').disabled = true;
354 $('profiles-list').canDeleteItems = false; 355 $('profiles-list').canDeleteItems = false;
355 } 356 }
357 if (!loadTimeData.getBoolean('allowProfileDeletion')) {
358 $('profiles-delete').disabled = true;
359 $('profiles-list').canDeleteItems = false;
360 }
356 } 361 }
357 362
358 if (cr.isChromeOS) { 363 if (cr.isChromeOS) {
359 // Username (canonical email) of the currently logged in user or 364 // Username (canonical email) of the currently logged in user or
360 // |kGuestUser| if a guest session is active. 365 // |kGuestUser| if a guest session is active.
361 this.username_ = loadTimeData.getString('username'); 366 this.username_ = loadTimeData.getString('username');
362 367
363 this.updateAccountPicture_(); 368 this.updateAccountPicture_();
364 369
365 $('account-picture').onclick = this.showImagerPickerOverlay_; 370 $('account-picture').onclick = this.showImagerPickerOverlay_;
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 * Helper function to set the status of profile view buttons to disabled or 1404 * Helper function to set the status of profile view buttons to disabled or
1400 * enabled, depending on the number of profiles and selection status of the 1405 * enabled, depending on the number of profiles and selection status of the
1401 * profiles list. 1406 * profiles list.
1402 * @private 1407 * @private
1403 */ 1408 */
1404 setProfileViewButtonsStatus_: function() { 1409 setProfileViewButtonsStatus_: function() {
1405 var profilesList = $('profiles-list'); 1410 var profilesList = $('profiles-list');
1406 var selectedProfile = profilesList.selectedItem; 1411 var selectedProfile = profilesList.selectedItem;
1407 var hasSelection = selectedProfile != null; 1412 var hasSelection = selectedProfile != null;
1408 var hasSingleProfile = profilesList.dataModel.length == 1; 1413 var hasSingleProfile = profilesList.dataModel.length == 1;
1409 var isSupervised = loadTimeData.getBoolean('profileIsSupervised');
1410 $('profiles-manage').disabled = !hasSelection || 1414 $('profiles-manage').disabled = !hasSelection ||
1411 !selectedProfile.isCurrentProfile; 1415 !selectedProfile.isCurrentProfile;
1412 if (hasSelection && !selectedProfile.isCurrentProfile) 1416 if (hasSelection && !selectedProfile.isCurrentProfile)
1413 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); 1417 $('profiles-manage').title = loadTimeData.getString('currentUserOnly');
1414 else 1418 else
1415 $('profiles-manage').title = ''; 1419 $('profiles-manage').title = '';
1416 $('profiles-delete').disabled = isSupervised || 1420 $('profiles-delete').disabled = !profilesList.canDeleteItems_ ||
1417 (!hasSelection && !hasSingleProfile); 1421 (!hasSelection && !hasSingleProfile);
1418 if (OptionsPage.isSettingsApp()) { 1422 if (OptionsPage.isSettingsApp()) {
1419 $('profiles-app-list-switch').disabled = !hasSelection || 1423 $('profiles-app-list-switch').disabled = !hasSelection ||
1420 selectedProfile.isCurrentProfile; 1424 selectedProfile.isCurrentProfile;
1421 } 1425 }
1422 var importData = $('import-data'); 1426 var importData = $('import-data');
1423 if (importData) { 1427 if (importData) {
1424 importData.disabled = $('import-data').disabled = hasSelection && 1428 importData.disabled = $('import-data').disabled = hasSelection &&
1425 !selectedProfile.isCurrentProfile; 1429 !selectedProfile.isCurrentProfile;
1426 } 1430 }
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 } 2206 }
2203 button.textContent = loadTimeData.getString(strId); 2207 button.textContent = loadTimeData.getString(strId);
2204 }; 2208 };
2205 } 2209 }
2206 2210
2207 // Export 2211 // Export
2208 return { 2212 return {
2209 BrowserOptions: BrowserOptions 2213 BrowserOptions: BrowserOptions
2210 }; 2214 };
2211 }); 2215 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698