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

Unified Diff: content/shell/browser/shell.cc

Issue 1525933002: Support device scale factor test with popups in LayoutTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: content/shell/browser/shell.cc
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index 12fde0b981f9818af5e2e58520567335a75aaf31..de632720474d515549a59a47d3108707c486f457 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -18,6 +18,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"
@@ -34,6 +35,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/widget/desktop_aura/desktop_screen_x11.h"
+#endif
namespace content {
@@ -383,6 +390,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::DesktopScreenX11::UpdateDeviceScaleFactorForTest();
+#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())

Powered by Google App Engine
This is Rietveld 408576698