Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| index 9ad67b9fb8c781684f130528a948488e5681b892..59441b141c703d6ebe478195b367a8df9017ad0f 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| @@ -84,7 +84,7 @@ BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, |
| BrowserWindowCocoa::~BrowserWindowCocoa() { |
| } |
| -void BrowserWindowCocoa::Show() { |
| +void BrowserWindowCocoa::Show(BrowserWindow::ShowContext show_context) { |
| // The Browser associated with this browser window must become the active |
| // browser at the time |Show()| is called. This is the natural behaviour under |
| // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:| |
| @@ -93,30 +93,32 @@ void BrowserWindowCocoa::Show() { |
| // the previous browser instead if we don't explicitly set it here. |
| BrowserList::SetLastActive(browser_); |
| - ui::WindowShowState show_state = browser_->GetSavedWindowShowState(); |
| - if (show_state == ui::SHOW_STATE_MINIMIZED) { |
| - // Turn off swishing when restoring minimized windows. When creating |
| - // windows from nibs it is necessary to |orderFront:| prior to |orderOut:| |
| - // then |miniaturize:| when restoring windows in the minimized state. |
| - NSWindowAnimationBehavior savedAnimationBehavior = 0; |
| + NSWindowAnimationBehavior savedAnimationBehavior = 0; |
|
Mark Mentovai
2011/08/31 16:20:49
Style nit: you’re supposed to use saved_animation_
dhollowa
2011/08/31 17:05:11
Done.
|
| + if (show_context == BrowserWindow::SHOW_CONTEXT_RESTORE) { |
| + // Turn off swishing when restoring windows. |
| if ([window() respondsToSelector:@selector(animationBehavior)] && |
|
Mark Mentovai
2011/08/31 16:20:49
Fold these conditions into the same |if| that encl
dhollowa
2011/08/31 17:05:11
Done.
|
| [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| savedAnimationBehavior = [window() animationBehavior]; |
| [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; |
| } |
| + } |
| - [window() makeKeyAndOrderFront:controller_]; |
| + [window() makeKeyAndOrderFront:controller_]; |
| + // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| |
| + // prior to |orderOut:| then |miniaturize:| when restoring windows in the |
| + // minimized state. |
| + if (browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MINIMIZED) { |
| [window() orderOut:controller_]; |
| [window() miniaturize:controller_]; |
| + } |
| + if (show_context == BrowserWindow::SHOW_CONTEXT_RESTORE) { |
| // Restore window animation behavior. |
| if ([window() respondsToSelector:@selector(animationBehavior)] && |
|
Mark Mentovai
2011/08/31 16:20:49
Rather than doing this check, and maybe the one th
dhollowa
2011/08/31 17:05:11
Done. Nice, yes. And I've done the same in drag-
|
| [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| [window() setAnimationBehavior:savedAnimationBehavior]; |
| } |
| - } else { |
| - [window() makeKeyAndOrderFront:controller_]; |
| } |
| } |