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

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

Issue 1881093002: Implement Tab Detaching in Fullscreen Mode on Mac OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add to the histogram Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 origin.x = (1 - tearProgress) * tearOrigin_.x + tearProgress * origin.x; 358 origin.x = (1 - tearProgress) * tearOrigin_.x + tearProgress * origin.x;
359 origin.y = (1 - tearProgress) * tearOrigin_.y + tearProgress * origin.y; 359 origin.y = (1 - tearProgress) * tearOrigin_.y + tearProgress * origin.y;
360 } 360 }
361 361
362 if (targetController_) { 362 if (targetController_) {
363 // In order to "snap" two windows of different sizes together at their 363 // In order to "snap" two windows of different sizes together at their
364 // toolbar, we can't just use the origin of the target frame. We also have 364 // toolbar, we can't just use the origin of the target frame. We also have
365 // to take into consideration the difference in height. 365 // to take into consideration the difference in height.
366 NSRect targetFrame = [[targetController_ window] frame]; 366 NSRect targetFrame = [[targetController_ window] frame];
367 NSRect sourceFrame = [dragWindow_ frame]; 367 NSRect sourceFrame = [dragWindow_ frame];
368 origin.y = NSMinY(targetFrame) + 368 origin.y = NSMinY(targetFrame) + [targetController_ menubarOffset] +
369 (NSHeight(targetFrame) - NSHeight(sourceFrame)); 369 (NSHeight(targetFrame) - NSHeight(sourceFrame));
370 } 370 }
371 [dragWindow_ setFrameOrigin: 371 [dragWindow_ setFrameOrigin:
372 NSMakePoint(origin.x + horizDragOffset_, origin.y)]; 372 NSMakePoint(origin.x + horizDragOffset_, origin.y)];
373 373
374 // If we're not hovering over any window, make the window fully 374 // If we're not hovering over any window, make the window fully
375 // opaque. Otherwise, find where the tab might be dropped and insert 375 // opaque. Otherwise, find where the tab might be dropped and insert
376 // a placeholder so it appears like it's part of that window. 376 // a placeholder so it appears like it's part of that window.
377 if (targetController_) { 377 if (targetController_) {
378 if (![[targetController_ window] isKeyWindow]) 378 if (![[targetController_ window] isKeyWindow])
379 [[targetController_ window] orderFront:nil]; 379 [[targetController_ window] orderFront:nil];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // into any existing window. 439 // into any existing window.
440 [targetController_ moveTabViews:[draggedController_ tabViews] 440 [targetController_ moveTabViews:[draggedController_ tabViews]
441 fromController:draggedController_]; 441 fromController:draggedController_];
442 // Force redraw to avoid flashes of old content before returning to event 442 // Force redraw to avoid flashes of old content before returning to event
443 // loop. 443 // loop.
444 [[targetController_ window] display]; 444 [[targetController_ window] display];
445 [targetController_ showWindow:nil]; 445 [targetController_ showWindow:nil];
446 [draggedController_ removeOverlay]; 446 [draggedController_ removeOverlay];
447 } else { 447 } else {
448 // Only move the window around on screen. Make sure it's set back to 448 // Only move the window around on screen. Make sure it's set back to
449 // normal state (fully opaque, has shadow, has key, etc). 449 // normal state (fully opaque, has shadow, has key, in fullscreen if
450 // appropriate, etc).
451 [draggedController_
452 detachedWindowEnterFullscreenIfNeeded:sourceController_];
453
450 [draggedController_ removeOverlay]; 454 [draggedController_ removeOverlay];
451 // Don't want to re-show the window if it was closed during the drag. 455 // Don't want to re-show the window if it was closed during the drag.
452 if ([dragWindow_ isVisible]) { 456 if ([dragWindow_ isVisible]) {
453 [dragWindow_ setAlphaValue:1.0]; 457 [dragWindow_ setAlphaValue:1.0];
454 [dragOverlay_ setHasShadow:NO]; 458 [dragOverlay_ setHasShadow:NO];
455 [dragWindow_ setHasShadow:YES]; 459 [dragWindow_ setHasShadow:YES];
456 [dragWindow_ makeKeyAndOrderFront:nil]; 460 [dragWindow_ makeKeyAndOrderFront:nil];
457 } 461 }
458 [[draggedController_ window] setLevel:NSNormalWindowLevel]; 462 [[draggedController_ window] setLevel:NSNormalWindowLevel];
459 [draggedController_ removePlaceholder]; 463 [draggedController_ removePlaceholder];
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 [[targetController_ window] makeMainWindow]; 559 [[targetController_ window] makeMainWindow];
556 } else { 560 } else {
557 [dragWindow_ setAlphaValue:0.5]; 561 [dragWindow_ setAlphaValue:0.5];
558 [[draggedController_ overlayWindow] setHasShadow:NO]; 562 [[draggedController_ overlayWindow] setHasShadow:NO];
559 [[draggedController_ window] makeMainWindow]; 563 [[draggedController_ window] makeMainWindow];
560 } 564 }
561 chromeIsVisible_ = shouldBeVisible; 565 chromeIsVisible_ = shouldBeVisible;
562 } 566 }
563 567
564 @end 568 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698