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

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

Issue 6821003: [Mac] First pass at multiple selection in the tabstrip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 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 | 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_view.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // don't have to worry about mouse ups. 250 // don't have to worry about mouse ups.
251 if (closeButtonActive && [controller_ inRapidClosureMode]) { 251 if (closeButtonActive && [controller_ inRapidClosureMode]) {
252 NSPoint hitLocation = [[self superview] convertPoint:downLocation 252 NSPoint hitLocation = [[self superview] convertPoint:downLocation
253 fromView:nil]; 253 fromView:nil];
254 if ([self hitTest:hitLocation] == closeButton_) { 254 if ([self hitTest:hitLocation] == closeButton_) {
255 [closeButton_ mouseDown:theEvent]; 255 [closeButton_ mouseDown:theEvent];
256 return; 256 return;
257 } 257 }
258 } 258 }
259 259
260 // Fire the action to select the tab.
261 if ([[controller_ target] respondsToSelector:[controller_ action]])
262 [[controller_ target] performSelector:[controller_ action]
263 withObject:self];
264
265 [self resetDragControllers]; 260 [self resetDragControllers];
266 261
267 // Resolve overlay back to original window. 262 // Resolve overlay back to original window.
268 sourceWindow_ = [self window]; 263 sourceWindow_ = [self window];
269 if ([sourceWindow_ isKindOfClass:[NSPanel class]]) { 264 if ([sourceWindow_ isKindOfClass:[NSPanel class]]) {
270 sourceWindow_ = [sourceWindow_ parentWindow]; 265 sourceWindow_ = [sourceWindow_ parentWindow];
271 } 266 }
272 267
273 sourceWindowFrame_ = [sourceWindow_ frame]; 268 sourceWindowFrame_ = [sourceWindow_ frame];
274 sourceTabFrame_ = [self frame]; 269 sourceTabFrame_ = [self frame];
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // positioning. If not, we want to show it so it looks like a new window will 535 // positioning. If not, we want to show it so it looks like a new window will
541 // be realized. 536 // be realized.
542 BOOL chromeShouldBeVisible = targetController_ == nil; 537 BOOL chromeShouldBeVisible = targetController_ == nil;
543 [self setWindowBackgroundVisibility:chromeShouldBeVisible]; 538 [self setWindowBackgroundVisibility:chromeShouldBeVisible];
544 } 539 }
545 540
546 - (void)mouseUp:(NSEvent*)theEvent { 541 - (void)mouseUp:(NSEvent*)theEvent {
547 // The drag/click is done. If the user dragged the mouse, finalize the drag 542 // The drag/click is done. If the user dragged the mouse, finalize the drag
548 // and clean up. 543 // and clean up.
549 544
545 // Fire the action to select the tab.
546 if ([[controller_ target] respondsToSelector:[controller_ action]])
547 [[controller_ target] performSelector:[controller_ action]
548 withObject:self];
549
550 // Special-case this to keep the logic below simpler. 550 // Special-case this to keep the logic below simpler.
551 if (moveWindowOnDrag_) 551 if (moveWindowOnDrag_)
552 return; 552 return;
553 553
554 // Cancel any delayed -mouseDragged: requests that may still be pending. 554 // Cancel any delayed -mouseDragged: requests that may still be pending.
555 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 555 [NSObject cancelPreviousPerformRequestsWithTarget:self];
556 556
557 // TODO(pinkerton): http://crbug.com/25682 demonstrates a way to get here by 557 // TODO(pinkerton): http://crbug.com/25682 demonstrates a way to get here by
558 // some weird circumstance that doesn't first go through mouseDown:. We 558 // some weird circumstance that doesn't first go through mouseDown:. We
559 // really shouldn't go any farther. 559 // really shouldn't go any farther.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 740
741 // Draw the top stroke. 741 // Draw the top stroke.
742 [context saveGraphicsState]; 742 [context saveGraphicsState];
743 [borderColor set]; 743 [borderColor set];
744 [path setLineWidth:1.0]; 744 [path setLineWidth:1.0];
745 [path stroke]; 745 [path stroke];
746 [context restoreGraphicsState]; 746 [context restoreGraphicsState];
747 747
748 // Mimic the tab strip's bottom border, which consists of a dark border 748 // Mimic the tab strip's bottom border, which consists of a dark border
749 // and light highlight. 749 // and light highlight.
750 if (!selected) { 750 if (![controller_ active]) {
751 [path addClip]; 751 [path addClip];
752 NSRect borderRect = rect; 752 NSRect borderRect = rect;
753 borderRect.origin.y = 1; 753 borderRect.origin.y = 1;
754 borderRect.size.height = 1; 754 borderRect.size.height = 1;
755 [borderColor set]; 755 [borderColor set];
756 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); 756 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
757 757
758 borderRect.origin.y = 0; 758 borderRect.origin.y = 0;
759 [highlightColor set]; 759 [highlightColor set];
760 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); 760 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 controlPoint1:NSMakePoint(topRight.x + bottomControlPointInset, 1027 controlPoint1:NSMakePoint(topRight.x + bottomControlPointInset,
1028 topRight.y) 1028 topRight.y)
1029 controlPoint2:NSMakePoint(bottomRight.x - baseControlPointOutset, 1029 controlPoint2:NSMakePoint(bottomRight.x - baseControlPointOutset,
1030 bottomRight.y)]; 1030 bottomRight.y)];
1031 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y)]; 1031 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y)];
1032 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y - 2)]; 1032 [path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y - 2)];
1033 return path; 1033 return path;
1034 } 1034 }
1035 1035
1036 @end // @implementation TabView(Private) 1036 @end // @implementation TabView(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698