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

Unified Diff: chrome/browser/ui/tabs/tab_mru_list_manager.h

Issue 10117016: Implementation for switching between recently used tabs using ctrl tilde or quoteleft. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed review comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/tabs/tab_mru_list_manager.h
diff --git a/chrome/browser/ui/tabs/tab_mru_list_manager.h b/chrome/browser/ui/tabs/tab_mru_list_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..ca67da659c2a3df5c017a507631d0cfc8e91ec39
--- /dev/null
+++ b/chrome/browser/ui/tabs/tab_mru_list_manager.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_TABS_TAB_MRU_LIST_MANAGER_H_
+#define CHROME_BROWSER_UI_TABS_TAB_MRU_LIST_MANAGER_H_
+#pragma once
+
+#include <list>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
sky 2012/06/15 19:47:39 You shouldn't need this include.
NaveenBobbili (Motorola) 2012/06/25 09:44:23 Done.
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
+
+class TabContentsWrapper;
+////////////////////////////////////////////////////////////////////////////////
sky 2012/06/15 19:47:39 newline between 16 and 17.
NaveenBobbili (Motorola) 2012/06/25 09:44:23 Done.
+//
+// TabMRUListManager
+//
+// This is a list that manages the tabs that are in a tab strip as per the most
+// recently used priority order. This overrides TabStrip Model Observer.
+//
+////////////////////////////////////////////////////////////////////////////////
+class TabMRUListManager : public TabStripModelObserver {
sky 2012/06/15 19:47:39 Name this MRUTabController.
NaveenBobbili (Motorola) 2012/06/25 09:44:23 Done.
+ public:
+ explicit TabMRUListManager(TabStripModel* tab_strip_model);
+ virtual ~TabMRUListManager();
+
+ // Overridden from TabStripModelObserver:
sky 2012/06/15 19:47:39 overriden methods should be grouped at the end of
NaveenBobbili (Motorola) 2012/06/25 09:44:23 Done.
+ virtual void TabInsertedAt(TabContentsWrapper* contents,
+ int index,
+ bool foreground) OVERRIDE;
+ virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE;
+ virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index,
+ bool user_gesture) OVERRIDE;
+ virtual void TabReplacedAt(TabStripModel* tab_strip_model,
+ TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index) OVERRIDE;
+ virtual void TabStripEmpty() OVERRIDE;
+
+ TabContentsWrapper* GetPreviousMRUTab();
sky 2012/06/15 19:47:39 You need to sync, TCW is now TabContents. Also, ad
NaveenBobbili (Motorola) 2012/06/25 09:44:23 Done.
+
+ void PauseStackUpdates();
+
+ void CommitActiveTabChanges();
+
+ private:
+ // List that maintains the tab indices in the most recently visited order
+ typedef std::list<TabContentsWrapper*> TabsMRUList;
+ TabsMRUList tabs_mru_list_;
+
+ TabStripModel* tab_strip_model_;
+
+ bool can_update_stack_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabMRUListManager);
+};
+
+#endif // CHROME_BROWSER_UI_TABS_TAB_MRU_LIST_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698