| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 api_collection->report_ids.resize(collection.report_ids.size()); | 46 api_collection->report_ids.resize(collection.report_ids.size()); |
| 47 std::copy(collection.report_ids.begin(), collection.report_ids.end(), | 47 std::copy(collection.report_ids.begin(), collection.report_ids.end(), |
| 48 api_collection->report_ids.begin()); | 48 api_collection->report_ids.begin()); |
| 49 | 49 |
| 50 output->collections.push_back(make_linked_ptr(api_collection)); | 50 output->collections.push_back(make_linked_ptr(api_collection)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 const std::vector<uint8>& report_descriptor = input->report_descriptor(); | 53 const std::vector<uint8>& report_descriptor = input->report_descriptor(); |
| 54 if (report_descriptor.size() > 0) { | 54 if (report_descriptor.size() > 0) { |
| 55 output->report_descriptor = | 55 output->report_descriptor.assign(report_descriptor.begin(), |
| 56 std::string(reinterpret_cast<const char*>(&report_descriptor[0]), | 56 report_descriptor.end()); |
| 57 report_descriptor.size()); | |
| 58 } | 57 } |
| 59 } | 58 } |
| 60 | 59 |
| 61 bool WillDispatchDeviceEvent(scoped_refptr<HidDeviceInfo> device_info, | 60 bool WillDispatchDeviceEvent(scoped_refptr<HidDeviceInfo> device_info, |
| 62 content::BrowserContext* context, | 61 content::BrowserContext* context, |
| 63 const Extension* extension, | 62 const Extension* extension, |
| 64 base::ListValue* event_args) { | 63 base::ListValue* event_args) { |
| 65 if (extension) { | 64 if (extension) { |
| 66 return HidDeviceManager::HasPermission(extension, device_info); | 65 return HidDeviceManager::HasPermission(extension, device_info); |
| 67 } | 66 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void HidDeviceManager::DispatchEvent(const std::string& event_name, | 287 void HidDeviceManager::DispatchEvent(const std::string& event_name, |
| 289 scoped_ptr<base::ListValue> event_args, | 288 scoped_ptr<base::ListValue> event_args, |
| 290 scoped_refptr<HidDeviceInfo> device_info) { | 289 scoped_refptr<HidDeviceInfo> device_info) { |
| 291 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); | 290 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); |
| 292 event->will_dispatch_callback = | 291 event->will_dispatch_callback = |
| 293 base::Bind(&WillDispatchDeviceEvent, device_info); | 292 base::Bind(&WillDispatchDeviceEvent, device_info); |
| 294 event_router_->BroadcastEvent(event.Pass()); | 293 event_router_->BroadcastEvent(event.Pass()); |
| 295 } | 294 } |
| 296 | 295 |
| 297 } // namespace extensions | 296 } // namespace extensions |
| OLD | NEW |