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

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

Issue 262773015: Add an UMA metric to track whether chrome is running on a tablet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a check for the PowerPlatformRole. 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 false;
cpu_(ooo_6.6-7.5) 2014/05/06 00:38:46 please remove the less than xp branch.
243 } else if (version == base::win::VERSION_XP) {
244 return (GetSystemMetrics(SM_TABLETPC) != 0);
cpu_(ooo_6.6-7.5) 2014/05/06 00:38:46 mmmm, I was expecting you return false here. I m
zturner 2014/05/06 00:49:36 I would think yes? I mean Windows XP tablets are
245 }
246
247 // If the device is docked, the user is treating the device as a PC.
248 if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0)
cpu_(ooo_6.6-7.5) 2014/05/06 00:38:46 nice.
249 return false;
250
251 // PlatformRoleSlate was only added in Windows 8, but prior to Win8 it is
252 // still possible to check for a mobile power profile.
253 bool has_tablet_power_profile = false;
254 POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole();
255 has_tablet_power_profile = (role == PlatformRoleMobile);
256 if (version >= base::win::VERSION_WIN8)
257 has_tablet_power_profile |= (role == PlatformRoleSlate);
258
259 if (has_tablet_power_profile) {
260 bool slate_mode = (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0);
261 return slate_mode;
262 }
263
264 return false;
265 }
266
235 bool DisplayVirtualKeyboard() { 267 bool DisplayVirtualKeyboard() {
236 if (base::win::GetVersion() < base::win::VERSION_WIN8) 268 if (base::win::GetVersion() < base::win::VERSION_WIN8)
237 return false; 269 return false;
238 270
239 static base::LazyInstance<string16>::Leaky osk_path = 271 static base::LazyInstance<string16>::Leaky osk_path =
240 LAZY_INSTANCE_INITIALIZER; 272 LAZY_INSTANCE_INITIALIZER;
241 273
242 if (osk_path.Get().empty()) { 274 if (osk_path.Get().empty()) {
243 // We need to launch TabTip.exe from the location specified under the 275 // We need to launch TabTip.exe from the location specified under the
244 // LocalServer32 key for the {{054AAE20-4BEA-4347-8A35-64A533254A9D}} 276 // 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) 407 #if defined(_MSC_FULL_VER)
376 #pragma message(__PPOUT__(_MSC_FULL_VER)) 408 #pragma message(__PPOUT__(_MSC_FULL_VER))
377 #endif 409 #endif
378 410
379 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") 411 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1")
380 #error Must install Update 1 to Visual Studio 2012. 412 #error Must install Update 1 to Visual Studio 2012.
381 #endif 413 #endif
382 414
383 #endif // _MSC_VER 415 #endif // _MSC_VER
384 416
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