OLD | NEW |
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 [self terminateBoundsAnimation]; | 362 [self terminateBoundsAnimation]; |
363 animateOnBoundsChange_ = NO; | 363 animateOnBoundsChange_ = NO; |
364 // Tab strip isn't empty. Make browser to close all the tabs, allowing the | 364 // Tab strip isn't empty. Make browser to close all the tabs, allowing the |
365 // renderer to shut down and call us back again. | 365 // renderer to shut down and call us back again. |
366 // The tab strip of Panel is not visible and contains only one tab but | 366 // The tab strip of Panel is not visible and contains only one tab but |
367 // it still has to be closed. | 367 // it still has to be closed. |
368 browser->OnWindowClosing(); | 368 browser->OnWindowClosing(); |
369 return NO; | 369 return NO; |
370 } | 370 } |
371 | 371 |
372 // The tab strip is empty, it's ok to close the window. | 372 // the tab strip is empty, it's ok to close the window |
373 // Ensure focus goes to previous active browser window. | |
374 [BrowserWindowUtils selectPreviousActiveBrowserWindow:browser]; | |
375 return YES; | 373 return YES; |
376 } | 374 } |
377 | 375 |
378 // When windowShouldClose returns YES (or if controller receives direct 'close' | 376 // When windowShouldClose returns YES (or if controller receives direct 'close' |
379 // signal), window will be unconditionally closed. Clean up. | 377 // signal), window will be unconditionally closed. Clean up. |
380 - (void)windowWillClose:(NSNotification*)notification { | 378 - (void)windowWillClose:(NSNotification*)notification { |
381 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); | 379 DCHECK(windowShim_->browser()->tabstrip_model()->empty()); |
382 // Avoid callbacks from a nonblocking animation in progress, if any. | 380 // Avoid callbacks from a nonblocking animation in progress, if any. |
383 [self terminateBoundsAnimation]; | 381 [self terminateBoundsAnimation]; |
384 windowShim_->DidCloseNativeWindow(); | 382 windowShim_->DidCloseNativeWindow(); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 } | 642 } |
645 | 643 |
646 - (BOOL)canBecomeKeyWindow { | 644 - (BOOL)canBecomeKeyWindow { |
647 // Panel can only gain focus if it is expanded. Minimized panels do not | 645 // Panel can only gain focus if it is expanded. Minimized panels do not |
648 // participate in Cmd-~ rotation. | 646 // participate in Cmd-~ rotation. |
649 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 647 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
650 // keyboard navigation or via main menu, the care should be taken to avoid | 648 // keyboard navigation or via main menu, the care should be taken to avoid |
651 // cases when minimized Panel is getting keyboard input, invisibly. | 649 // cases when minimized Panel is getting keyboard input, invisibly. |
652 return canBecomeKeyWindow_; | 650 return canBecomeKeyWindow_; |
653 } | 651 } |
| 652 |
654 @end | 653 @end |
OLD | NEW |