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

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 1426933002: Refactor Windows DPI Point, Rect, and Size for Multiple Monitor DPI Awareness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Other Unit Tests - Moved Inner Classes Outside Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 618d77449607e2a0d5878b299838f0acf951d633..6f2300dadb3e544f2924d853eae8e6c0e5fa50f1 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -61,7 +61,7 @@
#if defined(OS_WIN)
#include "ui/base/win/shell.h"
-#include "ui/gfx/win/dpi.h"
+#include "ui/gfx/screen_win.h"
#endif
DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(VIEWS_EXPORT,
@@ -689,18 +689,9 @@ gfx::Rect DesktopNativeWidgetAura::GetRestoredBounds() const {
void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
if (!content_window_)
return;
- // TODO(ananta)
- // This code by default scales the bounds rectangle by 1.
- // We could probably get rid of this and similar logic from
- // the DesktopNativeWidgetAura::OnWindowTreeHostResized function.
- float scale = 1;
aura::Window* root = host_->window();
- if (root) {
- scale = gfx::Screen::GetScreenFor(root)->
- GetDisplayNearestWindow(root).device_scale_factor();
- }
- gfx::Rect bounds_in_pixels =
- gfx::ScaleToEnclosingRect(bounds, scale, scale);
+ gfx::Screen* screen = gfx::Screen::GetScreenFor(root);
+ gfx::Rect bounds_in_pixels = screen->DIPToScreenRectInWindow(root, bounds);
desktop_window_tree_host_->AsWindowTreeHost()->SetBounds(bounds_in_pixels);
}

Powered by Google App Engine
This is Rietveld 408576698