diff options
author | luken@chromium.org <luken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-10 20:49:02 +0000 |
---|---|---|
committer | luken@chromium.org <luken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-10 20:49:02 +0000 |
commit | ed256aca16b29c6048dd4ee6834d5714e48fa03b (patch) | |
tree | 0100a2491480d58fcb1df95a6e92e49957ba98d0 | |
parent | 325f8aad2fd0dfcd637bfa76adbce3bd61702cc2 (diff) | |
download | chromium_src-ed256aca16b29c6048dd4ee6834d5714e48fa03b.zip chromium_src-ed256aca16b29c6048dd4ee6834d5714e48fa03b.tar.gz chromium_src-ed256aca16b29c6048dd4ee6834d5714e48fa03b.tar.bz2 |
sets/clears highdpi registry settings on switch to/from metro
There are some highdpi bugs in Chrome M35 and M36 that make it not
particularly usable in desktop context, but on highdpi devices we
require that highdpi mode be enabled when in Metro mode. This CL adds
code to delegate_execute to force enable highdpi when entering Metro
mode, and to disable it when exiting.
BUG=362756
Review URL: https://codereview.chromium.org/323643002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276133 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/gfx/win/dpi.cc | 11 | ||||
-rw-r--r-- | ui/gfx/win/dpi.h | 3 | ||||
-rw-r--r-- | win8/delegate_execute/command_execute_impl.cc | 20 | ||||
-rw-r--r-- | win8/delegate_execute/command_execute_impl.h | 2 |
4 files changed, 27 insertions, 9 deletions
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc index 061f5d81..8442c36b 100644 --- a/ui/gfx/win/dpi.cc +++ b/ui/gfx/win/dpi.cc @@ -20,9 +20,6 @@ namespace { int kDefaultDPIX = 96; int kDefaultDPIY = 96; -const wchar_t kRegistryProfilePath[] = L"SOFTWARE\\Google\\Chrome\\Profile"; -const wchar_t kHighDPISupportW[] = L"high-dpi-support"; - bool force_highdpi_for_testing = false; BOOL IsProcessDPIAwareWrapper() { @@ -153,8 +150,8 @@ bool IsHighDPIEnabled() { // under the DWORD value high-dpi-support. // Default is disabled. static DWORD value = ReadRegistryValue( - HKEY_CURRENT_USER, kRegistryProfilePath, - kHighDPISupportW, TRUE); + HKEY_CURRENT_USER, gfx::win::kRegistryProfilePath, + gfx::win::kHighDPISupportW, TRUE); return value != 0; } @@ -171,6 +168,10 @@ void EnableHighDPISupport() { namespace win { +GFX_EXPORT const wchar_t kRegistryProfilePath[] = + L"Software\\Google\\Chrome\\Profile"; +GFX_EXPORT const wchar_t kHighDPISupportW[] = L"high-dpi-support"; + float GetDeviceScaleFactor() { DCHECK_NE(0.0f, g_device_scale_factor); return g_device_scale_factor; diff --git a/ui/gfx/win/dpi.h b/ui/gfx/win/dpi.h index 78889be8..52515c9 100644 --- a/ui/gfx/win/dpi.h +++ b/ui/gfx/win/dpi.h @@ -73,6 +73,9 @@ GFX_EXPORT double GetUndocumentedDPITouchScale(); // the process. GFX_EXPORT bool IsDeviceScaleFactorSet(); +GFX_EXPORT extern const wchar_t kRegistryProfilePath[]; +GFX_EXPORT extern const wchar_t kHighDPISupportW[]; + } // namespace win } // namespace gfx diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc index 4c37e7b..a120828 100644 --- a/win8/delegate_execute/command_execute_impl.cc +++ b/win8/delegate_execute/command_execute_impl.cc @@ -28,6 +28,7 @@ #include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/util_constants.h" #include "ui/base/clipboard/clipboard_util_win.h" +#include "ui/gfx/win/dpi.h" #include "win8/delegate_execute/chrome_util.h" #include "win8/delegate_execute/delegate_execute_util.h" #include "win8/viewer/metro_viewer_constants.h" @@ -107,14 +108,14 @@ bool LaunchChromeBrowserProcess() { bool CommandExecuteImpl::path_provider_initialized_ = false; -// CommandExecuteImpl is resposible for activating chrome in Windows 8. The +// CommandExecuteImpl is responsible for activating chrome in Windows 8. The // flow is complicated and this tries to highlight the important events. // The current approach is to have a single instance of chrome either // running in desktop or metro mode. If there is no current instance then // the desktop shortcut launches desktop chrome and the metro tile or search // charm launches metro chrome. // If chrome is running then focus/activation is given to the existing one -// regarless of what launch point the user used. +// regardless of what launch point the user used. // // The general flow for activation is as follows: // @@ -171,7 +172,7 @@ CommandExecuteImpl::CommandExecuteImpl() start_info_.cb = sizeof(start_info_); // We need to query the user data dir of chrome so we need chrome's - // path provider. We can be created multiplie times in a single instance + // path provider. We can be created multiple times in a single instance // however so make sure we do this only once. if (!path_provider_initialized_) { chrome::RegisterPathProvider(); @@ -207,6 +208,13 @@ STDMETHODIMP CommandExecuteImpl::SetDirectory(LPCWSTR directory) { return S_OK; } +void CommandExecuteImpl::SetHighDPIRegistryKey(bool enable) { + uint32 key_value = enable ? 1 : 2; + base::win::RegKey high_dpi_key(HKEY_CURRENT_USER); + high_dpi_key.CreateKey(gfx::win::kRegistryProfilePath, KEY_SET_VALUE); + high_dpi_key.WriteValue(gfx::win::kHighDPISupportW, key_value); +} + STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { if (!GetLaunchScheme(&display_name_, &launch_scheme_)) { AtlTrace("Failed to get scheme, E_FAIL\n"); @@ -222,8 +230,10 @@ STDMETHODIMP CommandExecuteImpl::GetValue(enum AHE_TYPE* pahe) { // call to CommandExecuteImpl::Execute(). If we wait until then to launch // the browser process as well, it will appear laggy while they connect to // each other, so we pre-launch the browser process now. - if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb) + if (*pahe == AHE_IMMERSIVE && verb_ != win8::kMetroViewerConnectVerb) { + SetHighDPIRegistryKey(true); LaunchChromeBrowserProcess(); + } return S_OK; } @@ -388,6 +398,8 @@ HRESULT CommandExecuteImpl::LaunchDesktopChrome() { break; } + SetHighDPIRegistryKey(false); + CommandLine chrome( delegate_execute::MakeChromeCommandLine(chrome_exe_, parameters_, display_name)); diff --git a/win8/delegate_execute/command_execute_impl.h b/win8/delegate_execute/command_execute_impl.h index 72e1085..20b5779 100644 --- a/win8/delegate_execute/command_execute_impl.h +++ b/win8/delegate_execute/command_execute_impl.h @@ -88,6 +88,8 @@ class ATL_NO_VTABLE DECLSPEC_UUID("071BB5F2-85A4-424F-BFE7-5F1609BE4C2C") static bool path_provider_initialized_; + void SetHighDPIRegistryKey(bool enable); + bool GetLaunchScheme(base::string16* display_name, INTERNET_SCHEME* scheme); HRESULT LaunchDesktopChrome(); // Returns the launch mode, i.e. desktop launch/metro launch, etc. |