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 | 9 |
10 // | 10 // |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 profilesList.autoExpands = true; | 230 profilesList.autoExpands = true; |
231 | 231 |
232 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo')); | 232 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo')); |
233 | 233 |
234 profilesList.addEventListener('change', | 234 profilesList.addEventListener('change', |
235 this.setProfileViewButtonsStatus_); | 235 this.setProfileViewButtonsStatus_); |
236 $('profiles-create').onclick = function(event) { | 236 $('profiles-create').onclick = function(event) { |
237 chrome.send('createProfile'); | 237 chrome.send('createProfile'); |
238 }; | 238 }; |
239 $('profiles-manage').onclick = function(event) { | 239 $('profiles-manage').onclick = function(event) { |
240 var selectedProfile = self.getSelectedProfileItem_(); | 240 ManageProfileOverlay.showManageDialog(); |
241 if (selectedProfile) | |
242 ManageProfileOverlay.showManageDialog(selectedProfile); | |
243 }; | 241 }; |
244 $('profiles-delete').onclick = function(event) { | 242 $('profiles-delete').onclick = function(event) { |
245 var selectedProfile = self.getSelectedProfileItem_(); | 243 var selectedProfile = self.getSelectedProfileItem_(); |
246 if (selectedProfile) | 244 if (selectedProfile) |
247 ManageProfileOverlay.showDeleteDialog(selectedProfile); | 245 ManageProfileOverlay.showDeleteDialog(selectedProfile); |
248 }; | 246 }; |
249 } | 247 } |
250 | 248 |
251 if (cr.isChromeOS) { | 249 if (cr.isChromeOS) { |
252 if (!UIAccountTweaks.loggedInAsGuest()) { | 250 if (!UIAccountTweaks.loggedInAsGuest()) { |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 * filePath: "/path/to/profile/data/on/disk", | 999 * filePath: "/path/to/profile/data/on/disk", |
1002 * isCurrentProfile: false | 1000 * isCurrentProfile: false |
1003 * }; | 1001 * }; |
1004 * @private | 1002 * @private |
1005 */ | 1003 */ |
1006 setProfilesInfo_: function(profiles) { | 1004 setProfilesInfo_: function(profiles) { |
1007 this.setProfileViewSingle_(profiles.length); | 1005 this.setProfileViewSingle_(profiles.length); |
1008 // add it to the list, even if the list is hidden so we can access it | 1006 // add it to the list, even if the list is hidden so we can access it |
1009 // later. | 1007 // later. |
1010 $('profiles-list').dataModel = new ArrayDataModel(profiles); | 1008 $('profiles-list').dataModel = new ArrayDataModel(profiles); |
1011 // We got new data, close the open overlay if it's open. | 1009 |
1012 ManageProfileOverlay.getInstance().visible = false; | 1010 // Received new data. If showing the "manage" overlay, keep it up to |
1011 // date. If showing the "delete" overlay, close it. | |
1012 if (ManageProfileOverlay.getInstance().visible && | |
1013 !$('manage-profile-overlay-manage').hidden) { | |
1014 ManageProfileOverlay.showManageDialog(); | |
1015 } else { | |
1016 ManageProfileOverlay.getInstance().visible = false; | |
1017 } | |
1018 | |
1013 this.setProfileViewButtonsStatus_(); | 1019 this.setProfileViewButtonsStatus_(); |
1014 }, | 1020 }, |
1015 | 1021 |
1022 /** | |
1023 * Returns the currently active profile for this browser window. | |
1024 * @return {Object} A profile info object. | |
Dan Beam
2012/06/20 02:25:19
{?Object} if you can return null, or remove the re
Evan Stade
2012/06/20 22:10:06
you're commenting on an old patch
| |
1025 * @private | |
1026 */ | |
1027 getCurrentProfile_: function() { | |
1028 for (var i = 0; i < $('profiles-list').dataModel.length; i++) { | |
1029 var profile = $('profiles-list').dataModel.item(i); | |
1030 if (profile.isCurrentProfile) | |
Dan Beam
2012/06/20 02:25:19
indent -2\s
Evan Stade
2012/06/20 22:10:06
Done.
| |
1031 return profile; | |
1032 } | |
1033 | |
1034 assert(false); | |
Dan Beam
2012/06/20 02:25:19
Y U NO MSG?
Evan Stade
2012/06/20 22:10:06
Done.
| |
1035 return null; | |
Dan Beam
2012/06/20 02:25:19
doesn't assert() throw right here?
Evan Stade
2012/06/20 22:10:06
you're commenting on an old patch
| |
1036 }, | |
1037 | |
1016 setGtkThemeButtonEnabled_: function(enabled) { | 1038 setGtkThemeButtonEnabled_: function(enabled) { |
1017 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) | 1039 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) |
1018 $('themes-GTK-button').disabled = !enabled; | 1040 $('themes-GTK-button').disabled = !enabled; |
1019 }, | 1041 }, |
1020 | 1042 |
1021 setThemesResetButtonEnabled_: function(enabled) { | 1043 setThemesResetButtonEnabled_: function(enabled) { |
1022 $('themes-reset').disabled = !enabled; | 1044 $('themes-reset').disabled = !enabled; |
1023 }, | 1045 }, |
1024 | 1046 |
1025 /** | 1047 /** |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1352 setContentFilterSettingsValue_: function(dict) { | 1374 setContentFilterSettingsValue_: function(dict) { |
1353 if ('cookies' in dict && 'value' in dict['cookies']) | 1375 if ('cookies' in dict && 'value' in dict['cookies']) |
1354 this.sessionOnlyCookies_ = dict['cookies']['value'] == 'session'; | 1376 this.sessionOnlyCookies_ = dict['cookies']['value'] == 'session'; |
1355 } | 1377 } |
1356 | 1378 |
1357 }; | 1379 }; |
1358 | 1380 |
1359 //Forward public APIs to private implementations. | 1381 //Forward public APIs to private implementations. |
1360 [ | 1382 [ |
1361 'addBluetoothDevice', | 1383 'addBluetoothDevice', |
1384 'getCurrentProfile', | |
1362 'getStartStopSyncButton', | 1385 'getStartStopSyncButton', |
1363 'hideBluetoothSettings', | 1386 'hideBluetoothSettings', |
1364 'removeCloudPrintConnectorSection', | 1387 'removeCloudPrintConnectorSection', |
1365 'removeBluetoothDevice', | 1388 'removeBluetoothDevice', |
1366 'setAutoOpenFileTypesDisplayed', | 1389 'setAutoOpenFileTypesDisplayed', |
1367 'setBackgroundModeCheckboxState', | 1390 'setBackgroundModeCheckboxState', |
1368 'setBluetoothState', | 1391 'setBluetoothState', |
1369 'setCheckRevocationCheckboxState', | 1392 'setCheckRevocationCheckboxState', |
1370 'setContentFilterSettingsValue', | 1393 'setContentFilterSettingsValue', |
1371 'setFontSize', | 1394 'setFontSize', |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1408 BrowserOptions.getLoggedInUsername = function() { | 1431 BrowserOptions.getLoggedInUsername = function() { |
1409 return BrowserOptions.getInstance().username_; | 1432 return BrowserOptions.getInstance().username_; |
1410 }; | 1433 }; |
1411 } | 1434 } |
1412 | 1435 |
1413 // Export | 1436 // Export |
1414 return { | 1437 return { |
1415 BrowserOptions: BrowserOptions | 1438 BrowserOptions: BrowserOptions |
1416 }; | 1439 }; |
1417 }); | 1440 }); |
OLD | NEW |