Index: chrome/browser/resources/options2/browser_options.js |
=================================================================== |
--- chrome/browser/resources/options2/browser_options.js (revision 145236) |
+++ chrome/browser/resources/options2/browser_options.js (working copy) |
@@ -237,9 +237,7 @@ |
chrome.send('createProfile'); |
}; |
$('profiles-manage').onclick = function(event) { |
- var selectedProfile = self.getSelectedProfileItem_(); |
- if (selectedProfile) |
- ManageProfileOverlay.showManageDialog(selectedProfile); |
+ ManageProfileOverlay.showManageDialog(); |
}; |
$('profiles-delete').onclick = function(event) { |
var selectedProfile = self.getSelectedProfileItem_(); |
@@ -1008,11 +1006,35 @@ |
// add it to the list, even if the list is hidden so we can access it |
// later. |
$('profiles-list').dataModel = new ArrayDataModel(profiles); |
- // We got new data, close the open overlay if it's open. |
- ManageProfileOverlay.getInstance().visible = false; |
+ |
+ // Received new data. If showing the "manage" overlay, keep it up to |
+ // date. If showing the "delete" overlay, close it. |
+ if (ManageProfileOverlay.getInstance().visible && |
+ !$('manage-profile-overlay-manage').hidden) { |
+ ManageProfileOverlay.showManageDialog(); |
+ } else { |
+ ManageProfileOverlay.getInstance().visible = false; |
+ } |
+ |
this.setProfileViewButtonsStatus_(); |
}, |
+ /** |
+ * Returns the currently active profile for this browser window. |
+ * @return {Object} A profile info object. |
+ * @private |
+ */ |
+ getCurrentProfile_: function() { |
+ for (var i = 0; i < $('profiles-list').dataModel.length; i++) { |
+ var profile = $('profiles-list').dataModel.item(i); |
+ if (profile.isCurrentProfile) |
+ return profile; |
+ } |
+ |
+ assert(false, |
+ 'There should always be a current profile, but none found.'); |
+ }, |
+ |
setGtkThemeButtonEnabled_: function(enabled) { |
if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) |
$('themes-GTK-button').disabled = !enabled; |
@@ -1359,6 +1381,7 @@ |
//Forward public APIs to private implementations. |
[ |
'addBluetoothDevice', |
+ 'getCurrentProfile', |
'getStartStopSyncButton', |
'hideBluetoothSettings', |
'removeCloudPrintConnectorSection', |