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_api.h" | 5 #include "extensions/browser/api/hid/hid_api.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const char kErrorConnectionNotFound[] = "Connection not established."; | 56 const char kErrorConnectionNotFound[] = "Connection not established."; |
57 const char kErrorTransfer[] = "Transfer failed."; | 57 const char kErrorTransfer[] = "Transfer failed."; |
58 | 58 |
59 base::Value* PopulateHidConnection(int connection_id, | 59 base::Value* PopulateHidConnection(int connection_id, |
60 scoped_refptr<HidConnection> connection) { | 60 scoped_refptr<HidConnection> connection) { |
61 hid::HidConnectInfo connection_value; | 61 hid::HidConnectInfo connection_value; |
62 connection_value.connection_id = connection_id; | 62 connection_value.connection_id = connection_id; |
63 return connection_value.ToValue().release(); | 63 return connection_value.ToValue().release(); |
64 } | 64 } |
65 | 65 |
66 void ConvertHidDeviceFilter(linked_ptr<hid::DeviceFilter> input, | 66 void ConvertHidDeviceFilter(const hid::DeviceFilter& input, |
67 HidDeviceFilter* output) { | 67 HidDeviceFilter* output) { |
68 if (input->vendor_id) { | 68 if (input.vendor_id) { |
69 output->SetVendorId(*input->vendor_id); | 69 output->SetVendorId(*input.vendor_id); |
70 } | 70 } |
71 if (input->product_id) { | 71 if (input.product_id) { |
72 output->SetProductId(*input->product_id); | 72 output->SetProductId(*input.product_id); |
73 } | 73 } |
74 if (input->usage_page) { | 74 if (input.usage_page) { |
75 output->SetUsagePage(*input->usage_page); | 75 output->SetUsagePage(*input.usage_page); |
76 } | 76 } |
77 if (input->usage) { | 77 if (input.usage) { |
78 output->SetUsage(*input->usage); | 78 output->SetUsage(*input.usage); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 namespace extensions { | 84 namespace extensions { |
85 | 85 |
86 HidGetDevicesFunction::HidGetDevicesFunction() {} | 86 HidGetDevicesFunction::HidGetDevicesFunction() {} |
87 | 87 |
88 HidGetDevicesFunction::~HidGetDevicesFunction() {} | 88 HidGetDevicesFunction::~HidGetDevicesFunction() {} |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 void HidSendFeatureReportFunction::OnFinished(bool success) { | 378 void HidSendFeatureReportFunction::OnFinished(bool success) { |
379 if (success) { | 379 if (success) { |
380 Respond(NoArguments()); | 380 Respond(NoArguments()); |
381 } else { | 381 } else { |
382 Respond(Error(kErrorTransfer)); | 382 Respond(Error(kErrorTransfer)); |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 } // namespace extensions | 386 } // namespace extensions |
OLD | NEW |