| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/hid/hid_service_win.h" | 5 #include "device/hid/hid_service_win.h" |
| 6 | 6 |
| 7 #define INITGUID | 7 #define INITGUID |
| 8 | 8 |
| 9 #include <dbt.h> | 9 #include <dbt.h> |
| 10 #include <setupapi.h> | 10 #include <setupapi.h> |
| 11 #include <stddef.h> |
| 11 #include <winioctl.h> | 12 #include <winioctl.h> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/files/file.h" | 15 #include "base/files/file.h" |
| 15 #include "base/location.h" | 16 #include "base/location.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/strings/sys_string_conversions.h" | 19 #include "base/strings/sys_string_conversions.h" |
| 19 #include "base/thread_task_runner_handle.h" | 20 #include "base/thread_task_runner_handle.h" |
| 20 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, | 292 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, |
| 292 FILE_FLAG_OVERLAPPED, NULL)); | 293 FILE_FLAG_OVERLAPPED, NULL)); |
| 293 if (!file.IsValid() && GetLastError() == ERROR_ACCESS_DENIED) { | 294 if (!file.IsValid() && GetLastError() == ERROR_ACCESS_DENIED) { |
| 294 file.Set(CreateFileA(device_path.c_str(), GENERIC_READ, FILE_SHARE_READ, | 295 file.Set(CreateFileA(device_path.c_str(), GENERIC_READ, FILE_SHARE_READ, |
| 295 NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)); | 296 NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)); |
| 296 } | 297 } |
| 297 return file.Pass(); | 298 return file.Pass(); |
| 298 } | 299 } |
| 299 | 300 |
| 300 } // namespace device | 301 } // namespace device |
| OLD | NEW |