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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 99238: Add notification (and unit test) for closing prefs window so it can be cleane... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « chrome/app/nibs/en.lproj/Preferences.xib ('k') | chrome/browser/cocoa/preferences_window_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/app_controller_mac.mm
===================================================================
--- chrome/browser/app_controller_mac.mm (revision 14958)
+++ chrome/browser/app_controller_mac.mm (working copy)
@@ -232,6 +232,13 @@
OpenURLs(gurlVector);
}
+// Called when the preferences window is closed. We use this to release the
+// window controller.
+- (void)prefsWindowClosed:(NSNotification*)notify {
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ prefsController_.reset(NULL);
+}
+
// Show the preferences window, or bring it to the front if it's already
// visible.
- (IBAction)showPreferences:(id)sender {
@@ -239,6 +246,13 @@
PrefService* prefs = [self defaultProfile]->GetPrefs();
prefsController_.reset([[PreferencesWindowController alloc]
initWithPrefs:prefs]);
+ // Watch for a notification of when it goes away so that we can destroy
+ // the controller.
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(prefsWindowClosed:)
+ name:kUserDoneEditingPrefsNotification
+ object:prefsController_.get()];
}
[prefsController_ showPreferences:sender];
}
« no previous file with comments | « chrome/app/nibs/en.lproj/Preferences.xib ('k') | chrome/browser/cocoa/preferences_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698