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

Side by Side Diff: ios/shared/chrome/browser/tabs/web_state_list_order_controller.h

Issue 2703333006: Move the notion of current Tab from TabModel to WebStateList. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_ 5 #ifndef IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_
6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_ 6 #define IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/base/page_transition_types.h" 9 #include "ui/base/page_transition_types.h"
10 10
11 class WebStateList; 11 class WebStateList;
12 12
13 namespace web { 13 namespace web {
14 class WebState; 14 class WebState;
15 } 15 }
16 16
17 // WebStateListOrderController allows different types of ordering and 17 // WebStateListOrderController allows different types of ordering and
18 // selection heuristics to be plugged into WebStateList. 18 // selection heuristics to be plugged into WebStateList.
19 class WebStateListOrderController { 19 class WebStateListOrderController {
20 public: 20 public:
21 explicit WebStateListOrderController(WebStateList* web_state_list); 21 explicit WebStateListOrderController(WebStateList* web_state_list);
22 ~WebStateListOrderController(); 22 ~WebStateListOrderController();
23 23
24 // Determines where to place a newly opened WebState by using the supplied 24 // Determines where to place a newly opened WebState by using the supplied
25 // transition, opener and background flag. 25 // transition, opener and background flag.
26 int DetermineInsertionIndex(ui::PageTransition transition, 26 int DetermineInsertionIndex(ui::PageTransition transition,
27 web::WebState* opener) const; 27 web::WebState* opener) const;
28 28
29 // Determines where to shift the active index after a WebState is closed.
30 int DetermineNewActiveIndex(int removing_index) const;
31
29 private: 32 private:
33 // Returns a valid index to be selected after the WebState at |removing_index|
34 // is detached, adjusting |index| to reflect that |removing_index| is going
35 // away.
36 int GetValidIndex(int index, int removing_index) const;
37
30 WebStateList* web_state_list_; 38 WebStateList* web_state_list_;
31 39
32 DISALLOW_COPY_AND_ASSIGN(WebStateListOrderController); 40 DISALLOW_COPY_AND_ASSIGN(WebStateListOrderController);
33 }; 41 };
34 42
35 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_ 43 #endif // IOS_SHARED_CHROME_BROWSER_TABS_WEB_STATE_LIST_ORDER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698