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

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

Issue 9692016: Revert 120593 - Ensure the previously active browser window gets the focus after a browser window i… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // Give beforeunload handlers the chance to cancel the close before we hide 540 // Give beforeunload handlers the chance to cancel the close before we hide
541 // the window below. 541 // the window below.
542 if (!browser_->ShouldCloseWindow()) 542 if (!browser_->ShouldCloseWindow())
543 return NO; 543 return NO;
544 544
545 // saveWindowPositionIfNeeded: only works if we are the last active 545 // saveWindowPositionIfNeeded: only works if we are the last active
546 // window, but orderOut: ends up activating another window, so we 546 // window, but orderOut: ends up activating another window, so we
547 // have to save the window position before we call orderOut:. 547 // have to save the window position before we call orderOut:.
548 [self saveWindowPositionIfNeeded]; 548 [self saveWindowPositionIfNeeded];
549 549
550 // Ensure focus goes to previous active browser window when this
551 // window is ordered out.
552 [BrowserWindowUtils selectPreviousActiveBrowserWindow:browser_.get()];
553
554 if (!browser_->tabstrip_model()->empty()) { 550 if (!browser_->tabstrip_model()->empty()) {
555 // Tab strip isn't empty. Hide the frame (so it appears to have closed 551 // Tab strip isn't empty. Hide the frame (so it appears to have closed
556 // immediately) and close all the tabs, allowing the renderers to shut 552 // immediately) and close all the tabs, allowing the renderers to shut
557 // down. When the tab strip is empty we'll be called back again. 553 // down. When the tab strip is empty we'll be called back again.
558 [[self window] orderOut:self]; 554 [[self window] orderOut:self];
559 browser_->OnWindowClosing(); 555 browser_->OnWindowClosing();
560 return NO; 556 return NO;
561 } 557 }
562 558
563 // the tab strip is empty, it's ok to close the window 559 // the tab strip is empty, it's ok to close the window
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 2163
2168 - (BOOL)supportsBookmarkBar { 2164 - (BOOL)supportsBookmarkBar {
2169 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2165 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2170 } 2166 }
2171 2167
2172 - (BOOL)isTabbedWindow { 2168 - (BOOL)isTabbedWindow {
2173 return browser_->is_type_tabbed(); 2169 return browser_->is_type_tabbed();
2174 } 2170 }
2175 2171
2176 @end // @implementation BrowserWindowController(WindowType) 2172 @end // @implementation BrowserWindowController(WindowType)
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | chrome/browser/ui/cocoa/browser_window_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698