summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 23:19:42 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-15 23:19:42 +0000
commitb680ad2269af98da01b992e15130e18bfcb7783c (patch)
treed20c4bf1b3eec9ba7cc761b5a93985eccbe22ed8 /chrome/browser/tabs
parent7fd4cc37ca4361f04bb45da1ec06210e84c7c303 (diff)
downloadchromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.zip
chromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.tar.gz
chromium_src-b680ad2269af98da01b992e15130e18bfcb7783c.tar.bz2
Remove TabContnetsType from everywhere.
I also removed the notion of the "active" tab contents since there is only one per tab now, and all the messages to replace them. Review URL: http://codereview.chromium.org/67173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc17
-rw-r--r--chrome/browser/tabs/tab_strip_model.h5
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc59
3 files changed, 13 insertions, 68 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 59665df..c4b5ecd 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -153,23 +153,6 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
ChangeSelectedContentsFrom(GetSelectedTabContents(), index, user_gesture);
}
-void TabStripModel::ReplaceTabContentsAt(int index,
- TabContents* replacement_contents) {
- DCHECK(ContainsIndex(index));
- TabContents* old_contents = GetContentsAt(index);
- contents_data_[index]->contents = replacement_contents;
-
- FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabChangedAt(replacement_contents, index, false));
-
- // Re-use the logic for selecting tabs to ensure the replacement contents is
- // shown and sized appropriately.
- if (index == selected_index_) {
- FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabSelectedAt(old_contents, replacement_contents, index, false));
- }
-}
-
void TabStripModel::MoveTabContentsAt(int index, int to_position) {
DCHECK(ContainsIndex(index));
if (index == to_position)
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 5530f8b..c6b7c76 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -282,11 +282,6 @@ class TabStripModel : public NotificationObserver {
// action.
void SelectTabContentsAt(int index, bool user_gesture);
- // Replace the TabContents at the specified index with another TabContents.
- // This is used when a navigation causes a different TabContentsType to be
- // required, e.g. the transition from New Tab to a web page.
- void ReplaceTabContentsAt(int index, TabContents* replacement_contents);
-
// Move the TabContents at the specified index to another index. This method
// does NOT send Detached/Attached notifications, rather it moves the
// TabContents inline and sends a Moved notification instead.
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 056ff5f..f5b7028 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -288,38 +288,6 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
observer.ClearStates();
}
- // Test ReplaceTabContentsAt, replacing the selected index
- TabContents* replacement_contents3 = CreateTabContents();
- {
- tabstrip.ReplaceTabContentsAt(2, replacement_contents3);
- // ReplaceTabContentsAt doesn't delete the source. It depends on
- // NavigationCollector, which is not part of this test.
- contents3->Destroy();
-
- EXPECT_EQ(2, observer.GetStateCount());
- State s1(replacement_contents3, 2, MockTabStripModelObserver::CHANGE);
- EXPECT_TRUE(observer.StateEquals(0, s1));
- State s2(replacement_contents3, 2, MockTabStripModelObserver::SELECT);
- s2.src_contents = contents3;
- s2.user_gesture = false;
- EXPECT_TRUE(observer.StateEquals(1, s2));
- observer.ClearStates();
- }
-
- // Test ReplaceTabContentsAt, replacing NOT the selected index
- TabContents* replacement_contents2 = CreateTabContents();
- {
- tabstrip.ReplaceTabContentsAt(1, replacement_contents2);
- // ReplaceTabContentsAt doesn't delete the source. It depends on
- // NavigationCollector, which is not part of this test.
- contents2->Destroy();
-
- EXPECT_EQ(1, observer.GetStateCount());
- State s1(replacement_contents2, 1, MockTabStripModelObserver::CHANGE);
- EXPECT_TRUE(observer.StateEquals(0, s1));
- observer.ClearStates();
- }
-
// Test DetachTabContentsAt
{
// Detach
@@ -329,15 +297,15 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
EXPECT_EQ(4, observer.GetStateCount());
State s1(detached, 2, MockTabStripModelObserver::DETACH);
EXPECT_TRUE(observer.StateEquals(0, s1));
- State s2(replacement_contents2, 1, MockTabStripModelObserver::SELECT);
- s2.src_contents = replacement_contents3;
+ State s2(contents2, 1, MockTabStripModelObserver::SELECT);
+ s2.src_contents = contents3;
s2.user_gesture = false;
EXPECT_TRUE(observer.StateEquals(1, s2));
State s3(detached, 2, MockTabStripModelObserver::INSERT);
s3.foreground = true;
EXPECT_TRUE(observer.StateEquals(2, s3));
State s4(detached, 2, MockTabStripModelObserver::SELECT);
- s4.src_contents = replacement_contents2;
+ s4.src_contents = contents2;
s4.user_gesture = false;
EXPECT_TRUE(observer.StateEquals(3, s4));
observer.ClearStates();
@@ -349,12 +317,12 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
EXPECT_EQ(2, tabstrip.count());
EXPECT_EQ(3, observer.GetStateCount());
- State s1(replacement_contents3, 2, MockTabStripModelObserver::CLOSE);
+ State s1(contents3, 2, MockTabStripModelObserver::CLOSE);
EXPECT_TRUE(observer.StateEquals(0, s1));
- State s2(replacement_contents3, 2, MockTabStripModelObserver::DETACH);
+ State s2(contents3, 2, MockTabStripModelObserver::DETACH);
EXPECT_TRUE(observer.StateEquals(1, s2));
- State s3(replacement_contents2, 1, MockTabStripModelObserver::SELECT);
- s3.src_contents = replacement_contents3;
+ State s3(contents2, 1, MockTabStripModelObserver::SELECT);
+ s3.src_contents = contents3;
s3.user_gesture = false;
EXPECT_TRUE(observer.StateEquals(2, s3));
observer.ClearStates();
@@ -365,7 +333,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
tabstrip.MoveTabContentsAt(1, 0);
EXPECT_EQ(1, observer.GetStateCount());
- State s1(replacement_contents2, 0, MockTabStripModelObserver::MOVE);
+ State s1(contents2, 0, MockTabStripModelObserver::MOVE);
s1.src_index = 1;
EXPECT_TRUE(observer.StateEquals(0, s1));
observer.ClearStates();
@@ -373,13 +341,12 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// Test Getters
{
- EXPECT_EQ(replacement_contents2, tabstrip.GetSelectedTabContents());
- EXPECT_EQ(replacement_contents2, tabstrip.GetTabContentsAt(0));
+ EXPECT_EQ(contents2, tabstrip.GetSelectedTabContents());
+ EXPECT_EQ(contents2, tabstrip.GetTabContentsAt(0));
EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1));
- EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(replacement_contents2));
+ EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(contents2));
EXPECT_EQ(1, tabstrip.GetIndexOfTabContents(contents1));
- EXPECT_EQ(0, tabstrip.GetIndexOfController(
- replacement_contents2->controller()));
+ EXPECT_EQ(0, tabstrip.GetIndexOfController(contents2->controller()));
EXPECT_EQ(1, tabstrip.GetIndexOfController(contents1->controller()));
}
@@ -387,7 +354,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
{
tabstrip.UpdateTabContentsStateAt(0, false);
EXPECT_EQ(1, observer.GetStateCount());
- State s1(replacement_contents2, 0, MockTabStripModelObserver::CHANGE);
+ State s1(contents2, 0, MockTabStripModelObserver::CHANGE);
EXPECT_TRUE(observer.StateEquals(0, s1));
observer.ClearStates();
}