diff options
author | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 00:39:58 +0000 |
---|---|---|
committer | idanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-20 00:39:58 +0000 |
commit | 26a9c996dc395cd77e44a77446346828ae3f48db (patch) | |
tree | f91f001c0e2df9235a36f6c1c7c6145725636a05 | |
parent | fedc4b5af0bceaa503d0056857c75b671a31870c (diff) | |
download | chromium_src-26a9c996dc395cd77e44a77446346828ae3f48db.zip chromium_src-26a9c996dc395cd77e44a77446346828ae3f48db.tar.gz chromium_src-26a9c996dc395cd77e44a77446346828ae3f48db.tar.bz2 |
Enable dragging of single tab between two windows.
To determine if a window is draggable, all that was needed is to call HasAvailableDrag action
instead of ContainsExactlyOneTab which was not we wanted anyways.
BUG=7861
Review URL: http://codereview.chromium.org/21525
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10068 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/tabs/tab.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab.h | 7 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 8 |
4 files changed, 9 insertions, 16 deletions
diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index 86f0b2c..576a84f 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -163,7 +163,7 @@ bool Tab::OnMousePressed(const views::MouseEvent& event) { // it dragged the whole window. This is done by sending a non-client // message which is handled by the default window procedure and causes // the window get the default drag-on-caption behavior. - if (delegate_->ContainsExactlyOneTab()) { + if (!delegate_->HasAvailableDragActions()) { SendMessage(GetWidget()->GetHWND(), WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(event.x(), event.y())); return false; diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h index 40577cf..8d3e50a 100644 --- a/chrome/browser/views/tabs/tab.h +++ b/chrome/browser/views/tabs/tab.h @@ -70,8 +70,11 @@ class Tab : public TabRenderer, // destroyed. virtual bool EndDrag(bool canceled) = 0; - // Returns true if only one tab exists. - virtual bool ContainsExactlyOneTab() const = 0; + // Returns true if the associated TabStrip's delegate supports tab moving or + // detaching. Used by the Frame to determine if dragging on the Tab + // itself should move the window in cases where there's only one + // non drag-able Tab. + virtual bool HasAvailableDragActions() const = 0; }; explicit Tab(TabDelegate* delegate); diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index efd7658..b8ad705 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -513,10 +513,6 @@ int TabStrip::GetPreferredHeight() { return GetPreferredSize().height(); } -bool TabStrip::HasAvailableDragActions() const { - return model_->delegate()->GetDragActions() != 0; -} - bool TabStrip::CanProcessInputEvents() const { return IsAnimating() == NULL; } @@ -1022,8 +1018,8 @@ bool TabStrip::EndDrag(bool canceled) { return drag_controller_.get() ? drag_controller_->EndDrag(canceled) : false; } -bool TabStrip::ContainsExactlyOneTab() const { - return GetTabCount() == 1; +bool TabStrip::HasAvailableDragActions() const { + return model_->delegate()->GetDragActions() != 0; } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 3dcf1a0..e2e322fc 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -47,12 +47,6 @@ class TabStrip : public views::View, // typical height of its constituent tabs. int GetPreferredHeight(); - // Returns true if the associated TabStrip's delegate supports tab moving or - // detaching. Used by the Frame to determine if dragging on the Tab - // itself should move the window in cases where there's only one - // non drag-able Tab. - bool HasAvailableDragActions() const; - // Returns true if the TabStrip can accept input events. This returns false // when the TabStrip is animating to a new state and as such the user should // not be allowed to interact with the TabStrip. @@ -142,7 +136,7 @@ class TabStrip : public views::View, virtual void MaybeStartDrag(Tab* tab, const views::MouseEvent& event); virtual void ContinueDrag(const views::MouseEvent& event); virtual bool EndDrag(bool canceled); - virtual bool ContainsExactlyOneTab() const; + virtual bool HasAvailableDragActions() const; // views::Button::ButtonListener implementation: virtual void ButtonPressed(views::BaseButton* sender); |