diff options
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_view.cc | 18 | ||||
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_view.h | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index 1977f56..df143e5 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -29,6 +29,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, : container_(NULL), renderer_(new TabRenderer), attached_(false), + show_contents_on_drag_(true), mouse_tab_offset_(mouse_tab_offset), attached_tab_size_(TabRenderer::GetMinimumSelectedSize()), photobooth_(NULL), @@ -46,6 +47,12 @@ DraggedTabView::DraggedTabView(TabContents* datasource, container_->set_can_update_layered_window(false); container_->Init(NULL, gfx::Rect(0, 0, 0, 0), false); container_->SetContentsView(this); + + BOOL drag; + if ((::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &drag, 0) != 0) && + (drag == FALSE)) { + show_contents_on_drag_ = false; + } } DraggedTabView::~DraggedTabView() { @@ -142,7 +149,9 @@ void DraggedTabView::AnimationCanceled(const Animation* animation) { // DraggedTabView, views::View overrides: void DraggedTabView::Paint(ChromeCanvas* canvas) { - if (attached_) { + if (!show_contents_on_drag_) { + PaintFocusRect(canvas); + } else if (attached_) { PaintAttachedTab(canvas); } else { PaintDetachedView(canvas); @@ -227,6 +236,13 @@ void DraggedTabView::PaintDetachedView(ChromeCanvas* canvas) { canvas->drawRect(rc, paint); } +void DraggedTabView::PaintFocusRect(ChromeCanvas* canvas) { + gfx::Size ps = GetPreferredSize(); + canvas->DrawFocusRect(0, 0, + static_cast<int>(ps.width() * kScalingFactor), + static_cast<int>(ps.height() * kScalingFactor)); +} + void DraggedTabView::ResizeContainer() { gfx::Size ps = GetPreferredSize(); SetWindowPos(container_->GetNativeView(), HWND_TOPMOST, 0, 0, diff --git a/chrome/browser/views/tabs/dragged_tab_view.h b/chrome/browser/views/tabs/dragged_tab_view.h index 1b55654..f73d8eb 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.h +++ b/chrome/browser/views/tabs/dragged_tab_view.h @@ -69,6 +69,9 @@ class DraggedTabView : public views::View, // Paint the view, when it's not attached to any TabStrip. void PaintDetachedView(ChromeCanvas* canvas); + // Paint the view, when "Show window contents while dragging" is disabled. + void PaintFocusRect(ChromeCanvas* canvas); + // Resizes the container to fit the content for the current attachment mode. void ResizeContainer(); @@ -85,6 +88,9 @@ class DraggedTabView : public views::View, // and sizing modes. bool attached_; + // True if "Show window contents while dragging" is enabled. + bool show_contents_on_drag_; + // The unscaled offset of the mouse from the top left of the dragged Tab. // This is used to maintain an appropriate offset for the mouse pointer when // dragging scaled and unscaled representations, and also to calculate the |