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

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

Issue 1182453004: Write new Starts/EndsWith and convert FilePath functions to StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util
Patch Set: default back Created 5 years, 6 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
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 <cfgmgr32.h> 8 #include <cfgmgr32.h>
9 #include <lm.h> 9 #include <lm.h>
10 #include <powrprof.h> 10 #include <powrprof.h>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 // Get the device ID. 143 // Get the device ID.
144 wchar_t device_id[MAX_DEVICE_ID_LEN]; 144 wchar_t device_id[MAX_DEVICE_ID_LEN];
145 CONFIGRET status = CM_Get_Device_ID(device_info_data.DevInst, 145 CONFIGRET status = CM_Get_Device_ID(device_info_data.DevInst,
146 device_id, 146 device_id,
147 MAX_DEVICE_ID_LEN, 147 MAX_DEVICE_ID_LEN,
148 0); 148 0);
149 if (status == CR_SUCCESS) { 149 if (status == CR_SUCCESS) {
150 // To reduce the scope of the hack we only look for ACPI and HID\\VID 150 // To reduce the scope of the hack we only look for ACPI and HID\\VID
151 // prefixes in the keyboard device ids. 151 // prefixes in the keyboard device ids.
152 if (StartsWith(device_id, L"ACPI", false) || 152 if (StartsWith(device_id, L"ACPI", CompareCase::INSENSITIVE_ASCII) ||
153 StartsWith(device_id, L"HID\\VID", false)) { 153 StartsWith(device_id, L"HID\\VID", CompareCase::INSENSITIVE_ASCII)) {
154 keyboard_count++; 154 keyboard_count++;
155 } 155 }
156 } 156 }
157 } 157 }
158 // The heuristic we are using is to check the count of keyboards and return 158 // The heuristic we are using is to check the count of keyboards and return
159 // true if the API's report one or more keyboards. Please note that this 159 // true if the API's report one or more keyboards. Please note that this
160 // will break for non keyboard devices which expose a keyboard PDO. 160 // will break for non keyboard devices which expose a keyboard PDO.
161 return keyboard_count >= 1; 161 return keyboard_count >= 1;
162 } 162 }
163 163
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // deployed. 485 // deployed.
486 if (os_info->version() == VERSION_SERVER_2003) 486 if (os_info->version() == VERSION_SERVER_2003)
487 return false; 487 return false;
488 488
489 DCHECK(os_info->version() >= VERSION_VISTA); 489 DCHECK(os_info->version() >= VERSION_VISTA);
490 return true; // New enough to have SHA-256 support. 490 return true; // New enough to have SHA-256 support.
491 } 491 }
492 492
493 } // namespace win 493 } // namespace win
494 } // namespace base 494 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698