summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-04 11:10:51 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-04 11:10:51 +0000
commit6c72e093fc68313c0b3977e01ef140a698ad6fc6 (patch)
treec9756acd26813c633942c8ff3a699988772dc52b /content
parent82ba6a405f3f83ae5dd4b304c1eb5f8a01b91c43 (diff)
downloadchromium_src-6c72e093fc68313c0b3977e01ef140a698ad6fc6.zip
chromium_src-6c72e093fc68313c0b3977e01ef140a698ad6fc6.tar.gz
chromium_src-6c72e093fc68313c0b3977e01ef140a698ad6fc6.tar.bz2
Pass the device scale factor in the command line to renderer processes.
This is to ensure that we don't use GDI to query the device scale factor in renderer processes. This is in preparation for setting the MITIGATION_WIN32K_DISABLE policy on renderer processes, which will lock them out from making user32/gdi32 calls which enter win32k.sys. BUG=365160 Review URL: https://codereview.chromium.org/308003020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/app/content_main_runner.cc18
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc7
-rw-r--r--content/public/common/content_switches.cc37
-rw-r--r--content/public/common/content_switches.h20
4 files changed, 56 insertions, 26 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 24a5289..8c767321 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -49,7 +49,6 @@
#include "sandbox/win/src/sandbox_types.h"
#include "ui/base/ui_base_paths.h"
#include "ui/base/ui_base_switches.h"
-#include "ui/gfx/win/dpi.h"
#if defined(USE_TCMALLOC)
#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
@@ -74,6 +73,10 @@
#include <atlapp.h>
#include <malloc.h>
#include <cstring>
+
+#include "base/strings/string_number_conversions.h"
+#include "ui/base/win/dpi_setup.h"
+#include "ui/gfx/win/dpi.h"
#elif defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
#if !defined(OS_IOS)
@@ -658,6 +661,19 @@ class ContentMainRunnerImpl : public ContentMainRunner {
if (command_line.HasSwitch(switches::kEnableHighResolutionTime))
base::TimeTicks::SetNowIsHighResNowIfSupported();
+ bool init_device_scale_factor = true;
+ if (command_line.HasSwitch(switches::kDeviceScaleFactor)) {
+ std::string scale_factor_string = command_line.GetSwitchValueASCII(
+ switches::kDeviceScaleFactor);
+ double scale_factor = 0;
+ if (base::StringToDouble(scale_factor_string, &scale_factor)) {
+ init_device_scale_factor = false;
+ gfx::InitDeviceScaleFactor(scale_factor);
+ }
+ }
+ if (init_device_scale_factor)
+ ui::win::InitDeviceScaleFactor();
+
SetupCRT(command_line);
#endif
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 8ed6424..dbfb849d 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -164,9 +164,11 @@
#endif
#if defined(OS_WIN)
+#include "base/strings/string_number_conversions.h"
#include "base/win/scoped_com_initializer.h"
#include "content/common/font_cache_dispatcher_win.h"
#include "content/common/sandbox_win.h"
+#include "ui/gfx/win/dpi.h"
#endif
#if defined(ENABLE_WEBRTC)
@@ -1037,6 +1039,11 @@ void RenderProcessHostImpl::AppendRendererCommandLine(
if (content::IsPinchToZoomEnabled())
command_line->AppendSwitch(switches::kEnablePinch);
+#if defined(OS_WIN)
+ command_line->AppendSwitchASCII(switches::kDeviceScaleFactor,
+ base::DoubleToString(gfx::GetDPIScale()));
+#endif
+
AppendCompositorCommandLineFlags(command_line);
}
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 0770a14..92ec08d 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -409,23 +409,6 @@ const char kEnableLowResTiling[] = "enable-low-res-tiling";
const char kEnableHighDpiCompositingForFixedPosition[] =
"enable-high-dpi-fixed-position-compositing";
-#if defined(OS_WIN)
-// Disable the Legacy Window which corresponds to the size of the WebContents.
-const char kDisableLegacyIntermediateWindow[] = "disable-legacy-window";
-
-// Enables the DirectWrite font rendering system on windows.
-const char kEnableDirectWrite[] = "enable-direct-write";
-
-// Use high resolution timers for TimeTicks.
-const char kEnableHighResolutionTime[] = "enable-high-resolution-time";
-
-// Enable the Win32K process mitigation policy for renderer processes which
-// prevents them from invoking user32 and gdi32 system calls which enter
-// the kernel. This is only supported on Windows 8 and beyond.
-const char kEnableWin32kRendererLockDown[]
- = "enable_win32k_renderer_lockdown";
-#endif
-
// Paint content on the compositor thread instead of the main thread.
const char kEnableImplSidePainting[] = "enable-impl-side-painting";
@@ -982,6 +965,26 @@ const char kDisableCoreAnimationPlugins[] =
"disable-core-animation-plugins";
#endif
+#if defined(OS_WIN)
+// Device scale factor passed to certain processes like renderers, etc.
+const char kDeviceScaleFactor[] = "device-scale-factor";
+
+// Disable the Legacy Window which corresponds to the size of the WebContents.
+const char kDisableLegacyIntermediateWindow[] = "disable-legacy-window";
+
+// Enables the DirectWrite font rendering system on windows.
+const char kEnableDirectWrite[] = "enable-direct-write";
+
+// Use high resolution timers for TimeTicks.
+const char kEnableHighResolutionTime[] = "enable-high-resolution-time";
+
+// Enable the Win32K process mitigation policy for renderer processes which
+// prevents them from invoking user32 and gdi32 system calls which enter
+// the kernel. This is only supported on Windows 8 and beyond.
+const char kEnableWin32kRendererLockDown[]
+ = "enable_win32k_renderer_lockdown";
+#endif
+
// Don't dump stuff here, follow the same order as the header.
} // namespace switches
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 0e6b87a..7be78a4 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -119,14 +119,6 @@ extern const char kEnableGpuClientTracing[];
CONTENT_EXPORT extern const char kEnableGpuRasterization[];
CONTENT_EXPORT extern const char kEnableLowResTiling[];
CONTENT_EXPORT extern const char kEnableHighDpiCompositingForFixedPosition[];
-#if defined(OS_WIN)
-CONTENT_EXPORT extern const char kDisableLegacyIntermediateWindow[];
-CONTENT_EXPORT extern const char kEnableDirectWrite[];
-// This switch will be removed when we enable the win32K lockdown process
-// mitigation.
-CONTENT_EXPORT extern const char kEnableWin32kRendererLockDown[];
-CONTENT_EXPORT extern const char kEnableHighResolutionTime[];
-#endif
CONTENT_EXPORT extern const char kEnableImplSidePainting[];
CONTENT_EXPORT extern const char kEnableInbandTextTracks[];
CONTENT_EXPORT extern const char kEnableLCDText[];
@@ -290,6 +282,18 @@ extern const char kEnableCarbonInterposing[];
extern const char kDisableCoreAnimationPlugins[];
#endif
+#if defined(OS_WIN)
+// This switch contains the device scale factor passed to certain processes
+// like renderers, etc.
+CONTENT_EXPORT extern const char kDeviceScaleFactor[];
+CONTENT_EXPORT extern const char kDisableLegacyIntermediateWindow[];
+CONTENT_EXPORT extern const char kEnableDirectWrite[];
+CONTENT_EXPORT extern const char kEnableHighResolutionTime[];
+// This switch will be removed when we enable the win32K lockdown process
+// mitigation.
+CONTENT_EXPORT extern const char kEnableWin32kRendererLockDown[];
+#endif
+
// DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
// alphabetical order, or in one of the ifdefs (also in order in each section).