OLD | NEW |
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 loadTimeData.getValue('profilesInfo'))); | 382 loadTimeData.getValue('profilesInfo'))); |
383 chrome.send('requestProfilesInfo'); | 383 chrome.send('requestProfilesInfo'); |
384 | 384 |
385 profilesList.addEventListener('change', | 385 profilesList.addEventListener('change', |
386 this.setProfileViewButtonsStatus_); | 386 this.setProfileViewButtonsStatus_); |
387 $('profiles-create').onclick = function(event) { | 387 $('profiles-create').onclick = function(event) { |
388 chrome.send('metricsHandler:recordAction', | 388 chrome.send('metricsHandler:recordAction', |
389 ['Options_ShowCreateProfileDlg']); | 389 ['Options_ShowCreateProfileDlg']); |
390 ManageProfileOverlay.showCreateDialog(); | 390 ManageProfileOverlay.showCreateDialog(); |
391 }; | 391 }; |
392 if (OptionsPage.isSettingsApp()) { | |
393 $('profiles-app-list-switch').onclick = function(event) { | |
394 var selectedProfile = self.getSelectedProfileItem_(); | |
395 chrome.send('switchAppListProfile', [selectedProfile.filePath]); | |
396 }; | |
397 } | |
398 $('profiles-manage').onclick = function(event) { | 392 $('profiles-manage').onclick = function(event) { |
399 chrome.send('metricsHandler:recordAction', | 393 chrome.send('metricsHandler:recordAction', |
400 ['Options_ShowEditProfileDlg']); | 394 ['Options_ShowEditProfileDlg']); |
401 ManageProfileOverlay.showManageDialog(); | 395 ManageProfileOverlay.showManageDialog(); |
402 }; | 396 }; |
403 $('profiles-delete').onclick = function(event) { | 397 $('profiles-delete').onclick = function(event) { |
404 var selectedProfile = self.getSelectedProfileItem_(); | 398 var selectedProfile = self.getSelectedProfileItem_(); |
405 if (selectedProfile) { | 399 if (selectedProfile) { |
406 chrome.send('metricsHandler:recordAction', | 400 chrome.send('metricsHandler:recordAction', |
407 ['Options_ShowDeleteProfileDlg']); | 401 ['Options_ShowDeleteProfileDlg']); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 $('privacyContentSettingsButton').onclick = function(event) { | 470 $('privacyContentSettingsButton').onclick = function(event) { |
477 PageManager.showPageByName('content'); | 471 PageManager.showPageByName('content'); |
478 OptionsPage.showTab($('cookies-nav-tab')); | 472 OptionsPage.showTab($('cookies-nav-tab')); |
479 chrome.send('coreOptionsUserMetricsAction', | 473 chrome.send('coreOptionsUserMetricsAction', |
480 ['Options_ContentSettings']); | 474 ['Options_ContentSettings']); |
481 }; | 475 }; |
482 $('privacyClearDataButton').onclick = function(event) { | 476 $('privacyClearDataButton').onclick = function(event) { |
483 PageManager.showPageByName('clearBrowserData'); | 477 PageManager.showPageByName('clearBrowserData'); |
484 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); | 478 chrome.send('coreOptionsUserMetricsAction', ['Options_ClearData']); |
485 }; | 479 }; |
486 $('privacyClearDataButton').hidden = OptionsPage.isSettingsApp(); | |
487 | 480 |
488 if ($('metrics-reporting-enabled')) { | 481 if ($('metrics-reporting-enabled')) { |
489 $('metrics-reporting-enabled').checked = | 482 $('metrics-reporting-enabled').checked = |
490 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); | 483 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); |
491 | 484 |
492 // A browser restart is never needed to toggle metrics reporting, | 485 // A browser restart is never needed to toggle metrics reporting, |
493 // and is only needed to toggle crash reporting when using Breakpad. | 486 // and is only needed to toggle crash reporting when using Breakpad. |
494 // Crashpad, used on Mac, does not require a browser restart. | 487 // Crashpad, used on Mac, does not require a browser restart. |
495 var togglingMetricsRequiresRestart = !cr.isMac && !cr.isChromeOS; | 488 var togglingMetricsRequiresRestart = !cr.isMac && !cr.isChromeOS; |
496 $('metrics-reporting-enabled').onclick = function(event) { | 489 $('metrics-reporting-enabled').onclick = function(event) { |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 var hasSelection = selectedProfile != null; | 1513 var hasSelection = selectedProfile != null; |
1521 var hasSingleProfile = profilesList.dataModel.length == 1; | 1514 var hasSingleProfile = profilesList.dataModel.length == 1; |
1522 $('profiles-manage').disabled = !hasSelection || | 1515 $('profiles-manage').disabled = !hasSelection || |
1523 !selectedProfile.isCurrentProfile; | 1516 !selectedProfile.isCurrentProfile; |
1524 if (hasSelection && !selectedProfile.isCurrentProfile) | 1517 if (hasSelection && !selectedProfile.isCurrentProfile) |
1525 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); | 1518 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
1526 else | 1519 else |
1527 $('profiles-manage').title = ''; | 1520 $('profiles-manage').title = ''; |
1528 $('profiles-delete').disabled = !profilesList.canDeleteItems || | 1521 $('profiles-delete').disabled = !profilesList.canDeleteItems || |
1529 !hasSelection; | 1522 !hasSelection; |
1530 if (OptionsPage.isSettingsApp()) { | |
1531 $('profiles-app-list-switch').disabled = !hasSelection || | |
1532 selectedProfile.isCurrentProfile; | |
1533 } | |
1534 var importData = $('import-data'); | 1523 var importData = $('import-data'); |
1535 if (importData) { | 1524 if (importData) { |
1536 importData.disabled = $('import-data').disabled = hasSelection && | 1525 importData.disabled = $('import-data').disabled = hasSelection && |
1537 !selectedProfile.isCurrentProfile; | 1526 !selectedProfile.isCurrentProfile; |
1538 } | 1527 } |
1539 }, | 1528 }, |
1540 | 1529 |
1541 /** | 1530 /** |
1542 * Display the correct dialog layout, depending on how many profiles are | 1531 * Display the correct dialog layout, depending on how many profiles are |
1543 * available. | 1532 * available. |
1544 * @param {number} numProfiles The number of profiles to display. | 1533 * @param {number} numProfiles The number of profiles to display. |
1545 * @private | 1534 * @private |
1546 */ | 1535 */ |
1547 setProfileViewSingle_: function(numProfiles) { | 1536 setProfileViewSingle_: function(numProfiles) { |
1548 // Always show the profiles list when using the new Profiles UI. | 1537 // Always show the profiles list when using the new Profiles UI. |
1549 var usingNewProfilesUI = loadTimeData.getBoolean('usingNewProfilesUI'); | 1538 var usingNewProfilesUI = loadTimeData.getBoolean('usingNewProfilesUI'); |
1550 var showSingleProfileView = !usingNewProfilesUI && numProfiles == 1; | 1539 var showSingleProfileView = !usingNewProfilesUI && numProfiles == 1; |
1551 $('profiles-list').hidden = showSingleProfileView; | 1540 $('profiles-list').hidden = showSingleProfileView; |
1552 $('profiles-single-message').hidden = !showSingleProfileView; | 1541 $('profiles-single-message').hidden = !showSingleProfileView; |
1553 $('profiles-manage').hidden = | 1542 $('profiles-manage').hidden = showSingleProfileView; |
1554 showSingleProfileView || OptionsPage.isSettingsApp(); | |
1555 $('profiles-delete').textContent = showSingleProfileView ? | 1543 $('profiles-delete').textContent = showSingleProfileView ? |
1556 loadTimeData.getString('profilesDeleteSingle') : | 1544 loadTimeData.getString('profilesDeleteSingle') : |
1557 loadTimeData.getString('profilesDelete'); | 1545 loadTimeData.getString('profilesDelete'); |
1558 if (OptionsPage.isSettingsApp()) | |
1559 $('profiles-app-list-switch').hidden = showSingleProfileView; | |
1560 }, | 1546 }, |
1561 | 1547 |
1562 /** | 1548 /** |
1563 * Adds all |profiles| to the list. | 1549 * Adds all |profiles| to the list. |
1564 * @param {!Array<!options.Profile>} profiles An array of profile info | 1550 * @param {!Array<!options.Profile>} profiles An array of profile info |
1565 * objects. | 1551 * objects. |
1566 * @private | 1552 * @private |
1567 */ | 1553 */ |
1568 setProfilesInfo_: function(profiles) { | 1554 setProfilesInfo_: function(profiles) { |
1569 this.setProfileViewSingle_(profiles.length); | 1555 this.setProfileViewSingle_(profiles.length); |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 | 2433 |
2448 settings.hidden = !isVisible; | 2434 settings.hidden = !isVisible; |
2449 }; | 2435 }; |
2450 } | 2436 } |
2451 | 2437 |
2452 // Export | 2438 // Export |
2453 return { | 2439 return { |
2454 BrowserOptions: BrowserOptions | 2440 BrowserOptions: BrowserOptions |
2455 }; | 2441 }; |
2456 }); | 2442 }); |
OLD | NEW |