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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model_order_controller.h

Issue 10537062: TabContentsWrapper -> TabContents, part 13. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiz Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "content/public/common/page_transition_types.h" 10 #include "content/public/common/page_transition_types.h"
11 11
12 class TabContents; 12 class TabContents;
13 typedef TabContents TabContentsWrapper;
14 13
15 /////////////////////////////////////////////////////////////////////////////// 14 ///////////////////////////////////////////////////////////////////////////////
16 // TabStripModelOrderController 15 // TabStripModelOrderController
17 // 16 //
18 // An object that allows different types of ordering and reselection to be 17 // An object that allows different types of ordering and reselection to be
19 // heuristics plugged into a TabStripModel. 18 // heuristics plugged into a TabStripModel.
20 // 19 //
21 class TabStripModelOrderController : public TabStripModelObserver { 20 class TabStripModelOrderController : public TabStripModelObserver {
22 public: 21 public:
23 explicit TabStripModelOrderController(TabStripModel* tabstrip); 22 explicit TabStripModelOrderController(TabStripModel* tabstrip);
24 virtual ~TabStripModelOrderController(); 23 virtual ~TabStripModelOrderController();
25 24
26 // Sets the insertion policy. Default is INSERT_AFTER. 25 // Sets the insertion policy. Default is INSERT_AFTER.
27 void set_insertion_policy(TabStripModel::InsertionPolicy policy) { 26 void set_insertion_policy(TabStripModel::InsertionPolicy policy) {
28 insertion_policy_ = policy; 27 insertion_policy_ = policy;
29 } 28 }
30 TabStripModel::InsertionPolicy insertion_policy() const { 29 TabStripModel::InsertionPolicy insertion_policy() const {
31 return insertion_policy_; 30 return insertion_policy_;
32 } 31 }
33 32
34 // Determine where to place a newly opened tab by using the supplied 33 // Determine where to place a newly opened tab by using the supplied
35 // transition and foreground flag to figure out how it was opened. 34 // transition and foreground flag to figure out how it was opened.
36 int DetermineInsertionIndex(TabContentsWrapper* new_contents, 35 int DetermineInsertionIndex(TabContents* new_contents,
37 content::PageTransition transition, 36 content::PageTransition transition,
38 bool foreground); 37 bool foreground);
39 38
40 // Returns the index to append tabs at. 39 // Returns the index to append tabs at.
41 int DetermineInsertionIndexForAppending(); 40 int DetermineInsertionIndexForAppending();
42 41
43 // Determine where to shift selection after a tab is closed. 42 // Determine where to shift selection after a tab is closed.
44 int DetermineNewSelectedIndex(int removed_index) const; 43 int DetermineNewSelectedIndex(int removed_index) const;
45 44
46 // Overridden from TabStripModelObserver: 45 // Overridden from TabStripModelObserver:
47 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, 46 virtual void ActiveTabChanged(TabContents* old_contents,
48 TabContentsWrapper* new_contents, 47 TabContents* new_contents,
49 int index, 48 int index,
50 bool user_gesture) OVERRIDE; 49 bool user_gesture) OVERRIDE;
51 50
52 private: 51 private:
53 // Returns a valid index to be selected after the tab at |removing_index| is 52 // Returns a valid index to be selected after the tab at |removing_index| is
54 // closed. If |index| is after |removing_index|, |index| is adjusted to 53 // closed. If |index| is after |removing_index|, |index| is adjusted to
55 // reflect the fact that |removing_index| is going away. 54 // reflect the fact that |removing_index| is going away.
56 int GetValidIndex(int index, int removing_index) const; 55 int GetValidIndex(int index, int removing_index) const;
57 56
58 TabStripModel* tabstrip_; 57 TabStripModel* tabstrip_;
59 58
60 TabStripModel::InsertionPolicy insertion_policy_; 59 TabStripModel::InsertionPolicy insertion_policy_;
61 60
62 DISALLOW_COPY_AND_ASSIGN(TabStripModelOrderController); 61 DISALLOW_COPY_AND_ASSIGN(TabStripModelOrderController);
63 }; 62 };
64 63
65 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ 64 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model_observer.cc ('k') | chrome/browser/ui/tabs/tab_strip_model_order_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698