OLD | NEW |
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 #ifndef CHROME_BROWSER_COCOA_TAB_VIEW_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_VIEW_H_ |
6 #define CHROME_BROWSER_COCOA_TAB_VIEW_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_VIEW_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
| 10 #include "base/scoped_nsobject.h" |
| 11 |
10 @class TabController, TabWindowController; | 12 @class TabController, TabWindowController; |
11 | 13 |
12 // A view that handles the event tracking (clicking and dragging) for a tab | 14 // A view that handles the event tracking (clicking and dragging) for a tab |
13 // on the tab strip. Relies on an associated TabController to provide a | 15 // on the tab strip. Relies on an associated TabController to provide a |
14 // target/action for selecting the tab. | 16 // target/action for selecting the tab. |
15 | 17 |
16 @interface TabView : NSView { | 18 @interface TabView : NSView { |
17 @private | 19 @private |
18 IBOutlet TabController* controller_; | 20 IBOutlet TabController* controller_; |
19 // TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it | 21 // TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it |
20 // in and out on mouseovers. | 22 // in and out on mouseovers. |
21 IBOutlet NSButton* closeButton_; | 23 IBOutlet NSButton* closeButton_; |
22 | 24 |
| 25 // Tracking area for close button mouseover images. |
| 26 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 27 |
23 // All following variables are valid for the duration of a drag. | 28 // All following variables are valid for the duration of a drag. |
24 // These are released on mouseUp: | 29 // These are released on mouseUp: |
25 BOOL isTheOnlyTab_; // Is this the only tab in the window? | 30 BOOL isTheOnlyTab_; // Is this the only tab in the window? |
26 BOOL tabWasDragged_; // Has the tab been dragged? | 31 BOOL tabWasDragged_; // Has the tab been dragged? |
27 BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip? | 32 BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip? |
28 BOOL chromeIsVisible_; | 33 BOOL chromeIsVisible_; |
29 | 34 |
30 NSTimeInterval tearTime_; // Time since tear happened | 35 NSTimeInterval tearTime_; // Time since tear happened |
31 NSPoint tearOrigin_; // Origin of the tear rect | 36 NSPoint tearOrigin_; // Origin of the tear rect |
32 NSPoint dragOrigin_; // Origin point of the drag | 37 NSPoint dragOrigin_; // Origin point of the drag |
33 // TODO(alcor): these references may need to be strong to avoid crashes | 38 // TODO(alcor): these references may need to be strong to avoid crashes |
34 // due to JS closing windows | 39 // due to JS closing windows |
35 TabWindowController* sourceController_; // weak. controller starting the drag | 40 TabWindowController* sourceController_; // weak. controller starting the drag |
36 NSWindow* sourceWindow_; // weak. The window starting the drag | 41 NSWindow* sourceWindow_; // weak. The window starting the drag |
37 NSRect sourceWindowFrame_; | 42 NSRect sourceWindowFrame_; |
38 NSRect sourceTabFrame_; | 43 NSRect sourceTabFrame_; |
39 | 44 |
40 TabWindowController* draggedController_; // weak. Controller being dragged. | 45 TabWindowController* draggedController_; // weak. Controller being dragged. |
41 NSWindow* dragWindow_; // weak. The window being dragged | 46 NSWindow* dragWindow_; // weak. The window being dragged |
42 NSWindow* dragOverlay_; // weak. The overlay being dragged | 47 NSWindow* dragOverlay_; // weak. The overlay being dragged |
43 | 48 |
44 TabWindowController* targetController_; // weak. Controller being targeted | 49 TabWindowController* targetController_; // weak. Controller being targeted |
45 } | 50 } |
46 @end | 51 @end |
47 | 52 |
48 #endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_ | 53 #endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_ |
OLD | NEW |