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

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

Issue 137993009: Remove more non-aura windows code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: renable the disabled tests Created 6 years, 11 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 | Annotate | Revision Log
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"
(...skipping 62 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) 73 // 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 74 // is rendered using a right-to-left orientation so we should calculate the
75 // window position differently. 75 // window position differently.
76 gfx::Size ps = GetPreferredSize(); 76 gfx::Size ps = GetPreferredSize();
77 x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width()); 77 x = screen_point.x() + ScaleValue(mouse_tab_offset_.x() - ps.width());
78 } else { 78 } else {
79 x = screen_point.x() - ScaleValue(mouse_tab_offset_.x()); 79 x = screen_point.x() - ScaleValue(mouse_tab_offset_.x());
80 } 80 }
81 int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y()); 81 int y = screen_point.y() - ScaleValue(mouse_tab_offset_.y());
82 82
83 #if defined(OS_WIN) && !defined(USE_AURA)
84 double scale = gfx::win::GetDeviceScaleFactor();
85 x = static_cast<int>(scale * screen_point.x());
86 y = static_cast<int>(scale * screen_point.y());
87 // TODO(beng): make this cross-platform
88 int show_flags = container_->IsVisible() ? SWP_NOZORDER : SWP_SHOWWINDOW;
89 SetWindowPos(container_->GetNativeView(), HWND_TOP, x, y, 0, 0,
90 SWP_NOSIZE | SWP_NOACTIVATE | show_flags);
91 #else
92 gfx::Rect bounds = container_->GetWindowBoundsInScreen(); 83 gfx::Rect bounds = container_->GetWindowBoundsInScreen();
93 container_->SetBounds(gfx::Rect(x, y, bounds.width(), bounds.height())); 84 container_->SetBounds(gfx::Rect(x, y, bounds.width(), bounds.height()));
94 if (!container_->IsVisible()) 85 if (!container_->IsVisible())
95 container_->Show(); 86 container_->Show();
96 #endif
97 } 87 }
98 88
99 void DraggedTabView::Update() { 89 void DraggedTabView::Update() {
100 SchedulePaint(); 90 SchedulePaint();
101 } 91 }
102 92
103 /////////////////////////////////////////////////////////////////////////////// 93 ///////////////////////////////////////////////////////////////////////////////
104 // DraggedTabView, views::View overrides: 94 // DraggedTabView, views::View overrides:
105 95
106 void DraggedTabView::OnPaint(gfx::Canvas* canvas) { 96 void DraggedTabView::OnPaint(gfx::Canvas* canvas) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 172 }
183 173
184 gfx::Size DraggedTabView::PreferredContainerSize() { 174 gfx::Size DraggedTabView::PreferredContainerSize() {
185 gfx::Size ps = GetPreferredSize(); 175 gfx::Size ps = GetPreferredSize();
186 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height())); 176 return gfx::Size(ScaleValue(ps.width()), ScaleValue(ps.height()));
187 } 177 }
188 178
189 int DraggedTabView::ScaleValue(int value) { 179 int DraggedTabView::ScaleValue(int value) {
190 return static_cast<int>(value * kScalingFactor); 180 return static_cast<int>(value * kScalingFactor);
191 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698