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

Side by Side Diff: ios/chrome/browser/tabs/tab_model_order_controller.h

Issue 2690893003: Remove obsolete code in TabModelOrderController. (Closed)
Patch Set: Rebase on origin/master. Created 3 years, 10 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
OLDNEW
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" 11 #include "ui/base/page_transition_types.h"
12 12
13 namespace TabModelOrderConstants { 13 namespace TabModelOrderConstants {
14 14
15 // InsertionPolicy is a general policy for opening all new tabs.
16 enum InsertionPolicy {
17 // Newly created tabs are created after the selection. This is the default.
18 kInsertAfter,
19 // Newly created tabs are inserted before the selection.
20 kInsertBefore,
21 };
22
23 // InsertionAdjacency allows different links to choose to open tabs directly 15 // InsertionAdjacency allows different links to choose to open tabs directly
24 // before or after a given tab, depending on context. 16 // before or after a given tab, depending on context.
25 enum InsertionAdjacency { 17 enum InsertionAdjacency {
26 // Insert a card just before (to the left of) a given card. 18 // Insert a card just before (to the left of) a given card.
27 kAdjacentBefore, 19 kAdjacentBefore,
28 // Insert a card just after (to the right of) a given card. 20 // Insert a card just after (to the right of) a given card.
29 kAdjacentAfter, 21 kAdjacentAfter,
30 }; 22 };
31 23
32 } // namespace TabModelOrderConstants 24 } // namespace TabModelOrderConstants
33 25
34 // An object that allows different types of ordering and reselection to be 26 // An object that allows different types of ordering and reselection to be
35 // heuristics plugged into a TabStripModel. Closely parallels 27 // heuristics plugged into a TabStripModel. Closely parallels
36 // chrome/browser/tabs/tab_strip_model_order_controller.h 28 // chrome/browser/tabs/tab_strip_model_order_controller.h
37 // but without the dependence on TabContentsWrapper and TabStripModel. 29 // but without the dependence on TabContentsWrapper and TabStripModel.
38 @interface TabModelOrderController : NSObject { 30 @interface TabModelOrderController : NSObject
39 @private
40 TabModel* model_; // weak, owns us
41 TabModelOrderConstants::InsertionPolicy insertionPolicy_;
42 }
43
44 // Sets the insertion policy for new tabs. Default is |kInsertAfter|.
45 @property(nonatomic, assign)
46 TabModelOrderConstants::InsertionPolicy insertionPolicy;
47 31
48 // Initializer, |model| must be non-nil and is not retained. 32 // Initializer, |model| must be non-nil and is not retained.
49 - (id)initWithTabModel:(TabModel*)model; 33 - (instancetype)initWithTabModel:(TabModel*)model;
50 34
51 // Determines where to place a newly opened tab by using the transition and 35 // Determines where to place a newly opened tab by using the transition and
52 // adjacency flags. 36 // adjacency flags.
53 - (NSUInteger)insertionIndexForTab:(Tab*)newTab 37 - (NSUInteger)insertionIndexForTab:(Tab*)newTab
54 transition:(ui::PageTransition)transition 38 transition:(ui::PageTransition)transition
55 opener:(Tab*)parentTab 39 opener:(Tab*)parentTab
56 adjacency:(TabModelOrderConstants::InsertionAdjacency) 40 adjacency:(TabModelOrderConstants::InsertionAdjacency)
57 adjacency; 41 adjacency;
58 42
59 // Returns the index at which to append tabs, based on |insertionPolicy|. 43 // Returns the index at which to append tabs.
60 - (NSUInteger)insertionIndexForAppending; 44 - (NSUInteger)insertionIndexForAppending;
61 45
62 // Returns the tab in which to shift selection after a tab is closed. May 46 // Returns the tab in which to shift selection after a tab is closed. May
63 // return nil if there are no more tabs. 47 // return nil if there are no more tabs.
64 - (Tab*)determineNewSelectedTabFromRemovedTab:(Tab*)removedTab; 48 - (Tab*)determineNewSelectedTabFromRemovedTab:(Tab*)removedTab;
65 49
66 @end 50 @end
67 51
68 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_ 52 #endif // IOS_CHROME_BROWSER_TABS_TAB_MODEL_ORDER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab_model.mm ('k') | ios/chrome/browser/tabs/tab_model_order_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698