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

Side by Side Diff: chrome/browser/ui/cocoa/base_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm » ('j') | 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/base_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/memory/scoped_nsobject.h" 9 #include "base/memory/scoped_nsobject.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // position). We cannot have an addChildWindow: and a subsequent 150 // position). We cannot have an addChildWindow: and a subsequent
151 // showWindow:. Thus, we have our own version. 151 // showWindow:. Thus, we have our own version.
152 - (void)showWindow:(id)sender { 152 - (void)showWindow:(id)sender {
153 NSWindow* window = [self window]; // completes nib load 153 NSWindow* window = [self window]; // completes nib load
154 [self updateOriginFromAnchor]; 154 [self updateOriginFromAnchor];
155 [parentWindow_ addChildWindow:window ordered:NSWindowAbove]; 155 [parentWindow_ addChildWindow:window ordered:NSWindowAbove];
156 [window makeKeyAndOrderFront:self]; 156 [window makeKeyAndOrderFront:self];
157 } 157 }
158 158
159 - (void)close { 159 - (void)close {
160 [parentWindow_ removeChildWindow:[self window]]; 160 [[[self window] parentWindow] removeChildWindow:[self window]];
161 [super close]; 161 [super close];
162 } 162 }
163 163
164 // The controller is the delegate of the window so it receives did resign key 164 // The controller is the delegate of the window so it receives did resign key
165 // notifications. When key is resigned mirror Windows behavior and close the 165 // notifications. When key is resigned mirror Windows behavior and close the
166 // window. 166 // window.
167 - (void)windowDidResignKey:(NSNotification*)notification { 167 - (void)windowDidResignKey:(NSNotification*)notification {
168 NSWindow* window = [self window]; 168 NSWindow* window = [self window];
169 DCHECK_EQ([notification object], window); 169 DCHECK_EQ([notification object], window);
170 if ([window isVisible]) { 170 if ([window isVisible]) {
(...skipping 20 matching lines...) Expand all
191 if ([bubble_ arrowLocation] == info_bubble::kTopRight) { 191 if ([bubble_ arrowLocation] == info_bubble::kTopRight) {
192 origin.x -= NSWidth([window frame]) - offsets.width; 192 origin.x -= NSWidth([window frame]) - offsets.width;
193 } else { 193 } else {
194 origin.x -= offsets.width; 194 origin.x -= offsets.width;
195 } 195 }
196 origin.y -= NSHeight([window frame]); 196 origin.y -= NSHeight([window frame]);
197 [window setFrameOrigin:origin]; 197 [window setFrameOrigin:origin];
198 } 198 }
199 199
200 @end // BaseBubbleController 200 @end // BaseBubbleController
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698