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.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 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
10 | 10 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 $('themes-gallery').onclick = function(event) { | 200 $('themes-gallery').onclick = function(event) { |
201 window.open(loadTimeData.getString('themesGalleryURL')); | 201 window.open(loadTimeData.getString('themesGalleryURL')); |
202 chrome.send('coreOptionsUserMetricsAction', | 202 chrome.send('coreOptionsUserMetricsAction', |
203 ['Options_ThemesGallery']); | 203 ['Options_ThemesGallery']); |
204 }; | 204 }; |
205 $('themes-reset').onclick = function(event) { | 205 $('themes-reset').onclick = function(event) { |
206 chrome.send('themesReset'); | 206 chrome.send('themesReset'); |
207 }; | 207 }; |
208 | 208 |
209 if (loadTimeData.getBoolean('profileIsManaged')) { | 209 if (loadTimeData.getBoolean('profileIsSupervised')) { |
210 if ($('themes-native-button')) { | 210 if ($('themes-native-button')) { |
211 $('themes-native-button').disabled = true; | 211 $('themes-native-button').disabled = true; |
212 $('themes-native-button').hidden = true; | 212 $('themes-native-button').hidden = true; |
213 } | 213 } |
214 // Supervised users have just one default theme, even on Linux. So use | 214 // Supervised users have just one default theme, even on Linux. So use |
215 // the same button for Linux as for the other platforms. | 215 // the same button for Linux as for the other platforms. |
216 $('themes-reset').textContent = loadTimeData.getString('themesReset'); | 216 $('themes-reset').textContent = loadTimeData.getString('themesReset'); |
217 } | 217 } |
218 | 218 |
219 // Device section (ChromeOS only). | 219 // Device section (ChromeOS only). |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 }; | 264 }; |
265 } | 265 } |
266 $('profiles-manage').onclick = function(event) { | 266 $('profiles-manage').onclick = function(event) { |
267 ManageProfileOverlay.showManageDialog(); | 267 ManageProfileOverlay.showManageDialog(); |
268 }; | 268 }; |
269 $('profiles-delete').onclick = function(event) { | 269 $('profiles-delete').onclick = function(event) { |
270 var selectedProfile = self.getSelectedProfileItem_(); | 270 var selectedProfile = self.getSelectedProfileItem_(); |
271 if (selectedProfile) | 271 if (selectedProfile) |
272 ManageProfileOverlay.showDeleteDialog(selectedProfile); | 272 ManageProfileOverlay.showDeleteDialog(selectedProfile); |
273 }; | 273 }; |
274 if (loadTimeData.getBoolean('profileIsManaged')) { | 274 if (loadTimeData.getBoolean('profileIsSupervised')) { |
275 $('profiles-create').disabled = true; | 275 $('profiles-create').disabled = true; |
276 $('profiles-delete').disabled = true; | 276 $('profiles-delete').disabled = true; |
277 $('profiles-list').canDeleteItems = false; | 277 $('profiles-list').canDeleteItems = false; |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 if (cr.isChromeOS) { | 281 if (cr.isChromeOS) { |
282 // Username (canonical email) of the currently logged in user or | 282 // Username (canonical email) of the currently logged in user or |
283 // |kGuestUser| if a guest session is active. | 283 // |kGuestUser| if a guest session is active. |
284 this.username_ = loadTimeData.getString('username'); | 284 this.username_ = loadTimeData.getString('username'); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 $('manage-languages').onclick = showLanguageOptions; | 472 $('manage-languages').onclick = showLanguageOptions; |
473 | 473 |
474 // Downloads section. | 474 // Downloads section. |
475 Preferences.getInstance().addEventListener('download.default_directory', | 475 Preferences.getInstance().addEventListener('download.default_directory', |
476 this.onDefaultDownloadDirectoryChanged_.bind(this)); | 476 this.onDefaultDownloadDirectoryChanged_.bind(this)); |
477 $('downloadLocationChangeButton').onclick = function(event) { | 477 $('downloadLocationChangeButton').onclick = function(event) { |
478 chrome.send('selectDownloadLocation'); | 478 chrome.send('selectDownloadLocation'); |
479 }; | 479 }; |
480 if (cr.isChromeOS) { | 480 if (cr.isChromeOS) { |
481 $('disable-drive-row').hidden = | 481 $('disable-drive-row').hidden = |
482 UIAccountTweaks.loggedInAsLocallyManagedUser(); | 482 UIAccountTweaks.loggedInAsSupervisedUser(); |
483 } | 483 } |
484 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 484 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
485 chrome.send('autoOpenFileTypesAction'); | 485 chrome.send('autoOpenFileTypesAction'); |
486 }; | 486 }; |
487 | 487 |
488 // HTTPS/SSL section. | 488 // HTTPS/SSL section. |
489 if (cr.isWindows || cr.isMac) { | 489 if (cr.isWindows || cr.isMac) { |
490 $('certificatesManageButton').onclick = function(event) { | 490 $('certificatesManageButton').onclick = function(event) { |
491 chrome.send('showManageSSLCertificates'); | 491 chrome.send('showManageSSLCertificates'); |
492 }; | 492 }; |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 * Helper function to set the status of profile view buttons to disabled or | 1198 * Helper function to set the status of profile view buttons to disabled or |
1199 * enabled, depending on the number of profiles and selection status of the | 1199 * enabled, depending on the number of profiles and selection status of the |
1200 * profiles list. | 1200 * profiles list. |
1201 * @private | 1201 * @private |
1202 */ | 1202 */ |
1203 setProfileViewButtonsStatus_: function() { | 1203 setProfileViewButtonsStatus_: function() { |
1204 var profilesList = $('profiles-list'); | 1204 var profilesList = $('profiles-list'); |
1205 var selectedProfile = profilesList.selectedItem; | 1205 var selectedProfile = profilesList.selectedItem; |
1206 var hasSelection = selectedProfile != null; | 1206 var hasSelection = selectedProfile != null; |
1207 var hasSingleProfile = profilesList.dataModel.length == 1; | 1207 var hasSingleProfile = profilesList.dataModel.length == 1; |
1208 var isManaged = loadTimeData.getBoolean('profileIsManaged'); | 1208 var isSupervised = loadTimeData.getBoolean('profileIsSupervised'); |
1209 $('profiles-manage').disabled = !hasSelection || | 1209 $('profiles-manage').disabled = !hasSelection || |
1210 !selectedProfile.isCurrentProfile; | 1210 !selectedProfile.isCurrentProfile; |
1211 if (hasSelection && !selectedProfile.isCurrentProfile) | 1211 if (hasSelection && !selectedProfile.isCurrentProfile) |
1212 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); | 1212 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
1213 else | 1213 else |
1214 $('profiles-manage').title = ''; | 1214 $('profiles-manage').title = ''; |
1215 $('profiles-delete').disabled = isManaged || | 1215 $('profiles-delete').disabled = isSupervised || |
1216 (!hasSelection && !hasSingleProfile); | 1216 (!hasSelection && !hasSingleProfile); |
1217 if (OptionsPage.isSettingsApp()) { | 1217 if (OptionsPage.isSettingsApp()) { |
1218 $('profiles-app-list-switch').disabled = !hasSelection || | 1218 $('profiles-app-list-switch').disabled = !hasSelection || |
1219 selectedProfile.isCurrentProfile; | 1219 selectedProfile.isCurrentProfile; |
1220 } | 1220 } |
1221 var importData = $('import-data'); | 1221 var importData = $('import-data'); |
1222 if (importData) { | 1222 if (importData) { |
1223 importData.disabled = $('import-data').disabled = hasSelection && | 1223 importData.disabled = $('import-data').disabled = hasSelection && |
1224 !selectedProfile.isCurrentProfile; | 1224 !selectedProfile.isCurrentProfile; |
1225 } | 1225 } |
(...skipping 20 matching lines...) Expand all Loading... |
1246 | 1246 |
1247 /** | 1247 /** |
1248 * Adds all |profiles| to the list. | 1248 * Adds all |profiles| to the list. |
1249 * @param {Array.<Object>} profiles An array of profile info objects. | 1249 * @param {Array.<Object>} profiles An array of profile info objects. |
1250 * each object is of the form: | 1250 * each object is of the form: |
1251 * profileInfo = { | 1251 * profileInfo = { |
1252 * name: "Profile Name", | 1252 * name: "Profile Name", |
1253 * iconURL: "chrome://path/to/icon/image", | 1253 * iconURL: "chrome://path/to/icon/image", |
1254 * filePath: "/path/to/profile/data/on/disk", | 1254 * filePath: "/path/to/profile/data/on/disk", |
1255 * isCurrentProfile: false, | 1255 * isCurrentProfile: false, |
1256 * isManaged: false | 1256 * isSupervised: false |
1257 * }; | 1257 * }; |
1258 * @private | 1258 * @private |
1259 */ | 1259 */ |
1260 setProfilesInfo_: function(profiles) { | 1260 setProfilesInfo_: function(profiles) { |
1261 this.setProfileViewSingle_(profiles.length); | 1261 this.setProfileViewSingle_(profiles.length); |
1262 // add it to the list, even if the list is hidden so we can access it | 1262 // add it to the list, even if the list is hidden so we can access it |
1263 // later. | 1263 // later. |
1264 $('profiles-list').dataModel = new ArrayDataModel(profiles); | 1264 $('profiles-list').dataModel = new ArrayDataModel(profiles); |
1265 | 1265 |
1266 // Received new data. If showing the "manage" overlay, keep it up to | 1266 // Received new data. If showing the "manage" overlay, keep it up to |
1267 // date. If showing the "delete" overlay, close it. | 1267 // date. If showing the "delete" overlay, close it. |
1268 if (ManageProfileOverlay.getInstance().visible && | 1268 if (ManageProfileOverlay.getInstance().visible && |
1269 !$('manage-profile-overlay-manage').hidden) { | 1269 !$('manage-profile-overlay-manage').hidden) { |
1270 ManageProfileOverlay.showManageDialog(); | 1270 ManageProfileOverlay.showManageDialog(); |
1271 } else { | 1271 } else { |
1272 ManageProfileOverlay.getInstance().visible = false; | 1272 ManageProfileOverlay.getInstance().visible = false; |
1273 } | 1273 } |
1274 | 1274 |
1275 this.setProfileViewButtonsStatus_(); | 1275 this.setProfileViewButtonsStatus_(); |
1276 }, | 1276 }, |
1277 | 1277 |
1278 /** | 1278 /** |
1279 * Reports managed user import errors to the ManagedUserImportOverlay. | 1279 * Reports supervised user import errors to the SupervisedUserImportOverlay. |
1280 * @param {string} error The error message to display. | 1280 * @param {string} error The error message to display. |
1281 * @private | 1281 * @private |
1282 */ | 1282 */ |
1283 showManagedUserImportError_: function(error) { | 1283 showSupervisedUserImportError_: function(error) { |
1284 ManagedUserImportOverlay.onError(error); | 1284 SupervisedUserImportOverlay.onError(error); |
1285 }, | 1285 }, |
1286 | 1286 |
1287 /** | 1287 /** |
1288 * Reports successful importing of a managed user to | 1288 * Reports successful importing of a supervised user to |
1289 * the ManagedUserImportOverlay. | 1289 * the SupervisedUserImportOverlay. |
1290 * @private | 1290 * @private |
1291 */ | 1291 */ |
1292 showManagedUserImportSuccess_: function() { | 1292 showSupervisedUserImportSuccess_: function() { |
1293 ManagedUserImportOverlay.onSuccess(); | 1293 SupervisedUserImportOverlay.onSuccess(); |
1294 }, | 1294 }, |
1295 | 1295 |
1296 /** | 1296 /** |
1297 * Reports an error to the "create" overlay during profile creation. | 1297 * Reports an error to the "create" overlay during profile creation. |
1298 * @param {string} error The error message to display. | 1298 * @param {string} error The error message to display. |
1299 * @private | 1299 * @private |
1300 */ | 1300 */ |
1301 showCreateProfileError_: function(error) { | 1301 showCreateProfileError_: function(error) { |
1302 CreateProfileOverlay.onError(error); | 1302 CreateProfileOverlay.onError(error); |
1303 }, | 1303 }, |
1304 | 1304 |
1305 /** | 1305 /** |
1306 * Sends a warning message to the "create" overlay during profile creation. | 1306 * Sends a warning message to the "create" overlay during profile creation. |
1307 * @param {string} warning The warning message to display. | 1307 * @param {string} warning The warning message to display. |
1308 * @private | 1308 * @private |
1309 */ | 1309 */ |
1310 showCreateProfileWarning_: function(warning) { | 1310 showCreateProfileWarning_: function(warning) { |
1311 CreateProfileOverlay.onWarning(warning); | 1311 CreateProfileOverlay.onWarning(warning); |
1312 }, | 1312 }, |
1313 | 1313 |
1314 /** | 1314 /** |
1315 * Reports successful profile creation to the "create" overlay. | 1315 * Reports successful profile creation to the "create" overlay. |
1316 * @param {Object} profileInfo An object of the form: | 1316 * @param {Object} profileInfo An object of the form: |
1317 * profileInfo = { | 1317 * profileInfo = { |
1318 * name: "Profile Name", | 1318 * name: "Profile Name", |
1319 * filePath: "/path/to/profile/data/on/disk" | 1319 * filePath: "/path/to/profile/data/on/disk" |
1320 * isManaged: (true|false), | 1320 * isSupervised: (true|false), |
1321 * }; | 1321 * }; |
1322 * @private | 1322 * @private |
1323 */ | 1323 */ |
1324 showCreateProfileSuccess_: function(profileInfo) { | 1324 showCreateProfileSuccess_: function(profileInfo) { |
1325 CreateProfileOverlay.onSuccess(profileInfo); | 1325 CreateProfileOverlay.onSuccess(profileInfo); |
1326 }, | 1326 }, |
1327 | 1327 |
1328 /** | 1328 /** |
1329 * Returns the currently active profile for this browser window. | 1329 * Returns the currently active profile for this browser window. |
1330 * @return {Object} A profile info object. | 1330 * @return {Object} A profile info object. |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 'setSpokenFeedbackCheckboxState', | 1840 'setSpokenFeedbackCheckboxState', |
1841 'setThemesResetButtonEnabled', | 1841 'setThemesResetButtonEnabled', |
1842 'setVirtualKeyboardCheckboxState', | 1842 'setVirtualKeyboardCheckboxState', |
1843 'setupPageZoomSelector', | 1843 'setupPageZoomSelector', |
1844 'setupProxySettingsButton', | 1844 'setupProxySettingsButton', |
1845 'showBluetoothSettings', | 1845 'showBluetoothSettings', |
1846 'showCreateProfileError', | 1846 'showCreateProfileError', |
1847 'showCreateProfileSuccess', | 1847 'showCreateProfileSuccess', |
1848 'showCreateProfileWarning', | 1848 'showCreateProfileWarning', |
1849 'showHotwordSection', | 1849 'showHotwordSection', |
1850 'showManagedUserImportError', | |
1851 'showManagedUserImportSuccess', | |
1852 'showMouseControls', | 1850 'showMouseControls', |
| 1851 'showSupervisedUserImportError', |
| 1852 'showSupervisedUserImportSuccess', |
1853 'showTouchpadControls', | 1853 'showTouchpadControls', |
1854 'toggleExtensionIndicators', | 1854 'toggleExtensionIndicators', |
1855 'updateAccountPicture', | 1855 'updateAccountPicture', |
1856 'updateAutoLaunchState', | 1856 'updateAutoLaunchState', |
1857 'updateDefaultBrowserState', | 1857 'updateDefaultBrowserState', |
1858 'updateEasyUnlock', | 1858 'updateEasyUnlock', |
1859 'updateManagesSupervisedUsers', | 1859 'updateManagesSupervisedUsers', |
1860 'updateSearchEngines', | 1860 'updateSearchEngines', |
1861 'updateStartupPages', | 1861 'updateStartupPages', |
1862 'updateSyncState', | 1862 'updateSyncState', |
(...skipping 24 matching lines...) Expand all Loading... |
1887 $('consumer-management-unenroll').hidden = !isEnrolled; | 1887 $('consumer-management-unenroll').hidden = !isEnrolled; |
1888 ConsumerManagementOverlay.setEnrollmentStatus(isEnrolled); | 1888 ConsumerManagementOverlay.setEnrollmentStatus(isEnrolled); |
1889 }; | 1889 }; |
1890 } | 1890 } |
1891 | 1891 |
1892 // Export | 1892 // Export |
1893 return { | 1893 return { |
1894 BrowserOptions: BrowserOptions | 1894 BrowserOptions: BrowserOptions |
1895 }; | 1895 }; |
1896 }); | 1896 }); |
OLD | NEW |