| 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 // Find the model index based on the x coordinate of the placeholder. If there |
| 166 - (void)setFrameOfActiveTab:(NSRect)frame; | 169 // is no placeholder, this returns the end of the tab strip. Closing tabs are |
| 170 // not considered in computing the index. |
| 171 - (int)indexOfPlaceholder; |
| 172 |
| 173 // Set the frame of |tabView|, also updates the internal frame dict. |
| 174 - (void)setFrame:(NSRect)frame ofTabView:(NSView*)tabView; |
| 167 | 175 |
| 168 // Move the given tab at index |from| in this window to the location of the | 176 // Move the given tab at index |from| in this window to the location of the |
| 169 // current placeholder. | 177 // current placeholder. |
| 170 - (void)moveTabFromIndex:(NSInteger)from; | 178 - (void)moveTabFromIndex:(NSInteger)from; |
| 171 | 179 |
| 172 // Drop a given WebContents at the location of the current placeholder. | 180 // 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 | 181 // 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 | 182 // 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 | 183 // 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 | 184 // 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 | 185 // 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 | 186 // 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. | 187 // by the |contents|, but the |pinned| state is the caller's responsibility. |
| 188 // Setting |activate| to YES will make the new tab active. |
| 181 - (void)dropWebContents:(content::WebContents*)contents | 189 - (void)dropWebContents:(content::WebContents*)contents |
| 190 atIndex:(int)modelIndex |
| 182 withFrame:(NSRect)frame | 191 withFrame:(NSRect)frame |
| 183 asPinnedTab:(BOOL)pinned; | 192 asPinnedTab:(BOOL)pinned |
| 193 activate:(BOOL)activate; |
| 184 | 194 |
| 185 // Returns the index of the subview |view|. Returns -1 if not present. Takes | 195 // 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 | 196 // 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 | 197 // model. If |view| is in the process of closing, returns -1, as closing tabs |
| 188 // are no longer in the model. | 198 // are no longer in the model. |
| 189 - (NSInteger)modelIndexForTabView:(NSView*)view; | 199 - (NSInteger)modelIndexForTabView:(NSView*)view; |
| 190 | 200 |
| 201 // Returns all selected tab views. |
| 202 - (NSArray*)selectedViews; |
| 203 |
| 191 // Return the view at a given index. | 204 // Return the view at a given index. |
| 192 - (NSView*)viewAtIndex:(NSUInteger)index; | 205 - (NSView*)viewAtIndex:(NSUInteger)index; |
| 193 | 206 |
| 194 // Return the number of tab views in the tab strip. It's same as number of tabs | 207 // 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 | 208 // in the model, except when a tab is closing, which will be counted in views |
| 196 // count, but no longer in the model. | 209 // count, but no longer in the model. |
| 197 - (NSUInteger)viewsCount; | 210 - (NSUInteger)viewsCount; |
| 198 | 211 |
| 199 // Set the placeholder for a dragged tab, allowing the |frame| to be specified. | 212 // 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. | 213 // This causes this tab to be rendered in an arbitrary position. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 252 |
| 240 @interface TabStripController(TestingAPI) | 253 @interface TabStripController(TestingAPI) |
| 241 - (void)setTabTitle:(TabController*)tab | 254 - (void)setTabTitle:(TabController*)tab |
| 242 withContents:(content::WebContents*)contents; | 255 withContents:(content::WebContents*)contents; |
| 243 @end | 256 @end |
| 244 | 257 |
| 245 // Returns the parent view to use when showing a sheet for a given web contents. | 258 // Returns the parent view to use when showing a sheet for a given web contents. |
| 246 NSView* GetSheetParentViewForWebContents(content::WebContents* web_contents); | 259 NSView* GetSheetParentViewForWebContents(content::WebContents* web_contents); |
| 247 | 260 |
| 248 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ | 261 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |