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 cf51c3f46b0213f708bf1de62b0a8c39ed3ef9db..822ae246adb9e01b87f50af47198dcfc683dda28 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| @@ -92,31 +92,35 @@ 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; |
| - if ([window() respondsToSelector:@selector(animationBehavior)] && |
| - [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| - savedAnimationBehavior = [window() animationBehavior]; |
| - [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; |
| - } |
| - |
| - [window() makeKeyAndOrderFront:controller_]; |
| + bool is_session_restore = browser_->is_session_restore(); |
| + NSWindowAnimationBehavior saved_animation_behavior = 0; |
|
Mark Mentovai
2011/08/31 17:58:54
This no longer needs to be initialized to 0, since
dhollowa
2011/08/31 18:40:55
Done.
|
| + bool did_save_animation_behavior = false; |
| + // Turn off swishing when restoring windows. |
| + if (is_session_restore && |
| + [window() respondsToSelector:@selector(animationBehavior)] && |
| + [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| + saved_animation_behavior = [window() animationBehavior]; |
| + [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; |
| + did_save_animation_behavior = true; |
|
Mark Mentovai
2011/08/31 17:58:54
I would do this before changing the value, just be
dhollowa
2011/08/31 18:40:55
Done.
|
| + } |
| + |
| + [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 (did_save_animation_behavior) { |
| // Restore window animation behavior. |
| - if ([window() respondsToSelector:@selector(animationBehavior)] && |
| - [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| - [window() setAnimationBehavior:savedAnimationBehavior]; |
| - } |
| - } else { |
| - [window() makeKeyAndOrderFront:controller_]; |
| + [window() setAnimationBehavior:saved_animation_behavior]; |
| } |
| + |
| + // Once the window has been shown, clear the session restore flag. |
| + browser_->set_is_session_restore(false); |
|
Mark Mentovai
2011/08/31 17:58:54
This is the only platform on which this happens, r
dhollowa
2011/08/31 18:40:55
Yes, this is Mac-only logic. I agree though, this
|
| } |
| void BrowserWindowCocoa::ShowInactive() { |