diff options
author | shrikant@chromium.org <shrikant@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 21:56:12 +0000 |
---|---|---|
committer | shrikant@chromium.org <shrikant@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-24 21:56:12 +0000 |
commit | bb481b101a826c7415c096466a8c1e749b9521f8 (patch) | |
tree | 5af84d67bcb1d2b39f9f6198108f9552ff767ede | |
parent | 6fbda3b95694c64543e5e15594465031c27a367e (diff) | |
download | chromium_src-bb481b101a826c7415c096466a8c1e749b9521f8.zip chromium_src-bb481b101a826c7415c096466a8c1e749b9521f8.tar.gz chromium_src-bb481b101a826c7415c096466a8c1e749b9521f8.tar.bz2 |
IsMachineATablet is now modified to check only for touch capability and hence name change as well.
Also added minor modification of checking viewer connection process for immersive mode.
BUG=223778
TEST=none
Review URL: https://chromiumcodereview.appspot.com/14061007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196242 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/win/win_util.cc | 11 | ||||
-rw-r--r-- | base/win/win_util.h | 6 | ||||
-rw-r--r-- | chrome/browser/process_singleton_win.cc | 14 | ||||
-rw-r--r-- | chrome/browser/ui/webui/set_as_default_browser_ui.cc | 4 | ||||
-rw-r--r-- | win8/delegate_execute/command_execute_impl.cc | 6 |
5 files changed, 19 insertions, 22 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc index acdc907..3d12f77 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -214,20 +214,13 @@ void SetAbortBehaviorForCrashReporting() { signal(SIGABRT, ForceCrashOnSigAbort); } -bool IsMachineATablet() { +bool IsTouchEnabledDevice() { if (base::win::GetVersion() < base::win::VERSION_WIN7) return false; const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; - const int kMaxTabletScreenWidth = 1366; - const int kMaxTabletScreenHeight = 768; int sm = GetSystemMetrics(SM_DIGITIZER); if ((sm & kMultiTouch) == kMultiTouch) { - int cx = GetSystemMetrics(SM_CXSCREEN); - int cy = GetSystemMetrics(SM_CYSCREEN); - // Handle landscape and portrait modes. - return cx > cy ? - (cx <= kMaxTabletScreenWidth && cy <= kMaxTabletScreenHeight) : - (cy <= kMaxTabletScreenWidth && cx <= kMaxTabletScreenHeight); + return true; } return false; } diff --git a/base/win/win_util.h b/base/win/win_util.h index 0404ef0..78390be0 100644 --- a/base/win/win_util.h +++ b/base/win/win_util.h @@ -102,9 +102,9 @@ BASE_EXPORT bool ShouldCrashOnProcessDetach(); // process is aborted. BASE_EXPORT void SetAbortBehaviorForCrashReporting(); -// A tablet by this definition is something that has integrated multi-touch -// ready to use and also has screen resolution not greater than 1366x768. -BASE_EXPORT bool IsMachineATablet(); +// A touch enabled device by this definition is something that has +// integrated multi-touch ready to use and has Windows version > Windows7. +BASE_EXPORT bool IsTouchEnabledDevice(); // Get the size of a struct up to and including the specified member. // This is necessary to set compatible struct sizes for different versions diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index 43adccc..fe40b96 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -181,10 +181,6 @@ bool ParseCommandLine(const COPYDATASTRUCT* cds, // Move this function to a common place as the Windows 8 delegate_execute // handler can possibly use this. bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) { -#if defined(USE_AURA) - return false; -#endif - if (base::win::GetVersion() < base::win::VERSION_WIN8) return false; @@ -194,6 +190,14 @@ bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) { if (ShellIntegration::GetDefaultBrowser() != ShellIntegration::IS_DEFAULT) return false; +#if defined(USE_AURA) + // If we have viewer connection command line then we need to avoid + // launching in metro mode as it may create loop. + CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kViewerConnection)) + return false; +#endif + base::IntegrityLevel integrity_level = base::INTEGRITY_UNKNOWN; base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), &integrity_level); @@ -215,7 +219,7 @@ bool ShouldLaunchInWindows8ImmersiveMode(const base::FilePath& user_data_dir) { ®_value) == ERROR_SUCCESS) { return reg_value == 1; } - return base::win::IsMachineATablet(); + return base::win::IsTouchEnabledDevice(); } } // namespace diff --git a/chrome/browser/ui/webui/set_as_default_browser_ui.cc b/chrome/browser/ui/webui/set_as_default_browser_ui.cc index 99a8837..f1c64af 100644 --- a/chrome/browser/ui/webui/set_as_default_browser_ui.cc +++ b/chrome/browser/ui/webui/set_as_default_browser_ui.cc @@ -206,7 +206,7 @@ void SetAsDefaultBrowserHandler::ConcludeInteraction( } bool SetAsDefaultBrowserHandler::ShouldAttemptImmersiveRestart() { - return (base::win::IsMachineATablet() && + return (base::win::IsTouchEnabledDevice() && !Profile::FromWebUI(web_ui())->GetPrefs()->GetBoolean( prefs::kSuppressSwitchToMetroModeOnSetDefault)); } @@ -398,7 +398,7 @@ void SetAsDefaultBrowserDialogImpl:: // Do a straight-up restart rather than a mode-switch restart. // delegate_execute.exe will choose an immersive launch on the basis of the - // same IsMachineATablet check, but will not store this as the user's + // same IsTouchEnabledDevice check, but will not store this as the user's // choice. BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&chrome::AttemptRestart)); diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc index 30faf16..e95cfbc 100644 --- a/win8/delegate_execute/command_execute_impl.cc +++ b/win8/delegate_execute/command_execute_impl.cc @@ -134,7 +134,7 @@ bool CommandExecuteImpl::path_provider_initialized_ = false; // c) else we return what GetLaunchMode() tells us, which is: // i) if the command line --force-xxx is present return that // ii) if the registry 'launch_mode' exists return that -// iii) if IsMachineATablet() is true return AHE_IMMERSIVE +// iii) if IsTouchEnabledDevice() is true return AHE_IMMERSIVE // iv) else return AHE_DESKTOP // 6- If we returned AHE_IMMERSIVE in step 5 windows might not call us back // and simply activate chrome in metro by itself, however in some cases @@ -154,7 +154,7 @@ bool CommandExecuteImpl::path_provider_initialized_ = false; // in the registry so next time the logic reaches 5c-ii it will use the same // mode again. // -// Also note that if we are not the default browser and IsMachineATablet() +// Also note that if we are not the default browser and IsTouchEnabledDevice() // returns true, launching chrome can go all the way to 7c, which might be // a slow way to start chrome. // @@ -540,7 +540,7 @@ EC_HOST_UI_MODE CommandExecuteImpl::GetLaunchMode() { DWORD reg_value; if (reg_key.ReadValueDW(chrome::kLaunchModeValue, ®_value) != ERROR_SUCCESS) { - launch_mode = base::win::IsMachineATablet() ? + launch_mode = base::win::IsTouchEnabledDevice() ? ECHUIM_IMMERSIVE : ECHUIM_DESKTOP; AtlTrace("Launch mode forced by heuristics to %s\n", modes[launch_mode]); } else if (reg_value >= ECHUIM_SYSTEM_LAUNCHER) { |