OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 // |delegate| is the one listening to filtered TabStripModelObserverBridge's | 152 // |delegate| is the one listening to filtered TabStripModelObserverBridge's |
153 // events (see TabStripControllerDelegate for more details). | 153 // events (see TabStripControllerDelegate for more details). |
154 - (id)initWithView:(TabStripView*)view | 154 - (id)initWithView:(TabStripView*)view |
155 switchView:(NSView*)switchView | 155 switchView:(NSView*)switchView |
156 browser:(Browser*)browser | 156 browser:(Browser*)browser |
157 delegate:(id<TabStripControllerDelegate>)delegate; | 157 delegate:(id<TabStripControllerDelegate>)delegate; |
158 | 158 |
159 // Returns the model behind this controller. | 159 // Returns the model behind this controller. |
160 - (TabStripModel*)tabStripModel; | 160 - (TabStripModel*)tabStripModel; |
161 | 161 |
162 // Returns all tab views. | |
163 - (NSArray*)tabViews; | |
164 | |
162 // Return the view for the currently active tab. | 165 // Return the view for the currently active tab. |
163 - (NSView*)activeTabView; | 166 - (NSView*)activeTabView; |
164 | 167 |
165 // Set the frame of the active tab, also updates the internal frame dict. | 168 // Set the frame of |tabView|, also updates the internal frame dict. |
166 - (void)setFrameOfActiveTab:(NSRect)frame; | 169 - (void)setFrame:(NSRect)frame ofTabView:(NSView*)tabView; |
167 | 170 |
168 // Move the given tab at index |from| in this window to the location of the | 171 // Move the given tab at index |from| in this window to the location of the |
169 // current placeholder. | 172 // current placeholder. |
170 - (void)moveTabFromIndex:(NSInteger)from; | 173 - (void)moveTabFromIndex:(NSInteger)from; |
171 | 174 |
172 // Drop a given WebContents at the location of the current placeholder. | 175 // Drop a given WebContents at |modelIndex|. Used when dragging from |
173 // If there is no placeholder, it will go at the end. Used when dragging from | |
174 // another window when we don't have access to the WebContents as part of our | 176 // another window when we don't have access to the WebContents as part of our |
175 // strip. |frame| is in the coordinate system of the tab strip view and | 177 // strip. |frame| is in the coordinate system of the tab strip view and |
176 // represents where the user dropped the new tab so it can be animated into its | 178 // represents where the user dropped the new tab so it can be animated into its |
177 // correct location when the tab is added to the model. If the tab was pinned in | 179 // correct location when the tab is added to the model. If the tab was pinned in |
178 // its previous window, setting |pinned| to YES will propagate that state to the | 180 // its previous window, setting |pinned| to YES will propagate that state to the |
179 // new window. Mini-tabs are either app or pinned tabs; the app state is stored | 181 // new window. Mini-tabs are either app or pinned tabs; the app state is stored |
180 // by the |contents|, but the |pinned| state is the caller's responsibility. | 182 // by the |contents|, but the |pinned| state is the caller's responsibility. |
Robert Sesek
2014/02/24 15:25:20
Should also discuss what |activate| does.
Andre
2014/02/25 01:16:16
Done.
| |
181 - (void)dropWebContents:(content::WebContents*)contents | 183 - (void)dropWebContents:(content::WebContents*)contents |
184 atIndex:(int)modelIndex | |
182 withFrame:(NSRect)frame | 185 withFrame:(NSRect)frame |
183 asPinnedTab:(BOOL)pinned; | 186 asPinnedTab:(BOOL)pinned |
187 activate:(BOOL)activate; | |
184 | 188 |
185 // Returns the index of the subview |view|. Returns -1 if not present. Takes | 189 // Returns the index of the subview |view|. Returns -1 if not present. Takes |
186 // closing tabs into account such that this index will correctly match the tab | 190 // closing tabs into account such that this index will correctly match the tab |
187 // model. If |view| is in the process of closing, returns -1, as closing tabs | 191 // model. If |view| is in the process of closing, returns -1, as closing tabs |
188 // are no longer in the model. | 192 // are no longer in the model. |
189 - (NSInteger)modelIndexForTabView:(NSView*)view; | 193 - (NSInteger)modelIndexForTabView:(NSView*)view; |
190 | 194 |
195 - (NSArray*)selectedViews; | |
Robert Sesek
2014/02/24 15:25:20
Comment all public declarations.
Andre
2014/02/25 01:16:16
Done.
| |
196 | |
191 // Return the view at a given index. | 197 // Return the view at a given index. |
192 - (NSView*)viewAtIndex:(NSUInteger)index; | 198 - (NSView*)viewAtIndex:(NSUInteger)index; |
193 | 199 |
194 // Return the number of tab views in the tab strip. It's same as number of tabs | 200 // Return the number of tab views in the tab strip. It's same as number of tabs |
195 // in the model, except when a tab is closing, which will be counted in views | 201 // in the model, except when a tab is closing, which will be counted in views |
196 // count, but no longer in the model. | 202 // count, but no longer in the model. |
197 - (NSUInteger)viewsCount; | 203 - (NSUInteger)viewsCount; |
198 | 204 |
199 // Set the placeholder for a dragged tab, allowing the |frame| to be specified. | 205 // Set the placeholder for a dragged tab, allowing the |frame| to be specified. |
200 // This causes this tab to be rendered in an arbitrary position. | 206 // This causes this tab to be rendered in an arbitrary position. |
201 - (void)insertPlaceholderForTab:(TabView*)tab frame:(NSRect)frame; | 207 - (void)insertPlaceholderForTab:(TabView*)tab frame:(NSRect)frame; |
202 | 208 |
209 // Find the model index based on the x coordinate of the placeholder. If there | |
210 // is no placeholder, this returns the end of the tab strip. Closing tabs are | |
211 // not considered in computing the index. | |
212 - (int)indexOfPlaceholder; | |
213 | |
203 // Returns whether a tab is being dragged within the tab strip. | 214 // Returns whether a tab is being dragged within the tab strip. |
204 - (BOOL)isDragSessionActive; | 215 - (BOOL)isDragSessionActive; |
205 | 216 |
206 // Returns whether or not |tab| can still be fully seen in the tab strip or if | 217 // Returns whether or not |tab| can still be fully seen in the tab strip or if |
207 // its current position would cause it be obscured by things such as the edge | 218 // its current position would cause it be obscured by things such as the edge |
208 // of the window or the window decorations. Returns YES only if the entire tab | 219 // of the window or the window decorations. Returns YES only if the entire tab |
209 // is visible. | 220 // is visible. |
210 - (BOOL)isTabFullyVisible:(TabView*)tab; | 221 - (BOOL)isTabFullyVisible:(TabView*)tab; |
211 | 222 |
212 // Show or hide the new tab button. The button is hidden immediately, but | 223 // Show or hide the new tab button. The button is hidden immediately, but |
(...skipping 26 matching lines...) Expand all Loading... | |
239 | 250 |
240 @interface TabStripController(TestingAPI) | 251 @interface TabStripController(TestingAPI) |
241 - (void)setTabTitle:(TabController*)tab | 252 - (void)setTabTitle:(TabController*)tab |
242 withContents:(content::WebContents*)contents; | 253 withContents:(content::WebContents*)contents; |
243 @end | 254 @end |
244 | 255 |
245 // Returns the parent view to use when showing a sheet for a given web contents. | 256 // Returns the parent view to use when showing a sheet for a given web contents. |
246 NSView* GetSheetParentViewForWebContents(content::WebContents* web_contents); | 257 NSView* GetSheetParentViewForWebContents(content::WebContents* web_contents); |
247 | 258 |
248 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ | 259 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |