Index: ui/gfx/screen_android.cc |
diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc |
index a80582e077d22e1ff373c70f50f66cec6a534778..0da3f250fb144e579b92e5642c4b638ae528a709 100644 |
--- a/ui/gfx/screen_android.cc |
+++ b/ui/gfx/screen_android.cc |
@@ -5,7 +5,9 @@ |
#include "ui/gfx/screen.h" |
#include "base/logging.h" |
+#include "ui/gfx/android/device_info.h" |
#include "ui/gfx/display.h" |
+#include "ui/gfx/size_conversions.h" |
namespace gfx { |
@@ -14,7 +16,7 @@ class ScreenAndroid : public Screen { |
ScreenAndroid() {} |
bool IsDIPEnabled() OVERRIDE { |
- return false; |
+ return true; |
} |
gfx::Point GetCursorScreenPoint() OVERRIDE { |
@@ -27,8 +29,18 @@ class ScreenAndroid : public Screen { |
} |
gfx::Display GetPrimaryDisplay() const OVERRIDE { |
- NOTIMPLEMENTED() << "crbug.com/117839 tracks implementation"; |
- return gfx::Display(0, gfx::Rect(0, 0, 1, 1)); |
+ gfx::DeviceInfo device_info; |
+ const float device_scale_factor = device_info.GetDIPScale(); |
+ const gfx::Rect bounds_in_pixels = |
+ gfx::Rect( |
+ device_info.GetDisplayWidth(), |
+ device_info.GetDisplayHeight()); |
+ const gfx::Rect bounds_in_dip = |
+ gfx::Rect(gfx::ToRoundedSize(gfx::ScaleSize( |
+ bounds_in_pixels.size(), 1.0f / device_scale_factor))); |
+ gfx::Display display(0, bounds_in_dip); |
+ display.set_device_scale_factor(device_scale_factor); |
+ return display; |
} |
gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const OVERRIDE { |