Index: content/shell/browser/shell.cc |
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc |
index 81c9cad0b32bd3d91b7e15e28506a990da3b9cc1..19cea526e8abc4a1735ff9a00df231843021b923 100644 |
--- a/content/shell/browser/shell.cc |
+++ b/content/shell/browser/shell.cc |
@@ -22,6 +22,7 @@ |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/render_widget_host.h" |
+#include "content/public/browser/render_widget_host_view.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/common/content_switches.h" |
@@ -38,6 +39,12 @@ |
#include "content/shell/browser/shell_javascript_dialog_manager.h" |
#include "content/shell/common/shell_messages.h" |
#include "content/shell/common/shell_switches.h" |
+#include "ui/gfx/display.h" |
+#include "ui/gfx/switches.h" |
+ |
+#if defined(USE_X11) && !defined(OS_CHROMEOS) |
+#include "ui/views/test/desktop_screen_x11_test_api.h" |
+#endif |
namespace content { |
@@ -387,6 +394,19 @@ bool Shell::HandleContextMenu(const content::ContextMenuParams& params) { |
return PlatformHandleContextMenu(params); |
} |
+void Shell::SetDeviceScaleFactor(float scale) { |
+#if !defined(OS_CHROMEOS) |
+ gfx::Display::ResetForceDeviceScaleFactorForTesting(); |
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
+ switches::kForceDeviceScaleFactor, base::StringPrintf("%f", scale)); |
+#if defined(USE_X11) |
+ views::test::DesktopScreenX11TestApi::UpdateDisplays(); |
+#endif |
+#endif |
+ RenderWidgetHostView* host_view = web_contents_->GetRenderWidgetHostView(); |
+ host_view->SetSize(host_view->GetViewBounds().size()); |
+} |
+ |
gfx::Size Shell::GetShellDefaultSize() { |
static gfx::Size default_shell_size; |
if (!default_shell_size.IsEmpty()) |