| Index: ui/views/widget/desktop_aura/desktop_screen_x11.cc | 
| diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc | 
| index e37e602ad3d252d63d95b5ebe13271bf5aa7392f..019688fb9463fb518681202d611a0fc90160a6b2 100644 | 
| --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc | 
| +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc | 
| @@ -25,7 +25,6 @@ | 
| #include "ui/gfx/native_widget_types.h" | 
| #include "ui/gfx/screen.h" | 
| #include "ui/gfx/x/x11_types.h" | 
| -#include "ui/views/linux_ui/linux_ui.h" | 
| #include "ui/views/widget/desktop_aura/desktop_screen.h" | 
| #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 
| #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 
| @@ -36,12 +35,21 @@ | 
| // in |Dispatch()|. | 
| const int64 kConfigureDelayMs = 500; | 
|  | 
| -double GetDeviceScaleFactor() { | 
| -  float device_scale_factor = 1.0f; | 
| -  if (views::LinuxUI::instance()) | 
| -    device_scale_factor = | 
| -      views::LinuxUI::instance()->GetDeviceScaleFactor(); | 
| -  return device_scale_factor; | 
| +// TODO(oshima): Consider using gtk-xft-dpi instead. | 
| +float GetDeviceScaleFactor(int screen_pixels, int screen_mm) { | 
| +  const int kCSSDefaultDPI = 96; | 
| +  const float kInchInMm = 25.4f; | 
| + | 
| +  float screen_inches = screen_mm / kInchInMm; | 
| +  float screen_dpi = screen_pixels / screen_inches; | 
| +  float scale = screen_dpi / kCSSDefaultDPI; | 
| + | 
| +  return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale)); | 
| +} | 
| + | 
| +float GetDeviceScaleFactor() { | 
| +  gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 
| +  return display.device_scale_factor(); | 
| } | 
|  | 
| gfx::Point PixelToDIPPoint(const gfx::Point& pixel_point) { | 
| @@ -63,7 +71,8 @@ | 
| gfx::Display gfx_display(0, bounds_in_pixels); | 
| if (!gfx::Display::HasForceDeviceScaleFactor() && | 
| !ui::IsDisplaySizeBlackListed(physical_size)) { | 
| -    const float device_scale_factor = GetDeviceScaleFactor(); | 
| +    float device_scale_factor = GetDeviceScaleFactor( | 
| +        width, physical_size.width()); | 
| DCHECK_LE(1.0f, device_scale_factor); | 
| gfx_display.SetScaleAndBounds(device_scale_factor, bounds_in_pixels); | 
| } | 
| @@ -285,10 +294,7 @@ | 
| has_work_area = true; | 
| } | 
|  | 
| -  // As per-display scale factor is not supported right now, | 
| -  // the X11 root window's scale factor is always used. | 
| -  const float device_scale_factor = | 
| -      views::LinuxUI::instance()->GetDeviceScaleFactor(); | 
| +  float device_scale_factor = 1.0f; | 
| for (int i = 0; i < resources->noutput; ++i) { | 
| RROutput output_id = resources->outputs[i]; | 
| gfx::XScopedPtr<XRROutputInfo, | 
| @@ -315,6 +321,14 @@ | 
| gfx::Display display(display_id, crtc_bounds); | 
|  | 
| if (!gfx::Display::HasForceDeviceScaleFactor()) { | 
| +        if (i == 0 && !ui::IsDisplaySizeBlackListed( | 
| +            gfx::Size(output_info->mm_width, output_info->mm_height))) { | 
| +          // As per display scale factor is not supported right now, | 
| +          // the primary display's scale factor is always used. | 
| +          device_scale_factor = GetDeviceScaleFactor(crtc->width, | 
| +                                                     output_info->mm_width); | 
| +          DCHECK_LE(1.0f, device_scale_factor); | 
| +        } | 
| display.SetScaleAndBounds(device_scale_factor, crtc_bounds); | 
| } | 
|  | 
|  |