summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 18:25:36 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-12 18:25:36 +0000
commit1464aebf26b67a6ca506fe9d329ca8b1af64e3e4 (patch)
treebad80f491b3eb56543288af5c7061b311be80c6c /chrome/browser/views
parentc624507dbe5892007a3963be18b524c4b9cf1bea (diff)
downloadchromium_src-1464aebf26b67a6ca506fe9d329ca8b1af64e3e4.zip
chromium_src-1464aebf26b67a6ca506fe9d329ca8b1af64e3e4.tar.gz
chromium_src-1464aebf26b67a6ca506fe9d329ca8b1af64e3e4.tar.bz2
Use the standard dotted rectangle when moving a tab out when "Show window
contents while dragging" is disabled. BUG=805 Patch contributed by Yusuke Sato (yusukes@google.com) Review: http://codereview.chromium.org/113176 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.cc18
-rw-r--r--chrome/browser/views/tabs/dragged_tab_view.h6
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