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

Side by Side Diff: chrome/browser/ui/panels/panel_window_controller_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/panels/panel_window_controller_cocoa.h" 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 [self terminateBoundsAnimation]; 354 [self terminateBoundsAnimation];
355 animateOnBoundsChange_ = NO; 355 animateOnBoundsChange_ = NO;
356 // Tab strip isn't empty. Make browser to close all the tabs, allowing the 356 // Tab strip isn't empty. Make browser to close all the tabs, allowing the
357 // renderer to shut down and call us back again. 357 // renderer to shut down and call us back again.
358 // The tab strip of Panel is not visible and contains only one tab but 358 // The tab strip of Panel is not visible and contains only one tab but
359 // it still has to be closed. 359 // it still has to be closed.
360 browser->OnWindowClosing(); 360 browser->OnWindowClosing();
361 return NO; 361 return NO;
362 } 362 }
363 363
364 // the tab strip is empty, it's ok to close the window 364 // The tab strip is empty, it's ok to close the window.
365 // Ensure focus goes to previous active browser window.
366 [BrowserWindowUtils selectPreviousActiveBrowserWindow:browser];
365 return YES; 367 return YES;
366 } 368 }
367 369
368 // When windowShouldClose returns YES (or if controller receives direct 'close' 370 // When windowShouldClose returns YES (or if controller receives direct 'close'
369 // signal), window will be unconditionally closed. Clean up. 371 // signal), window will be unconditionally closed. Clean up.
370 - (void)windowWillClose:(NSNotification*)notification { 372 - (void)windowWillClose:(NSNotification*)notification {
371 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); 373 DCHECK(windowShim_->browser()->tabstrip_model()->empty());
372 // Avoid callbacks from a nonblocking animation in progress, if any. 374 // Avoid callbacks from a nonblocking animation in progress, if any.
373 [self terminateBoundsAnimation]; 375 [self terminateBoundsAnimation];
374 windowShim_->DidCloseNativeWindow(); 376 windowShim_->DidCloseNativeWindow();
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 604 }
603 605
604 - (BOOL)canBecomeKeyWindow { 606 - (BOOL)canBecomeKeyWindow {
605 // Panel can only gain focus if it is expanded. Minimized panels do not 607 // Panel can only gain focus if it is expanded. Minimized panels do not
606 // participate in Cmd-~ rotation. 608 // participate in Cmd-~ rotation.
607 // TODO(dimich): If it will be ever desired to expand/focus the Panel on 609 // TODO(dimich): If it will be ever desired to expand/focus the Panel on
608 // keyboard navigation or via main menu, the care should be taken to avoid 610 // keyboard navigation or via main menu, the care should be taken to avoid
609 // cases when minimized Panel is getting keyboard input, invisibly. 611 // cases when minimized Panel is getting keyboard input, invisibly.
610 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; 612 return windowShim_->panel()->expansion_state() == Panel::EXPANDED;
611 } 613 }
612
613 @end 614 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698