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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 $('manage-languages').onclick = showLanguageOptions; | 477 $('manage-languages').onclick = showLanguageOptions; |
478 | 478 |
479 // Downloads section. | 479 // Downloads section. |
480 Preferences.getInstance().addEventListener('download.default_directory', | 480 Preferences.getInstance().addEventListener('download.default_directory', |
481 this.onDefaultDownloadDirectoryChanged_.bind(this)); | 481 this.onDefaultDownloadDirectoryChanged_.bind(this)); |
482 $('downloadLocationChangeButton').onclick = function(event) { | 482 $('downloadLocationChangeButton').onclick = function(event) { |
483 chrome.send('selectDownloadLocation'); | 483 chrome.send('selectDownloadLocation'); |
484 }; | 484 }; |
485 if (cr.isChromeOS) { | 485 if (cr.isChromeOS) { |
486 $('disable-drive-row').hidden = | 486 $('disable-drive-row').hidden = |
487 UIAccountTweaks.loggedInAsLocallyManagedUser(); | 487 UIAccountTweaks.loggedInAsSupervisedUser(); |
488 } | 488 } |
489 $('autoOpenFileTypesResetToDefault').onclick = function(event) { | 489 $('autoOpenFileTypesResetToDefault').onclick = function(event) { |
490 chrome.send('autoOpenFileTypesAction'); | 490 chrome.send('autoOpenFileTypesAction'); |
491 }; | 491 }; |
492 | 492 |
493 // HTTPS/SSL section. | 493 // HTTPS/SSL section. |
494 if (cr.isWindows || cr.isMac) { | 494 if (cr.isWindows || cr.isMac) { |
495 $('certificatesManageButton').onclick = function(event) { | 495 $('certificatesManageButton').onclick = function(event) { |
496 chrome.send('showManageSSLCertificates'); | 496 chrome.send('showManageSSLCertificates'); |
497 }; | 497 }; |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 * Helper function to set the status of profile view buttons to disabled or | 1204 * Helper function to set the status of profile view buttons to disabled or |
1205 * enabled, depending on the number of profiles and selection status of the | 1205 * enabled, depending on the number of profiles and selection status of the |
1206 * profiles list. | 1206 * profiles list. |
1207 * @private | 1207 * @private |
1208 */ | 1208 */ |
1209 setProfileViewButtonsStatus_: function() { | 1209 setProfileViewButtonsStatus_: function() { |
1210 var profilesList = $('profiles-list'); | 1210 var profilesList = $('profiles-list'); |
1211 var selectedProfile = profilesList.selectedItem; | 1211 var selectedProfile = profilesList.selectedItem; |
1212 var hasSelection = selectedProfile != null; | 1212 var hasSelection = selectedProfile != null; |
1213 var hasSingleProfile = profilesList.dataModel.length == 1; | 1213 var hasSingleProfile = profilesList.dataModel.length == 1; |
1214 var isManaged = loadTimeData.getBoolean('profileIsManaged'); | 1214 var isSupervised = loadTimeData.getBoolean('profileIsSupervised'); |
1215 $('profiles-manage').disabled = !hasSelection || | 1215 $('profiles-manage').disabled = !hasSelection || |
1216 !selectedProfile.isCurrentProfile; | 1216 !selectedProfile.isCurrentProfile; |
1217 if (hasSelection && !selectedProfile.isCurrentProfile) | 1217 if (hasSelection && !selectedProfile.isCurrentProfile) |
1218 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); | 1218 $('profiles-manage').title = loadTimeData.getString('currentUserOnly'); |
1219 else | 1219 else |
1220 $('profiles-manage').title = ''; | 1220 $('profiles-manage').title = ''; |
1221 $('profiles-delete').disabled = isManaged || | 1221 $('profiles-delete').disabled = isSupervised || |
1222 (!hasSelection && !hasSingleProfile); | 1222 (!hasSelection && !hasSingleProfile); |
1223 if (OptionsPage.isSettingsApp()) { | 1223 if (OptionsPage.isSettingsApp()) { |
1224 $('profiles-app-list-switch').disabled = !hasSelection || | 1224 $('profiles-app-list-switch').disabled = !hasSelection || |
1225 selectedProfile.isCurrentProfile; | 1225 selectedProfile.isCurrentProfile; |
1226 } | 1226 } |
1227 var importData = $('import-data'); | 1227 var importData = $('import-data'); |
1228 if (importData) { | 1228 if (importData) { |
1229 importData.disabled = $('import-data').disabled = hasSelection && | 1229 importData.disabled = $('import-data').disabled = hasSelection && |
1230 !selectedProfile.isCurrentProfile; | 1230 !selectedProfile.isCurrentProfile; |
1231 } | 1231 } |
(...skipping 20 matching lines...) Expand all Loading... |
1252 | 1252 |
1253 /** | 1253 /** |
1254 * Adds all |profiles| to the list. | 1254 * Adds all |profiles| to the list. |
1255 * @param {Array.<Object>} profiles An array of profile info objects. | 1255 * @param {Array.<Object>} profiles An array of profile info objects. |
1256 * each object is of the form: | 1256 * each object is of the form: |
1257 * profileInfo = { | 1257 * profileInfo = { |
1258 * name: "Profile Name", | 1258 * name: "Profile Name", |
1259 * iconURL: "chrome://path/to/icon/image", | 1259 * iconURL: "chrome://path/to/icon/image", |
1260 * filePath: "/path/to/profile/data/on/disk", | 1260 * filePath: "/path/to/profile/data/on/disk", |
1261 * isCurrentProfile: false, | 1261 * isCurrentProfile: false, |
1262 * isManaged: false | 1262 * isSupervised: false |
1263 * }; | 1263 * }; |
1264 * @private | 1264 * @private |
1265 */ | 1265 */ |
1266 setProfilesInfo_: function(profiles) { | 1266 setProfilesInfo_: function(profiles) { |
1267 this.setProfileViewSingle_(profiles.length); | 1267 this.setProfileViewSingle_(profiles.length); |
1268 // add it to the list, even if the list is hidden so we can access it | 1268 // add it to the list, even if the list is hidden so we can access it |
1269 // later. | 1269 // later. |
1270 $('profiles-list').dataModel = new ArrayDataModel(profiles); | 1270 $('profiles-list').dataModel = new ArrayDataModel(profiles); |
1271 | 1271 |
1272 // Received new data. If showing the "manage" overlay, keep it up to | 1272 // Received new data. If showing the "manage" overlay, keep it up to |
1273 // date. If showing the "delete" overlay, close it. | 1273 // date. If showing the "delete" overlay, close it. |
1274 if (ManageProfileOverlay.getInstance().visible && | 1274 if (ManageProfileOverlay.getInstance().visible && |
1275 !$('manage-profile-overlay-manage').hidden) { | 1275 !$('manage-profile-overlay-manage').hidden) { |
1276 ManageProfileOverlay.showManageDialog(); | 1276 ManageProfileOverlay.showManageDialog(); |
1277 } else { | 1277 } else { |
1278 ManageProfileOverlay.getInstance().visible = false; | 1278 ManageProfileOverlay.getInstance().visible = false; |
1279 } | 1279 } |
1280 | 1280 |
1281 this.setProfileViewButtonsStatus_(); | 1281 this.setProfileViewButtonsStatus_(); |
1282 }, | 1282 }, |
1283 | 1283 |
1284 /** | 1284 /** |
1285 * Reports managed user import errors to the ManagedUserImportOverlay. | 1285 * Reports supervised user import errors to the SupervisedUserImportOverlay. |
1286 * @param {string} error The error message to display. | 1286 * @param {string} error The error message to display. |
1287 * @private | 1287 * @private |
1288 */ | 1288 */ |
1289 showManagedUserImportError_: function(error) { | 1289 showSupervisedUserImportError_: function(error) { |
1290 ManagedUserImportOverlay.onError(error); | 1290 SupervisedUserImportOverlay.onError(error); |
1291 }, | 1291 }, |
1292 | 1292 |
1293 /** | 1293 /** |
1294 * Reports successful importing of a managed user to | 1294 * Reports successful importing of a supervised user to |
1295 * the ManagedUserImportOverlay. | 1295 * the SupervisedUserImportOverlay. |
1296 * @private | 1296 * @private |
1297 */ | 1297 */ |
1298 showManagedUserImportSuccess_: function() { | 1298 showSupervisedUserImportSuccess_: function() { |
1299 ManagedUserImportOverlay.onSuccess(); | 1299 SupervisedUserImportOverlay.onSuccess(); |
1300 }, | 1300 }, |
1301 | 1301 |
1302 /** | 1302 /** |
1303 * Reports an error to the "create" overlay during profile creation. | 1303 * Reports an error to the "create" overlay during profile creation. |
1304 * @param {string} error The error message to display. | 1304 * @param {string} error The error message to display. |
1305 * @private | 1305 * @private |
1306 */ | 1306 */ |
1307 showCreateProfileError_: function(error) { | 1307 showCreateProfileError_: function(error) { |
1308 CreateProfileOverlay.onError(error); | 1308 CreateProfileOverlay.onError(error); |
1309 }, | 1309 }, |
1310 | 1310 |
1311 /** | 1311 /** |
1312 * Sends a warning message to the "create" overlay during profile creation. | 1312 * Sends a warning message to the "create" overlay during profile creation. |
1313 * @param {string} warning The warning message to display. | 1313 * @param {string} warning The warning message to display. |
1314 * @private | 1314 * @private |
1315 */ | 1315 */ |
1316 showCreateProfileWarning_: function(warning) { | 1316 showCreateProfileWarning_: function(warning) { |
1317 CreateProfileOverlay.onWarning(warning); | 1317 CreateProfileOverlay.onWarning(warning); |
1318 }, | 1318 }, |
1319 | 1319 |
1320 /** | 1320 /** |
1321 * Reports successful profile creation to the "create" overlay. | 1321 * Reports successful profile creation to the "create" overlay. |
1322 * @param {Object} profileInfo An object of the form: | 1322 * @param {Object} profileInfo An object of the form: |
1323 * profileInfo = { | 1323 * profileInfo = { |
1324 * name: "Profile Name", | 1324 * name: "Profile Name", |
1325 * filePath: "/path/to/profile/data/on/disk" | 1325 * filePath: "/path/to/profile/data/on/disk" |
1326 * isManaged: (true|false), | 1326 * isSupervised: (true|false), |
1327 * }; | 1327 * }; |
1328 * @private | 1328 * @private |
1329 */ | 1329 */ |
1330 showCreateProfileSuccess_: function(profileInfo) { | 1330 showCreateProfileSuccess_: function(profileInfo) { |
1331 CreateProfileOverlay.onSuccess(profileInfo); | 1331 CreateProfileOverlay.onSuccess(profileInfo); |
1332 }, | 1332 }, |
1333 | 1333 |
1334 /** | 1334 /** |
1335 * Returns the currently active profile for this browser window. | 1335 * Returns the currently active profile for this browser window. |
1336 * @return {Object} A profile info object. | 1336 * @return {Object} A profile info object. |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 'setSpokenFeedbackCheckboxState', | 1845 'setSpokenFeedbackCheckboxState', |
1846 'setThemesResetButtonEnabled', | 1846 'setThemesResetButtonEnabled', |
1847 'setVirtualKeyboardCheckboxState', | 1847 'setVirtualKeyboardCheckboxState', |
1848 'setupPageZoomSelector', | 1848 'setupPageZoomSelector', |
1849 'setupProxySettingsButton', | 1849 'setupProxySettingsButton', |
1850 'showBluetoothSettings', | 1850 'showBluetoothSettings', |
1851 'showCreateProfileError', | 1851 'showCreateProfileError', |
1852 'showCreateProfileSuccess', | 1852 'showCreateProfileSuccess', |
1853 'showCreateProfileWarning', | 1853 'showCreateProfileWarning', |
1854 'showHotwordSection', | 1854 'showHotwordSection', |
1855 'showManagedUserImportError', | |
1856 'showManagedUserImportSuccess', | |
1857 'showMouseControls', | 1855 'showMouseControls', |
| 1856 'showSupervisedUserImportError', |
| 1857 'showSupervisedUserImportSuccess', |
1858 'showTouchpadControls', | 1858 'showTouchpadControls', |
1859 'toggleExtensionIndicators', | 1859 'toggleExtensionIndicators', |
1860 'updateAccountPicture', | 1860 'updateAccountPicture', |
1861 'updateAutoLaunchState', | 1861 'updateAutoLaunchState', |
1862 'updateDefaultBrowserState', | 1862 'updateDefaultBrowserState', |
1863 'updateEasyUnlock', | 1863 'updateEasyUnlock', |
1864 'updateManagesSupervisedUsers', | 1864 'updateManagesSupervisedUsers', |
1865 'updateSearchEngines', | 1865 'updateSearchEngines', |
1866 'updateStartupPages', | 1866 'updateStartupPages', |
1867 'updateSyncState', | 1867 'updateSyncState', |
(...skipping 13 matching lines...) Expand all Loading... |
1881 BrowserOptions.getLoggedInUsername = function() { | 1881 BrowserOptions.getLoggedInUsername = function() { |
1882 return BrowserOptions.getInstance().username_; | 1882 return BrowserOptions.getInstance().username_; |
1883 }; | 1883 }; |
1884 } | 1884 } |
1885 | 1885 |
1886 // Export | 1886 // Export |
1887 return { | 1887 return { |
1888 BrowserOptions: BrowserOptions | 1888 BrowserOptions: BrowserOptions |
1889 }; | 1889 }; |
1890 }); | 1890 }); |
OLD | NEW |