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

Unified Diff: chrome/browser/tabs/tab_strip_model.h

Issue 3105004: Adds support for showing the match preview on views. It's behind the (Closed)
Patch Set: Addressed review comments Created 10 years, 4 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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_delegate.cc ('k') | chrome/browser/tabs/tab_strip_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tabs/tab_strip_model.h
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index f26af59876b487c3948bb3938704a43a5e25cefc..542b27f8d9a450caf4ea7ef0def3fc067fcc5c71 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -54,6 +54,18 @@ class TabStripModelObserver {
ALL
};
+ // Enum used by ReplaceTabContentsAt.
+ // TODO(sky): TabReplaceType should be declared outside the scope of
+ // the observer. I need to put all the enums in a namespace and cleanup this
+ // file.
+ enum TabReplaceType {
+ // The replace is the result of the tab being made phantom.
+ REPLACE_MADE_PHANTOM,
+
+ // The replace is the result of the match preview being committed.
+ REPLACE_MATCH_PREVIEW
+ };
+
// A new TabContents was inserted into the TabStripModel at the specified
// index. |foreground| is whether or not it was opened in the foreground
// (selected).
@@ -100,8 +112,18 @@ class TabStripModelObserver {
// The tab contents was replaced at the specified index. This is invoked when
// a tab becomes phantom. See description of phantom tabs in class description
// of TabStripModel for details.
+ // TODO(sky): nuke this in favor of the 4 arg variant.
+ virtual void TabReplacedAt(TabContents* old_contents,
+ TabContents* new_contents,
+ int index);
+
+ // The tab contents was replaced at the specified index. |type| describes
+ // the type of replace.
+ // This invokes TabReplacedAt with three args.
virtual void TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents, int index);
+ TabContents* new_contents,
+ int index,
+ TabReplaceType type);
// Invoked when the pinned state of a tab changes. This is not invoked if the
// tab ends up moving as a result of the mini state changing.
@@ -433,6 +455,12 @@ class TabStripModel : public NotificationObserver {
void ReplaceNavigationControllerAt(int index,
NavigationController* controller);
+ // Replaces the tab contents at |index| with |new_contents|. |type| is passed
+ // to the observer. This deletes the TabContents currently at |index|.
+ void ReplaceTabContentsAt(int index,
+ TabContents* new_contents,
+ TabStripModelObserver::TabReplaceType type);
+
// Detaches the TabContents at the specified index from this strip. The
// TabContents is not destroyed, just removed from display. The caller is
// responsible for doing something with it (e.g. stuffing it into another
@@ -725,6 +753,13 @@ class TabStripModel : public NotificationObserver {
const NavigationController* opener,
bool use_group);
+ // Does the work for ReplaceTabContentsAt returning the old TabContents.
+ // The caller owns the returned TabContents.
+ TabContents* ReplaceTabContentsAtImpl(
+ int index,
+ TabContents* new_contents,
+ TabStripModelObserver::TabReplaceType type);
+
// Our delegate.
TabStripModelDelegate* delegate_;
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_delegate.cc ('k') | chrome/browser/tabs/tab_strip_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698