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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm

Issue 7809013: Remove Animation When "Resuming" Window in Lion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clear flag at session_restore level. Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.h"
6 6
7 #import "base/mac/mac_util.h" 7 #import "base/mac/mac_util.h"
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h" 9 #import "chrome/browser/ui/cocoa/tabs/tab_controller.h"
10 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h" 10 #import "chrome/browser/ui/cocoa/tabs/tab_controller_target.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 [sourceController_ detachTabToNewWindow:[draggedTab_ tabView]]; 257 [sourceController_ detachTabToNewWindow:[draggedTab_ tabView]];
258 dragWindow_ = [draggedController_ window]; 258 dragWindow_ = [draggedController_ window];
259 [dragWindow_ setAlphaValue:0.0]; 259 [dragWindow_ setAlphaValue:0.0];
260 if (![sourceController_ hasLiveTabs]) { 260 if (![sourceController_ hasLiveTabs]) {
261 sourceController_ = draggedController_; 261 sourceController_ = draggedController_;
262 sourceWindow_ = dragWindow_; 262 sourceWindow_ = dragWindow_;
263 } 263 }
264 264
265 // Disable window animation before calling |orderFront:| when detatching 265 // Disable window animation before calling |orderFront:| when detatching
266 // to a new window. 266 // to a new window.
267 NSWindowAnimationBehavior savedAnimationBehavior = 0; 267 NSWindowAnimationBehavior savedAnimationBehavior = 0;
Mark Mentovai 2011/08/31 18:47:01 Get rid of the initializer like you did in the oth
dhollowa 2011/08/31 18:57:17 Done.
268 bool didSaveAnimationBehavior = false;
268 if ([dragWindow_ respondsToSelector:@selector(animationBehavior)] && 269 if ([dragWindow_ respondsToSelector:@selector(animationBehavior)] &&
269 [dragWindow_ respondsToSelector:@selector(setAnimationBehavior:)]) { 270 [dragWindow_ respondsToSelector:@selector(setAnimationBehavior:)]) {
270 savedAnimationBehavior = [dragWindow_ animationBehavior]; 271 savedAnimationBehavior = [dragWindow_ animationBehavior];
271 [dragWindow_ setAnimationBehavior:NSWindowAnimationBehaviorNone]; 272 [dragWindow_ setAnimationBehavior:NSWindowAnimationBehaviorNone];
273 didSaveAnimationBehavior = true;
Mark Mentovai 2011/08/31 18:47:01 Move this one up like you did in the other file.
dhollowa 2011/08/31 18:57:17 Done.
272 } 274 }
273 275
274 // If dragging the tab only moves the current window, do not show overlay 276 // If dragging the tab only moves the current window, do not show overlay
275 // so that sheets stay on top of the window. 277 // so that sheets stay on top of the window.
276 // Bring the target window to the front and make sure it has a border. 278 // Bring the target window to the front and make sure it has a border.
277 [dragWindow_ setLevel:NSFloatingWindowLevel]; 279 [dragWindow_ setLevel:NSFloatingWindowLevel];
278 [dragWindow_ setHasShadow:YES]; 280 [dragWindow_ setHasShadow:YES];
279 [dragWindow_ orderFront:nil]; 281 [dragWindow_ orderFront:nil];
280 [dragWindow_ makeMainWindow]; 282 [dragWindow_ makeMainWindow];
281 [draggedController_ showOverlay]; 283 [draggedController_ showOverlay];
282 dragOverlay_ = [draggedController_ overlayWindow]; 284 dragOverlay_ = [draggedController_ overlayWindow];
283 // Force the new tab button to be hidden. We'll reset it on mouse up. 285 // Force the new tab button to be hidden. We'll reset it on mouse up.
284 [draggedController_ showNewTabButton:NO]; 286 [draggedController_ showNewTabButton:NO];
285 tearTime_ = [NSDate timeIntervalSinceReferenceDate]; 287 tearTime_ = [NSDate timeIntervalSinceReferenceDate];
286 tearOrigin_ = sourceWindowFrame_.origin; 288 tearOrigin_ = sourceWindowFrame_.origin;
287 289
288 // Restore window animation behavior 290 // Restore window animation behavior.
289 if ([dragWindow_ respondsToSelector:@selector(animationBehavior)] && 291 if (didSaveAnimationBehavior)
290 [dragWindow_ respondsToSelector:@selector(setAnimationBehavior:)]) {
291 [dragWindow_ setAnimationBehavior:savedAnimationBehavior]; 292 [dragWindow_ setAnimationBehavior:savedAnimationBehavior];
292 }
293 } 293 }
294 294
295 // TODO(pinkerton): http://crbug.com/25682 demonstrates a way to get here by 295 // TODO(pinkerton): http://crbug.com/25682 demonstrates a way to get here by
296 // some weird circumstance that doesn't first go through mouseDown:. We 296 // some weird circumstance that doesn't first go through mouseDown:. We
297 // really shouldn't go any farther. 297 // really shouldn't go any farther.
298 if (!draggedController_ || !sourceController_) 298 if (!draggedController_ || !sourceController_)
299 return; 299 return;
300 300
301 // When the user first tears off the window, we want slide the window to 301 // When the user first tears off the window, we want slide the window to
302 // the current mouse location (to reduce the jarring appearance). We do this 302 // the current mouse location (to reduce the jarring appearance). We do this
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 NOTREACHED(); 549 NOTREACHED();
550 } 550 }
551 } 551 }
552 if (useCache) { 552 if (useCache) {
553 workspaceIDCache_[windowID] = workspace; 553 workspaceIDCache_[windowID] = workspace;
554 } 554 }
555 return workspace; 555 return workspace;
556 } 556 }
557 557
558 @end 558 @end
OLDNEW
« chrome/browser/ui/browser.h ('K') | « chrome/browser/ui/cocoa/browser_window_cocoa.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698