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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 9310075: Ensure the previously active browser window gets the focus after a browser window is closed on OSX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate return to its own line Created 8 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 [window() setFrame:cocoa_bounds display:YES]; 146 [window() setFrame:cocoa_bounds display:YES];
147 } 147 }
148 148
149 // Callers assume that this doesn't immediately delete the Browser object. 149 // Callers assume that this doesn't immediately delete the Browser object.
150 // The controller implementing the window delegate methods called from 150 // The controller implementing the window delegate methods called from
151 // |-performClose:| must take precautions to ensure that. 151 // |-performClose:| must take precautions to ensure that.
152 void BrowserWindowCocoa::Close() { 152 void BrowserWindowCocoa::Close() {
153 // If there is an overlay window, we contain a tab being dragged between 153 // If there is an overlay window, we contain a tab being dragged between
154 // windows. Don't hide the window as it makes the UI extra confused. We can 154 // windows. Don't hide the window as it makes the UI extra confused. We can
155 // still close the window, as that will happen when the drag completes. 155 // still close the window, as that will happen when the drag completes.
156 if ([controller_ overlayWindow]) { 156 if ([controller_ overlayWindow])
157 [controller_ deferPerformClose]; 157 [controller_ deferPerformClose];
158 } else { 158 else
159 // Make sure we hide the window immediately. Even though performClose:
160 // calls orderOut: eventually, it leaves the window on-screen long enough
161 // that we start to see tabs shutting down. http://crbug.com/23959
162 // TODO(viettrungluu): This is kind of bad, since |-performClose:| calls
163 // |-windowShouldClose:| (on its delegate, which is probably the
164 // controller) which may return |NO| causing the window to not be closed,
165 // thereby leaving a hidden window. In fact, our window-closing procedure
166 // involves a (indirect) recursion on |-performClose:|, which is also bad.
167 [window() orderOut:controller_];
168 [window() performClose:controller_]; 159 [window() performClose:controller_];
169 }
170 } 160 }
171 161
172 void BrowserWindowCocoa::Activate() { 162 void BrowserWindowCocoa::Activate() {
173 [controller_ activate]; 163 [controller_ activate];
174 } 164 }
175 165
176 void BrowserWindowCocoa::Deactivate() { 166 void BrowserWindowCocoa::Deactivate() {
177 // TODO(jcivelli): http://crbug.com/51364 Implement me. 167 // TODO(jcivelli): http://crbug.com/51364 Implement me.
178 NOTIMPLEMENTED(); 168 NOTIMPLEMENTED();
179 } 169 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 AvatarMenuBubbleController* menu = 619 AvatarMenuBubbleController* menu =
630 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ 620 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_
631 anchoredAt:point]; 621 anchoredAt:point];
632 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge]; 622 [[menu bubble] setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
633 [menu showWindow:nil]; 623 [menu showWindow:nil];
634 } 624 }
635 625
636 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() { 626 void BrowserWindowCocoa::ShowAvatarBubbleFromAvatarButton() {
637 [[controller_ avatarButtonController] showAvatarBubble]; 627 [[controller_ avatarButtonController] showAvatarBubble];
638 } 628 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/browser_window_controller.mm » ('j') | chrome/browser/ui/cocoa/browser_window_utils.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698