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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 // Give beforeunload handlers the chance to cancel the close before we hide 538 // Give beforeunload handlers the chance to cancel the close before we hide
539 // the window below. 539 // the window below.
540 if (!browser_->ShouldCloseWindow()) 540 if (!browser_->ShouldCloseWindow())
541 return NO; 541 return NO;
542 542
543 // saveWindowPositionIfNeeded: only works if we are the last active 543 // saveWindowPositionIfNeeded: only works if we are the last active
544 // window, but orderOut: ends up activating another window, so we 544 // window, but orderOut: ends up activating another window, so we
545 // have to save the window position before we call orderOut:. 545 // have to save the window position before we call orderOut:.
546 [self saveWindowPositionIfNeeded]; 546 [self saveWindowPositionIfNeeded];
547 547
548 // Ensure focus goes to previous active browser window when this
549 // window is ordered out.
550 [BrowserWindowUtils selectPreviousActiveBrowserWindow:browser_.get()];
551
548 if (!browser_->tabstrip_model()->empty()) { 552 if (!browser_->tabstrip_model()->empty()) {
549 // Tab strip isn't empty. Hide the frame (so it appears to have closed 553 // Tab strip isn't empty. Hide the frame (so it appears to have closed
550 // immediately) and close all the tabs, allowing the renderers to shut 554 // immediately) and close all the tabs, allowing the renderers to shut
551 // down. When the tab strip is empty we'll be called back again. 555 // down. When the tab strip is empty we'll be called back again.
552 [[self window] orderOut:self]; 556 [[self window] orderOut:self];
553 browser_->OnWindowClosing(); 557 browser_->OnWindowClosing();
554 return NO; 558 return NO;
555 } 559 }
556 560
557 // the tab strip is empty, it's ok to close the window 561 // the tab strip is empty, it's ok to close the window
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 2139
2136 - (BOOL)supportsBookmarkBar { 2140 - (BOOL)supportsBookmarkBar {
2137 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2141 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2138 } 2142 }
2139 2143
2140 - (BOOL)isTabbedWindow { 2144 - (BOOL)isTabbedWindow {
2141 return browser_->is_type_tabbed(); 2145 return browser_->is_type_tabbed();
2142 } 2146 }
2143 2147
2144 @end // @implementation BrowserWindowController(WindowType) 2148 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698