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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_popup_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/debugger/devtools_window.h" 9 #include "chrome/browser/debugger/devtools_window.h"
10 #include "chrome/browser/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 NSWindow* window = [self window]; 164 NSWindow* window = [self window];
165 DCHECK_EQ([notification object], window); 165 DCHECK_EQ([notification object], window);
166 // If the window isn't visible, it is already closed, and this notification 166 // If the window isn't visible, it is already closed, and this notification
167 // has been sent as part of the closing operation, so no need to close. 167 // has been sent as part of the closing operation, so no need to close.
168 if ([window isVisible] && !beingInspected_) { 168 if ([window isVisible] && !beingInspected_) {
169 [self close]; 169 [self close];
170 } 170 }
171 } 171 }
172 172
173 - (void)close { 173 - (void)close {
174 [parentWindow_ removeChildWindow:[self window]]; 174 [[[self window] parentWindow] removeChildWindow:[self window]];
175
176 // No longer have a parent window, so nil out the pointer and deregister for
177 // notifications.
178 NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
179 [center removeObserver:self
180 name:NSWindowWillCloseNotification
181 object:parentWindow_];
182 parentWindow_ = nil;
183 [super close]; 175 [super close];
184 } 176 }
185 177
186 - (BOOL)isClosing { 178 - (BOOL)isClosing {
187 return [static_cast<InfoBubbleWindow*>([self window]) isClosing]; 179 return [static_cast<InfoBubbleWindow*>([self window]) isClosing];
188 } 180 }
189 181
190 - (ExtensionHost*)extensionHost { 182 - (ExtensionHost*)extensionHost {
191 return host_.get(); 183 return host_.get();
192 } 184 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 return minSize; 322 return minSize;
331 } 323 }
332 324
333 // Private (TestingAPI) 325 // Private (TestingAPI)
334 + (NSSize)maxPopupSize { 326 + (NSSize)maxPopupSize {
335 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; 327 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight};
336 return maxSize; 328 return maxSize;
337 } 329 }
338 330
339 @end 331 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698