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

Side by Side Diff: chrome/browser/tabs/tab_strip_model.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: Added tab mru list manager class. Created 8 years, 7 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 (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_TABS_TAB_STRIP_MODEL_H_ 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_
6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 #include <list>
10 11
11 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "chrome/browser/tabs/tab_mru_list_manager.h"
12 #include "chrome/browser/tabs/tab_strip_model_observer.h" 14 #include "chrome/browser/tabs/tab_strip_model_observer.h"
13 #include "chrome/browser/tabs/tab_strip_selection_model.h" 15 #include "chrome/browser/tabs/tab_strip_selection_model.h"
14 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
16 #include "content/public/common/page_transition_types.h" 18 #include "content/public/common/page_transition_types.h"
17 19
18 class Profile; 20 class Profile;
19 class TabContentsWrapper; 21 class TabContentsWrapper;
20 class TabStripModelDelegate; 22 class TabStripModelDelegate;
21 class TabStripModelOrderController; 23 class TabStripModelOrderController;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 430
429 // Closes the selected tabs. 431 // Closes the selected tabs.
430 void CloseSelectedTabs(); 432 void CloseSelectedTabs();
431 433
432 // Select adjacent tabs 434 // Select adjacent tabs
433 void SelectNextTab(); 435 void SelectNextTab();
434 void SelectPreviousTab(); 436 void SelectPreviousTab();
435 437
436 // Selects the last tab in the tab strip. 438 // Selects the last tab in the tab strip.
437 void SelectLastTab(); 439 void SelectLastTab();
440 // Selectd the next tab in MRU list.
441 void SelectNextMRUTab();
438 442
439 // Swap adjacent tabs. 443 // Swap adjacent tabs.
440 void MoveTabNext(); 444 void MoveTabNext();
441 void MoveTabPrevious(); 445 void MoveTabPrevious();
442 446
443 // Notifies the observers that the active/foreground tab at |index| was 447 // Notifies the observers that the active/foreground tab at |index| was
444 // reselected (ie - it was already active and was clicked again). 448 // reselected (ie - it was already active and was clicked again).
445 void ActiveTabClicked(int index); 449 void ActiveTabClicked(int index);
446 450
447 // View API ////////////////////////////////////////////////////////////////// 451 // View API //////////////////////////////////////////////////////////////////
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // fall back to check the group relationship as well. 595 // fall back to check the group relationship as well.
592 struct TabContentsData; 596 struct TabContentsData;
593 static bool OpenerMatches(const TabContentsData* data, 597 static bool OpenerMatches(const TabContentsData* data,
594 const content::NavigationController* opener, 598 const content::NavigationController* opener,
595 bool use_group); 599 bool use_group);
596 600
597 // Sets the group/opener of any tabs that reference |tab| to NULL. 601 // Sets the group/opener of any tabs that reference |tab| to NULL.
598 void ForgetOpenersAndGroupsReferencing( 602 void ForgetOpenersAndGroupsReferencing(
599 const content::NavigationController* tab); 603 const content::NavigationController* tab);
600 604
605 // Tab Strip Most Recently used list management functions.
606 void TabMRUListRemoveContents(TabContentsWrapper* removed_contents);
607 void TabMRUListActivateContents(TabContentsWrapper* new_contents);
608 void TabMRUListReplaceContents(TabContentsWrapper* old_contents,
609 TabContentsWrapper* new_contents);
610
601 // Our delegate. 611 // Our delegate.
602 TabStripModelDelegate* delegate_; 612 TabStripModelDelegate* delegate_;
603 613
604 // A hunk of data representing a TabContentsWrapper and (optionally) the 614 // A hunk of data representing a TabContentsWrapper and (optionally) the
605 // NavigationController that spawned it. This memory only sticks around while 615 // NavigationController that spawned it. This memory only sticks around while
606 // the TabContentsWrapper is in the current TabStripModel, unless otherwise 616 // the TabContentsWrapper is in the current TabStripModel, unless otherwise
607 // specified in code. 617 // specified in code.
608 struct TabContentsData { 618 struct TabContentsData {
609 explicit TabContentsData(TabContentsWrapper* a_contents) 619 explicit TabContentsData(TabContentsWrapper* a_contents)
610 : contents(a_contents), 620 : contents(a_contents),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 // A profile associated with this TabStripModel, used when creating new Tabs. 681 // A profile associated with this TabStripModel, used when creating new Tabs.
672 Profile* profile_; 682 Profile* profile_;
673 683
674 // True if all tabs are currently being closed via CloseAllTabs. 684 // True if all tabs are currently being closed via CloseAllTabs.
675 bool closing_all_; 685 bool closing_all_;
676 686
677 // An object that determines where new Tabs should be inserted and where 687 // An object that determines where new Tabs should be inserted and where
678 // selection should move when a Tab is closed. 688 // selection should move when a Tab is closed.
679 TabStripModelOrderController* order_controller_; 689 TabStripModelOrderController* order_controller_;
680 690
691 // List manager that maintains the tab indices in the most recently
692 // visited order.
693 TabMRUListManager tab_mru_list_manager_;
694
681 // Our observers. 695 // Our observers.
682 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; 696 typedef ObserverList<TabStripModelObserver> TabStripModelObservers;
683 TabStripModelObservers observers_; 697 TabStripModelObservers observers_;
684 698
685 // A scoped container for notification registries. 699 // A scoped container for notification registries.
686 content::NotificationRegistrar registrar_; 700 content::NotificationRegistrar registrar_;
687 701
688 TabStripSelectionModel selection_model_; 702 TabStripSelectionModel selection_model_;
689 703
690 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel); 704 DISALLOW_IMPLICIT_CONSTRUCTORS(TabStripModel);
691 }; 705 };
692 706
693 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ 707 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698