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

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 7809013: Remove Animation When "Resuming" Window in Lion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addresses Marks comments, choosing Browser::is_session_restore flag approach. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698