Added
Link Here
|
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 |
3 |
// found in the LICENSE file. |
4 |
|
5 |
#include "device/hid/hid_service_freebsd.h" |
6 |
|
7 |
#include <stdint.h> |
8 |
|
9 |
#include <set> |
10 |
#include <string> |
11 |
#include <vector> |
12 |
|
13 |
#include "base/bind.h" |
14 |
#include "base/location.h" |
15 |
#include "base/logging.h" |
16 |
#include "base/single_thread_task_runner.h" |
17 |
#include "base/stl_util.h" |
18 |
#include "base/strings/stringprintf.h" |
19 |
#include "base/strings/sys_string_conversions.h" |
20 |
#include "base/task_scheduler/post_task.h" |
21 |
#include "base/threading/thread_restrictions.h" |
22 |
#include "base/threading/thread_task_runner_handle.h" |
23 |
#include "components/device_event_log/device_event_log.h" |
24 |
#include "device/hid/hid_connection.h" |
25 |
|
26 |
namespace device { |
27 |
|
28 |
HidServiceFreeBSD::HidServiceFreeBSD() : weak_factory_(this) { |
29 |
FirstEnumerationComplete(); |
30 |
} |
31 |
|
32 |
HidServiceFreeBSD::~HidServiceFreeBSD() {} |
33 |
|
34 |
void HidServiceFreeBSD::Connect(const HidDeviceId& device_id, |
35 |
const ConnectCallback& callback) { |
36 |
DCHECK(thread_checker_.CalledOnValidThread()); |
37 |
|
38 |
const auto& map_entry = devices().find(device_id); |
39 |
if (map_entry == devices().end()) { |
40 |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
41 |
FROM_HERE, base::Bind(callback, nullptr)); |
42 |
return; |
43 |
} |
44 |
} |
45 |
|
46 |
} // namespace device |