summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/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/views/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/views/tabs')
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.cc41
-rw-r--r--chrome/browser/views/tabs/dragged_tab_controller.h13
2 files changed, 9 insertions, 45 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc
index b4d9f15..fc5d0e1 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/views/tabs/dragged_tab_controller.cc
@@ -261,7 +261,7 @@ DraggedTabController::DraggedTabController(Tab* source_tab,
old_focused_view_(NULL),
in_destructor_(false),
last_move_screen_x_(0) {
- ChangeDraggedContents(
+ SetDraggedContents(
source_tabstrip_->model()->GetTabContentsAt(source_model_index_));
// Listen for Esc key presses.
MessageLoopForUI::current()->AddObserver(this);
@@ -276,7 +276,7 @@ DraggedTabController::~DraggedTabController() {
// bounds, it won't be able to clean up properly since its cleanup routine
// uses GetIndexForDraggedContents, which will be invalid.
view_.reset(NULL);
- ChangeDraggedContents(NULL); // This removes our observer.
+ SetDraggedContents(NULL); // This removes our observer.
}
void DraggedTabController::CaptureDragInfo(const gfx::Point& mouse_offset) {
@@ -339,45 +339,16 @@ void DraggedTabController::NavigationStateChanged(const TabContents* source,
view_->Update();
}
-void DraggedTabController::ReplaceContents(TabContents* source,
- TabContents* new_contents) {
- DCHECK(dragged_contents_ == source);
-
- // If we're attached to a TabStrip, we need to tell the TabStrip that this
- // TabContents was replaced.
- if (attached_tabstrip_ && dragged_contents_) {
- if (original_delegate_) {
- original_delegate_->ReplaceContents(source, new_contents);
- // ReplaceContents on the original delegate is going to reset the delegate
- // for us. We need to unset original_delegate_ here so that
- // ChangeDraggedContents doesn't attempt to restore the delegate to the
- // wrong value.
- original_delegate_ = NULL;
- } else if (attached_tabstrip_->model()) {
- int index =
- attached_tabstrip_->model()->GetIndexOfTabContents(dragged_contents_);
- if (index != TabStripModel::kNoTab)
- attached_tabstrip_->model()->ReplaceTabContentsAt(index, new_contents);
- }
- }
-
- // Update our internal state.
- ChangeDraggedContents(new_contents);
-
- if (view_.get())
- view_->Update();
-}
-
void DraggedTabController::AddNewContents(TabContents* source,
TabContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture) {
+ DCHECK(disposition != CURRENT_TAB);
+
// Theoretically could be called while dragging if the page tries to
// spawn a window. Route this message back to the browser in most cases.
- if (disposition == CURRENT_TAB) {
- ReplaceContents(source, new_contents);
- } else if (original_delegate_) {
+ if (original_delegate_) {
original_delegate_->AddNewContents(source, new_contents, disposition,
initial_pos, user_gesture);
}
@@ -501,7 +472,7 @@ void DraggedTabController::UpdateDockInfo(const gfx::Point& screen_point) {
}
}
-void DraggedTabController::ChangeDraggedContents(TabContents* new_contents) {
+void DraggedTabController::SetDraggedContents(TabContents* new_contents) {
if (dragged_contents_) {
NotificationService::current()->RemoveObserver(
this,
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.h b/chrome/browser/views/tabs/dragged_tab_controller.h
index b03b0cb..00b715b 100644
--- a/chrome/browser/views/tabs/dragged_tab_controller.h
+++ b/chrome/browser/views/tabs/dragged_tab_controller.h
@@ -92,8 +92,6 @@ class DraggedTabController : public TabContentsDelegate,
PageTransition::Type transition);
virtual void NavigationStateChanged(const TabContents* source,
unsigned changed_flags);
- virtual void ReplaceContents(TabContents* source,
- TabContents* new_contents);
virtual void AddNewContents(TabContents* source,
TabContents* new_contents,
WindowOpenDisposition disposition,
@@ -127,11 +125,8 @@ class DraggedTabController : public TabContentsDelegate,
void UpdateDockInfo(const gfx::Point& screen_point);
- // Replaces the TabContents being dragged with the specified |new_contents|.
- // This can occur if the active TabContents for the tab being dragged is
- // replaced, e.g. if a transition from one TabContentsType to another occurs
- // during the drag.
- void ChangeDraggedContents(TabContents* new_contents);
+ // Sets the TabContents being dragged with the specified |new_contents|.
+ void SetDraggedContents(TabContents* new_contents);
// Saves focus in the window that the drag initiated from. Focus will be
// restored appropriately if the drag ends within this same window.
@@ -228,9 +223,7 @@ class DraggedTabController : public TabContentsDelegate,
void BringWindowUnderMouseToFront();
- // The TabContents being dragged. This can get replaced during the drag if
- // the associated NavigationController is navigated to a different
- // TabContentsType.
+ // The TabContents being dragged.
TabContents* dragged_contents_;
// The original TabContentsDelegate of |dragged_contents_|, before it was