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

Side by Side Diff: base/win/win_util.cc

Issue 271953002: Resubmit "Add an UMA metric to track whether running on a tablet". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous condition caused by merge. Created 6 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win/win_util.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win/win_util.h" 5 #include "base/win/win_util.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <lm.h> 8 #include <lm.h>
9 #include <powrprof.h>
9 #include <shellapi.h> 10 #include <shellapi.h>
10 #include <shlobj.h> 11 #include <shlobj.h>
11 #include <shobjidl.h> // Must be before propkey. 12 #include <shobjidl.h> // Must be before propkey.
12 #include <initguid.h> 13 #include <initguid.h>
13 #include <propkey.h> 14 #include <propkey.h>
14 #include <propvarutil.h> 15 #include <propvarutil.h>
15 #include <sddl.h> 16 #include <sddl.h>
16 #include <signal.h> 17 #include <signal.h>
17 #include <stdlib.h> 18 #include <stdlib.h>
18 19
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (base::win::GetVersion() < base::win::VERSION_WIN7) 226 if (base::win::GetVersion() < base::win::VERSION_WIN7)
226 return false; 227 return false;
227 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; 228 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY;
228 int sm = GetSystemMetrics(SM_DIGITIZER); 229 int sm = GetSystemMetrics(SM_DIGITIZER);
229 if ((sm & kMultiTouch) == kMultiTouch) { 230 if ((sm & kMultiTouch) == kMultiTouch) {
230 return true; 231 return true;
231 } 232 }
232 return false; 233 return false;
233 } 234 }
234 235
236 bool IsTabletDevice() {
237 if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0)
238 return false;
239
240 base::win::Version version = base::win::GetVersion();
241 if (version == base::win::VERSION_XP)
242 return (GetSystemMetrics(SM_TABLETPC) != 0);
243
244 // If the device is docked, the user is treating the device as a PC.
245 if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0)
246 return false;
247
248 // PlatformRoleSlate was only added in Windows 8, but prior to Win8 it is
249 // still possible to check for a mobile power profile.
250 POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole();
251 bool mobile_power_profile = (role == PlatformRoleMobile);
252 bool slate_power_profile = false;
253 if (version >= base::win::VERSION_WIN8)
254 slate_power_profile = (role == PlatformRoleSlate);
255
256 if (mobile_power_profile || slate_power_profile)
257 return (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0);
258
259 return false;
260 }
261
235 bool DisplayVirtualKeyboard() { 262 bool DisplayVirtualKeyboard() {
236 if (base::win::GetVersion() < base::win::VERSION_WIN8) 263 if (base::win::GetVersion() < base::win::VERSION_WIN8)
237 return false; 264 return false;
238 265
239 static base::LazyInstance<string16>::Leaky osk_path = 266 static base::LazyInstance<string16>::Leaky osk_path =
240 LAZY_INSTANCE_INITIALIZER; 267 LAZY_INSTANCE_INITIALIZER;
241 268
242 if (osk_path.Get().empty()) { 269 if (osk_path.Get().empty()) {
243 // We need to launch TabTip.exe from the location specified under the 270 // We need to launch TabTip.exe from the location specified under the
244 // LocalServer32 key for the {{054AAE20-4BEA-4347-8A35-64A533254A9D}} 271 // LocalServer32 key for the {{054AAE20-4BEA-4347-8A35-64A533254A9D}}
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 #if defined(_MSC_FULL_VER) 402 #if defined(_MSC_FULL_VER)
376 #pragma message(__PPOUT__(_MSC_FULL_VER)) 403 #pragma message(__PPOUT__(_MSC_FULL_VER))
377 #endif 404 #endif
378 405
379 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") 406 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1")
380 #error Must install Update 1 to Visual Studio 2012. 407 #error Must install Update 1 to Visual Studio 2012.
381 #endif 408 #endif
382 409
383 #endif // _MSC_VER 410 #endif // _MSC_VER
384 411
OLDNEW
« no previous file with comments | « base/win/win_util.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698