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

Unified Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm

Issue 7740060: [Mac] Tear down extension-installed bubble before main window closes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the leaked notification. Created 9 years, 3 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
Index: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
index 6099ccf0c6973765bdbcb37257a249587f08211f..e0df44eb0f25665c47f0a3b09dbc9e1620b63b00 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
@@ -107,6 +107,13 @@ class ExtensionLoadedNotificationObserver : public NotificationObserver {
// Start showing window only after extension has fully loaded.
extensionObserver_.reset(new ExtensionLoadedNotificationObserver(
self, browser->profile()));
+
+ // Watch to see if the parent window closes, and if so, close this one.
+ NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
+ [center addObserver:self
+ selector:@selector(parentWindowWillClose:)
+ name:NSWindowWillCloseNotification
+ object:parentWindow_];
}
return self;
}
@@ -117,10 +124,14 @@ class ExtensionLoadedNotificationObserver : public NotificationObserver {
}
- (void)close {
- [parentWindow_ removeChildWindow:[self window]];
+ [[[self window] parentWindow] removeChildWindow:[self window]];
[super close];
}
+- (void)parentWindowWillClose:(NSNotification*)notification {
+ [self close];
+}
+
- (void)windowWillClose:(NSNotification*)notification {
// Turn off page action icon preview when the window closes, unless we
// already removed it when the window resigned key status.

Powered by Google App Engine
This is Rietveld 408576698