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

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

Issue 7080064: [Mac] Refactor the logic of tab dragging out of TabView and into a new helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_ 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 #include <ApplicationServices/ApplicationServices.h> 10 #include <ApplicationServices/ApplicationServices.h>
11 11
12 #include <map>
13
14 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
15 #import "chrome/browser/ui/cocoa/background_gradient_view.h" 13 #import "chrome/browser/ui/cocoa/background_gradient_view.h"
16 #import "chrome/browser/ui/cocoa/hover_close_button.h" 14 #import "chrome/browser/ui/cocoa/hover_close_button.h"
17 15
18 namespace tabs { 16 namespace tabs {
19 17
20 // Nomenclature: 18 // Nomenclature:
21 // Tabs _glow_ under two different circumstances, when they are _hovered_ (by 19 // Tabs _glow_ under two different circumstances, when they are _hovered_ (by
22 // the mouse) and when they are _alerted_ (to show that the tab's title has 20 // the mouse) and when they are _alerted_ (to show that the tab's title has
23 // changed). 21 // changed).
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 CGFloat hoverAlpha_; // How strong the hover glow is. 57 CGFloat hoverAlpha_; // How strong the hover glow is.
60 NSTimeInterval hoverHoldEndTime_; // When the hover glow will begin dimming. 58 NSTimeInterval hoverHoldEndTime_; // When the hover glow will begin dimming.
61 59
62 CGFloat alertAlpha_; // How strong the alert glow is. 60 CGFloat alertAlpha_; // How strong the alert glow is.
63 NSTimeInterval alertHoldEndTime_; // When the hover glow will begin dimming. 61 NSTimeInterval alertHoldEndTime_; // When the hover glow will begin dimming.
64 62
65 NSTimeInterval lastGlowUpdate_; // Time either glow was last updated. 63 NSTimeInterval lastGlowUpdate_; // Time either glow was last updated.
66 64
67 NSPoint hoverPoint_; // Current location of hover in view coords. 65 NSPoint hoverPoint_; // Current location of hover in view coords.
68 66
69 // All following variables are valid for the duration of a drag. 67 // The location of the current mouseDown event in window coordinates.
70 // These are released on mouseUp: 68 NSPoint mouseDownPoint_;
71 BOOL moveWindowOnDrag_; // Set if the only tab of a window is dragged.
72 BOOL tabWasDragged_; // Has the tab been dragged?
73 BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip?
74 BOOL chromeIsVisible_;
75 69
76 NSTimeInterval tearTime_; // Time since tear happened
77 NSPoint tearOrigin_; // Origin of the tear rect
78 NSPoint dragOrigin_; // Origin point of the drag
79 // TODO(alcor): these references may need to be strong to avoid crashes
80 // due to JS closing windows
81 TabWindowController* sourceController_; // weak. controller starting the drag
82 NSWindow* sourceWindow_; // weak. The window starting the drag
83 NSRect sourceWindowFrame_;
84 NSRect sourceTabFrame_;
85
86 TabWindowController* draggedController_; // weak. Controller being dragged.
87 NSWindow* dragWindow_; // weak. The window being dragged
88 NSWindow* dragOverlay_; // weak. The overlay being dragged
89 // Cache workspace IDs per-drag because computing them on 10.5 with
90 // CGWindowListCreateDescriptionFromArray is expensive.
91 // resetDragControllers clears this cache.
92 //
93 // TODO(davidben): When 10.5 becomes unsupported, remove this.
94 std::map<CGWindowID, int> workspaceIDCache_;
95
96 TabWindowController* targetController_; // weak. Controller being targeted
97 NSCellStateValue state_; 70 NSCellStateValue state_;
98 } 71 }
99 72
100 @property(assign, nonatomic) NSCellStateValue state; 73 @property(assign, nonatomic) NSCellStateValue state;
101 @property(assign, nonatomic) CGFloat hoverAlpha; 74 @property(assign, nonatomic) CGFloat hoverAlpha;
102 @property(assign, nonatomic) CGFloat alertAlpha; 75 @property(assign, nonatomic) CGFloat alertAlpha;
103 76
104 // Determines if the tab is in the process of animating closed. It may still 77 // Determines if the tab is in the process of animating closed. It may still
105 // be visible on-screen, but should not respond to/initiate any events. Upon 78 // be visible on-screen, but should not respond to/initiate any events. Upon
106 // setting to NO, clears the target/action of the close button to prevent 79 // setting to NO, clears the target/action of the close button to prevent
(...skipping 15 matching lines...) Expand all
122 95
123 // The TabController |controller_| is not the only owner of this view. If the 96 // The TabController |controller_| is not the only owner of this view. If the
124 // controller is released before this view, then we could be hanging onto a 97 // controller is released before this view, then we could be hanging onto a
125 // garbage pointer. To prevent this, the TabController uses this interface to 98 // garbage pointer. To prevent this, the TabController uses this interface to
126 // clear the |controller_| pointer when it is dying. 99 // clear the |controller_| pointer when it is dying.
127 @interface TabView (TabControllerInterface) 100 @interface TabView (TabControllerInterface)
128 - (void)setController:(TabController*)controller; 101 - (void)setController:(TabController*)controller;
129 @end 102 @end
130 103
131 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_ 104 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698