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..ea410b2b18f772e210d4801da8c6041442090105 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| @@ -92,31 +92,31 @@ 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; |
|
Nico
2011/09/01 16:28:41
In gcc release builds (which is what the valgrind
|
| + bool did_save_animation_behavior = false; |
| + // Turn off swishing when restoring windows. |
| + if (is_session_restore && |
| + [window() respondsToSelector:@selector(animationBehavior)] && |
| + [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| + did_save_animation_behavior = true; |
| + saved_animation_behavior = [window() animationBehavior]; |
| + [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; |
| + } |
| + |
| + [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_]; |
| - |
| - // Restore window animation behavior. |
| - if ([window() respondsToSelector:@selector(animationBehavior)] && |
| - [window() respondsToSelector:@selector(setAnimationBehavior:)]) { |
| - [window() setAnimationBehavior:savedAnimationBehavior]; |
| - } |
| - } else { |
| - [window() makeKeyAndOrderFront:controller_]; |
| } |
| + |
| + // Restore window animation behavior. |
| + if (did_save_animation_behavior) |
| + [window() setAnimationBehavior:saved_animation_behavior]; |
| } |
| void BrowserWindowCocoa::ShowInactive() { |