OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_TABS_MRU_TAB_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_TABS_MRU_TAB_CONTROLLER_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 13 |
| 14 class TabContents; |
| 15 class TabStripModel; |
| 16 |
| 17 //////////////////////////////////////////////////////////////////////////////// |
| 18 // |
| 19 // MRUTabController |
| 20 // |
| 21 // This is a list that manages the tabs that are in a tab strip as per the most |
| 22 // recently used priority order. This overrides TabStrip Model Observer. |
| 23 // |
| 24 //////////////////////////////////////////////////////////////////////////////// |
| 25 class MRUTabController : public TabStripModelObserver { |
| 26 public: |
| 27 explicit MRUTabController(TabStripModel* tab_strip_model); |
| 28 virtual ~MRUTabController(); |
| 29 |
| 30 // Retrieves the previously used tab in the mru list |
| 31 TabContents* GetPreviousMRUTab(); |
| 32 |
| 33 // Pauses changes to the mru list. |
| 34 void PauseStackUpdates(); |
| 35 |
| 36 // Updates the mru list by bringing currently active |
| 37 // tab to the front of the list. |
| 38 void CommitActiveTabChanges(); |
| 39 |
| 40 // Overridden from TabStripModelObserver: |
| 41 virtual void TabInsertedAt(TabContents* contents, |
| 42 int index, |
| 43 bool foreground) OVERRIDE; |
| 44 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; |
| 45 virtual void ActiveTabChanged(TabContents* old_contents, |
| 46 TabContents* new_contents, |
| 47 int index, |
| 48 bool user_gesture) OVERRIDE; |
| 49 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 50 TabContents* old_contents, |
| 51 TabContents* new_contents, |
| 52 int index) OVERRIDE; |
| 53 virtual void TabStripEmpty() OVERRIDE; |
| 54 |
| 55 private: |
| 56 // List that maintains the tab indices in the most recently visited order |
| 57 typedef std::list<TabContents*> TabsMRUList; |
| 58 TabsMRUList tabs_mru_list_; |
| 59 |
| 60 TabStripModel* tab_strip_model_; |
| 61 |
| 62 bool can_update_stack_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(MRUTabController); |
| 65 }; |
| 66 #endif // CHROME_BROWSER_UI_TABS_MRU_TAB_CONTROLLER_H_ |
OLD | NEW |