| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/tabs/tab_model.h" | 10 #import "ios/chrome/browser/tabs/tab_model.h" |
| 11 #include "ui/base/page_transition_types.h" | |
| 12 | |
| 13 namespace TabModelOrderConstants { | |
| 14 | |
| 15 // InsertionAdjacency allows different links to choose to open tabs directly | |
| 16 // before or after a given tab, depending on context. | |
| 17 enum InsertionAdjacency { | |
| 18 // Insert a card just before (to the left of) a given card. | |
| 19 kAdjacentBefore, | |
| 20 // Insert a card just after (to the right of) a given card. | |
| 21 kAdjacentAfter, | |
| 22 }; | |
| 23 | |
| 24 } // namespace TabModelOrderConstants | |
| 25 | 11 |
| 26 // An object that allows different types of ordering and reselection to be | 12 // An object that allows different types of ordering and reselection to be |
| 27 // heuristics plugged into a TabStripModel. Closely parallels | 13 // heuristics plugged into a TabStripModel. Closely parallels |
| 28 // chrome/browser/tabs/tab_strip_model_order_controller.h | 14 // chrome/browser/tabs/tab_strip_model_order_controller.h |
| 29 // but without the dependence on TabContentsWrapper and TabStripModel. | 15 // but without the dependence on TabContentsWrapper and TabStripModel. |
| 30 @interface TabModelOrderController : NSObject | 16 @interface TabModelOrderController : NSObject |
| 31 | 17 |
| 32 // Initializer, |model| must be non-nil and is not retained. | 18 // Initializer, |model| must be non-nil and is not retained. |
| 33 - (instancetype)initWithTabModel:(TabModel*)model; | 19 - (instancetype)initWithTabModel:(TabModel*)model; |
| 34 | 20 |
| 35 // Determines where to place a newly opened tab by using the transition and | |
| 36 // adjacency flags. | |
| 37 - (NSUInteger)insertionIndexForTab:(Tab*)newTab | |
| 38 transition:(ui::PageTransition)transition | |
| 39 opener:(Tab*)parentTab | |
| 40 adjacency:(TabModelOrderConstants::InsertionAdjacency) | |
| 41 adjacency; | |
| 42 | |
| 43 // Returns the index at which to append tabs. | |
| 44 - (NSUInteger)insertionIndexForAppending; | |
| 45 | |
| 46 // Returns the tab in which to shift selection after a tab is closed. May | 21 // Returns the tab in which to shift selection after a tab is closed. May |
| 47 // return nil if there are no more tabs. | 22 // return nil if there are no more tabs. |
| 48 - (Tab*)determineNewSelectedTabFromRemovedTab:(Tab*)removedTab; | 23 - (Tab*)determineNewSelectedTabFromRemovedTab:(Tab*)removedTab; |
| 49 | 24 |
| 50 @end | 25 @end |
| 51 | 26 |
| 52 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ | 27 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ |
| OLD | NEW |