summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
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/browser.cc
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/browser.cc')
-rw-r--r--chrome/browser/browser.cc34
1 files changed, 2 insertions, 32 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index d87171b..99f1d3f 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1750,41 +1750,14 @@ void Browser::NavigationStateChanged(const TabContents* source,
UpdateCommandsForTabState();
}
-void Browser::ReplaceContents(TabContents* source, TabContents* new_contents) {
- source->set_delegate(NULL);
- new_contents->set_delegate(this);
-
- RemoveScheduledUpdatesFor(source);
-
- int index = tabstrip_model_.GetIndexOfTabContents(source);
- tabstrip_model_.ReplaceTabContentsAt(index, new_contents);
-
- if (is_attempting_to_close_browser_) {
- // Need to do this asynchronously as it will close the tab, which is
- // currently on the call stack above us.
- MessageLoop::current()->PostTask(FROM_HERE,
- method_factory_.NewRunnableMethod(&Browser::ClearUnloadState,
- Source<TabContents>(source).ptr()));
- }
- // Need to remove ourselves as an observer for disconnection on the replaced
- // TabContents, since we only care to fire onbeforeunload handlers on active
- // Tabs. Make sure an observer is added for the replacement TabContents.
- NotificationService::current()->RemoveObserver(
- this,
- NotificationType::WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(source));
- NotificationService::current()->AddObserver(
- this,
- NotificationType::WEB_CONTENTS_DISCONNECTED,
- Source<TabContents>(new_contents));
-}
-
void Browser::AddNewContents(TabContents* source,
TabContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
DCHECK(disposition != SAVE_TO_DISK); // No code for this yet
+ DCHECK(disposition != CURRENT_TAB); // Can't create a new contents for the
+ // current tab.
// If this is an application we can only have one tab so we need to process
// this in tabbed browser window.
@@ -1813,8 +1786,6 @@ void Browser::AddNewContents(TabContents* source,
browser->AddNewContents(source, new_contents, NEW_FOREGROUND_TAB,
initial_pos, user_gesture);
browser->window()->Show();
- } else if (disposition == CURRENT_TAB) {
- ReplaceContents(source, new_contents);
} else if (disposition != SUPPRESS_OPEN) {
tabstrip_model_.AddTabContents(new_contents, -1, PageTransition::LINK,
disposition == NEW_FOREGROUND_TAB);
@@ -2368,7 +2339,6 @@ void Browser::ProcessPendingUIUpdates() {
if (contents == GetSelectedTabContents()) {
TabContents* current_tab = GetSelectedTabContents();
command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
- current_tab->type() == TAB_CONTENTS_WEB &&
!current_tab->GetFavIcon().isNull());
}
}