Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: chrome/browser/resources/options2/browser_options.js

Issue 10579026: Fix edit profile link in NTP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more nits Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/options2/manage_profile_overlay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options2/browser_options.js
diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js
index 25960742b87d9ae597255218f5059d5864621212..a36efd0b5569a8be0d8d70407d35954fef8b29e6 100644
--- a/chrome/browser/resources/options2/browser_options.js
+++ b/chrome/browser/resources/options2/browser_options.js
@@ -248,9 +248,7 @@ cr.define('options', function() {
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_();
@@ -1019,11 +1017,35 @@ cr.define('options', function() {
// 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++) {
Dan Beam 2012/06/20 22:13:51 var model = $('profiles-list').dataModel; // re-us
Evan Stade 2012/06/20 22:16:16 only twice, don't think it's worth it.
+ 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;
@@ -1370,6 +1392,7 @@ cr.define('options', function() {
//Forward public APIs to private implementations.
[
'addBluetoothDevice',
+ 'getCurrentProfile',
'getStartStopSyncButton',
'hideBluetoothSettings',
'removeCloudPrintConnectorSection',
« no previous file with comments | « no previous file | chrome/browser/resources/options2/manage_profile_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698