summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_view.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 21:30:31 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-25 21:30:31 +0000
commitd4e72a0a7f1087853e704e6a7cbebfdaf8ccdbca (patch)
treea2daddbe92622a6d0177b057ce1d9eab67f09a60 /chrome/browser/cocoa/tab_view.mm
parentd351c9065715a3a989c8ecc322306d457e843780 (diff)
downloadchromium_src-d4e72a0a7f1087853e704e6a7cbebfdaf8ccdbca.zip
chromium_src-d4e72a0a7f1087853e704e6a7cbebfdaf8ccdbca.tar.gz
chromium_src-d4e72a0a7f1087853e704e6a7cbebfdaf8ccdbca.tar.bz2
[Mac] Add methods to prevent tab detaching or window moving if needed. Modify tab view to respect these new settings. Prereq for fullscreen.
(Changes really made by viettrungluu@chromium.org.) BUG=31638 TEST=Tab dragging and window moving should still work when not in fullscreen mode. Review URL: http://codereview.chromium.org/554064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_view.mm')
-rw-r--r--chrome/browser/cocoa/tab_view.mm17
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index d97b6b3..8167071 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -317,11 +317,13 @@ const CGFloat kRapidCloseDist = 2.5;
- (void)mouseDragged:(NSEvent*)theEvent {
// Special-case this to keep the logic below simpler.
if (moveWindowOnDrag_) {
- NSPoint thisPoint = [NSEvent mouseLocation];
- NSPoint origin = sourceWindowFrame_.origin;
- origin.x += (thisPoint.x - dragOrigin_.x);
- origin.y += (thisPoint.y - dragOrigin_.y);
- [sourceWindow_ setFrameOrigin:NSMakePoint(origin.x, origin.y)];
+ if ([sourceController_ windowMovementAllowed]) {
+ NSPoint thisPoint = [NSEvent mouseLocation];
+ NSPoint origin = sourceWindowFrame_.origin;
+ origin.x += (thisPoint.x - dragOrigin_.x);
+ origin.y += (thisPoint.y - dragOrigin_.y);
+ [sourceWindow_ setFrameOrigin:NSMakePoint(origin.x, origin.y)];
+ } // else do nothing.
return;
}
@@ -346,7 +348,8 @@ const CGFloat kRapidCloseDist = 2.5;
// strip that would cause it to no longer be fully visible.
BOOL stillVisible = [sourceController_ isTabFullyVisible:self];
CGFloat tearForce = fabs(thisPoint.y - dragOrigin_.y);
- if (tearForce > kTearDistance || !stillVisible) {
+ if ([sourceController_ tabTearingAllowed] &&
+ (tearForce > kTearDistance || !stillVisible)) {
draggingWithinTabStrip_ = NO;
// When you finally leave the strip, we treat that as the origin.
dragOrigin_.x = thisPoint.x;