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

Side by Side Diff: chrome/browser/cocoa/tab_strip_view.mm

Issue 337055: Mac: implement drag-and-drop of URLs to tabs/tab strip. (Closed)
Patch Set: Give another line back. Created 11 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/tab_strip_view.h" 5 #import "chrome/browser/cocoa/tab_strip_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 @implementation TabStripView 9 @implementation TabStripView
10 10
11 @synthesize newTabButton = newTabButton_; 11 @synthesize newTabButton = newTabButton_;
12 12
13 - (id)initWithFrame:(NSRect)frame { 13 - (id)initWithFrame:(NSRect)frame {
14 self = [super initWithFrame:frame]; 14 self = [super initWithFrame:frame];
15 if (self) { 15 if (self) {
16 // Set lastMouseUp_ = -1000.0 so that timestamp-lastMouseUp_ is big unless 16 // Set lastMouseUp_ = -1000.0 so that timestamp-lastMouseUp_ is big unless
17 // lastMouseUp_ has been reset. 17 // lastMouseUp_ has been reset.
18 lastMouseUp_ = -1000.0; 18 lastMouseUp_ = -1000.0;
19
20 // Register to be an URL drop target.
21 dropHandler_.reset([[URLDropTargetHandler alloc] initWithView:self]);
19 } 22 }
20 return self; 23 return self;
21 } 24 }
22 25
23 - (void)drawRect:(NSRect)rect { 26 - (void)drawRect:(NSRect)rect {
24 NSRect boundsRect = [self bounds]; 27 NSRect boundsRect = [self bounds];
25 NSRect borderRect, contentRect; 28 NSRect borderRect, contentRect;
26 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge); 29 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge);
27 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; 30 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set];
28 31
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 performSelector:@selector(_shouldMiniaturizeOnDoubleClick)]) 68 performSelector:@selector(_shouldMiniaturizeOnDoubleClick)])
66 [[self window] performMiniaturize:self]; 69 [[self window] performMiniaturize:self];
67 } else { 70 } else {
68 [super mouseUp:event]; 71 [super mouseUp:event];
69 } 72 }
70 73
71 // If clickCount is 0, the drag threshold was passed. 74 // If clickCount is 0, the drag threshold was passed.
72 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0; 75 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0;
73 } 76 }
74 77
78 // Required by |URLDropTargetHandler|.
79 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
80 return [dropHandler_ draggingEntered:sender];
81 }
82
83 // Required by |URLDropTargetHandler|.
84 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
85 return [dropHandler_ draggingUpdated:sender];
86 }
87
88 // Required by |URLDropTargetHandler|.
89 - (void)draggingExited:(id<NSDraggingInfo>)sender {
90 return [dropHandler_ draggingExited:sender];
91 }
92
93 // Required by |URLDropTargetHandler|.
94 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
95 return [dropHandler_ performDragOperation:sender];
96 }
97
75 @end 98 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698