Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index d31126bf3642cd27a150f1735d3b6e17d8c47ea4..e149c4e952bca00abad5fbde2a09328683a3d0f9 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -58,6 +58,8 @@ |
#include "content/public/common/content_restriction.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/common/url_constants.h" |
+#include "ui/gfx/monitor.h" |
+#include "ui/gfx/screen.h" |
#include "net/base/mime_util.h" |
#include "net/base/net_util.h" |
#include "net/base/network_change_notifier.h" |
@@ -505,12 +507,14 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, |
prefs.accelerated_2d_canvas_enabled = false; |
} |
- int default_device_scale_factor; |
- base::StringToInt(command_line.GetSwitchValueASCII( |
- switches::kDefaultDeviceScaleFactor), |
- &default_device_scale_factor); |
- |
- prefs.default_device_scale_factor = default_device_scale_factor; |
+ if (rvh->GetView()) { |
+ gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow( |
+ rvh->GetView()->GetNativeView()); |
+ prefs.default_device_scale_factor = |
+ static_cast<int>(monitor.device_scale_factor()); |
+ } else { |
+ prefs.default_device_scale_factor = 1; |
sadrul
2012/04/30 15:15:49
From this change, it looks like it won't be possib
oshima
2012/04/30 17:25:25
Good question. This is not used officially (as thi
|
+ } |
content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); |