Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Side by Side Diff: chrome/browser/ui/views/tabs/dragged_tab_view.cc

Issue 14348033: NOT FOR SUBMIT - Windows Views HiDPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moving windows code into ifdef's Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h" 5 #include "chrome/browser/ui/views/tabs/dragged_tab_view.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" 8 #include "chrome/browser/ui/views/tabs/native_view_photobooth.h"
9 #include "third_party/skia/include/core/SkShader.h" 9 #include "third_party/skia/include/core/SkShader.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
11 #include "ui/views/widget/widget.h" 11 #include "ui/views/widget/widget.h"
12 12
13 #if defined(USE_AURA) 13 #if defined(USE_AURA)
14 #include "ui/views/widget/native_widget_aura.h" 14 #include "ui/views/widget/native_widget_aura.h"
15 #elif defined(OS_WIN) 15 #elif defined(OS_WIN)
16 #include "ui/base/win/dpi.h"
16 #include "ui/views/widget/native_widget_win.h" 17 #include "ui/views/widget/native_widget_win.h"
17 #endif 18 #endif
18 19
19 static const int kTransparentAlpha = 200; 20 static const int kTransparentAlpha = 200;
20 static const int kOpaqueAlpha = 255; 21 static const int kOpaqueAlpha = 255;
21 static const int kDragFrameBorderSize = 2; 22 static const int kDragFrameBorderSize = 2;
22 static const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; 23 static const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize;
23 static const float kScalingFactor = 0.5; 24 static const float kScalingFactor = 0.5;
24 static const SkColor kDraggedTabBorderColor = SkColorSetRGB(103, 129, 162); 25 static const SkColor kDraggedTabBorderColor = SkColorSetRGB(103, 129, 162);
25 26
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // On RTL locales, a dragged tab (when it is not attached to a tab strip) 74 // On RTL locales, a dragged tab (when it is not attached to a tab strip)
74 // is rendered using a right-to-left orientation so we should calculate the 75 // is rendered using a right-to-left orientation so we should calculate the
75 // window position differently. 76 // window position differently.
76 gfx::Size ps = GetPreferredSize(); 77 gfx::Size ps = GetPreferredSize();
77 x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width()); 78 x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width());
78 } else { 79 } else {
79 x = screen_point.x() - ScaleValue(mouse_tab_offset_.x()); 80 x = screen_point.x() - ScaleValue(mouse_tab_offset_.x());
80 } 81 }
81 int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y()); 82 int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y());
82 83
84 #if defined(OS_WIN)
kevers 2013/06/03 17:28:50 Has this change been tested on Aura? If for non-A
girard 2013/06/03 22:31:55 Done.
85 double scale = ui::win::GetDeviceScaleFactor();
86 x = static_cast<int>(scale * screen_point.x());
87 y = static_cast<int>(scale * screen_point.y());
88 #endif
83 #if defined(OS_WIN) && !defined(USE_AURA) 89 #if defined(OS_WIN) && !defined(USE_AURA)
84 // TODO(beng): make this cross-platform 90 // TODO(beng): make this cross-platform
85 int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW; 91 int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW;
86 SetWindowPos(container_->GetNativeView(), HWND_TOP, x, y, 0, 0, 92 SetWindowPos(container_->GetNativeView(), HWND_TOP, x, y, 0, 0,
87 SWP_NOSIZE | SWP_NOACTIVATE | show_flags); 93 SWP_NOSIZE | SWP_NOACTIVATE | show_flags);
88 #else 94 #else
89 gfx::Rect bounds = container_->GetWindowBoundsInScreen(); 95 gfx::Rect bounds = container_->GetWindowBoundsInScreen();
90 container_->SetBounds(gfx::Rect(x, y, bounds.width(), bounds.height())); 96 container_->SetBounds(gfx::Rect(x, y, bounds.width(), bounds.height()));
91 if (!container_->IsVisible()) 97 if (!container_->IsVisible())
92 container_->Show(); 98 container_->Show();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 185 }
180 186
181 gfx::Size DraggedTabView::PreferredContainerSize() { 187 gfx::Size DraggedTabView::PreferredContainerSize() {
182 gfx::Size ps = GetPreferredSize(); 188 gfx::Size ps = GetPreferredSize();
183 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); 189 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height()));
184 } 190 }
185 191
186 int DraggedTabView::ScaleValue(int value) { 192 int DraggedTabView::ScaleValue(int value) {
187 return static_cast<int>(value * kScalingFactor); 193 return static_cast<int>(value * kScalingFactor);
188 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698