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 "extensions/browser/api/hid/hid_device_manager.h" | 5 #include "extensions/browser/api/hid/hid_device_manager.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 const GetApiDevicesCallback& callback) | 70 const GetApiDevicesCallback& callback) |
71 : extension(extension), filters(filters), callback(callback) {} | 71 : extension(extension), filters(filters), callback(callback) {} |
72 ~GetApiDevicesParams() {} | 72 ~GetApiDevicesParams() {} |
73 | 73 |
74 const Extension* extension; | 74 const Extension* extension; |
75 std::vector<HidDeviceFilter> filters; | 75 std::vector<HidDeviceFilter> filters; |
76 GetApiDevicesCallback callback; | 76 GetApiDevicesCallback callback; |
77 }; | 77 }; |
78 | 78 |
79 HidDeviceManager::HidDeviceManager(content::BrowserContext* context) | 79 HidDeviceManager::HidDeviceManager(content::BrowserContext* context) |
80 : weak_factory_(this), | 80 : initialized_(false), |
81 initialized_(false), | |
82 hid_service_observer_(this), | 81 hid_service_observer_(this), |
83 enumeration_ready_(false), | 82 enumeration_ready_(false), |
84 next_resource_id_(0) { | 83 next_resource_id_(0), |
| 84 weak_factory_(this) { |
85 event_router_ = EventRouter::Get(context); | 85 event_router_ = EventRouter::Get(context); |
86 if (event_router_) { | 86 if (event_router_) { |
87 event_router_->RegisterObserver(this, hid::OnDeviceAdded::kEventName); | 87 event_router_->RegisterObserver(this, hid::OnDeviceAdded::kEventName); |
88 event_router_->RegisterObserver(this, hid::OnDeviceRemoved::kEventName); | 88 event_router_->RegisterObserver(this, hid::OnDeviceRemoved::kEventName); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 HidDeviceManager::~HidDeviceManager() { | 92 HidDeviceManager::~HidDeviceManager() { |
93 DCHECK(thread_checker_.CalledOnValidThread()); | 93 DCHECK(thread_checker_.CalledOnValidThread()); |
94 } | 94 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 void HidDeviceManager::DispatchEvent(const std::string& event_name, | 281 void HidDeviceManager::DispatchEvent(const std::string& event_name, |
282 scoped_ptr<base::ListValue> event_args, | 282 scoped_ptr<base::ListValue> event_args, |
283 const HidDeviceInfo& device_info) { | 283 const HidDeviceInfo& device_info) { |
284 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); | 284 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); |
285 event->will_dispatch_callback = | 285 event->will_dispatch_callback = |
286 base::Bind(&WillDispatchDeviceEvent, device_info); | 286 base::Bind(&WillDispatchDeviceEvent, device_info); |
287 event_router_->BroadcastEvent(event.Pass()); | 287 event_router_->BroadcastEvent(event.Pass()); |
288 } | 288 } |
289 | 289 |
290 } // namespace extensions | 290 } // namespace extensions |
OLD | NEW |