Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: device/u2f/u2f_request.h

Issue 2839043002: Pass u2f message callback vector as a const reference (Closed)
Patch Set: Change response callback to const ref Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/u2f/u2f_register_unittest.cc ('k') | device/u2f/u2f_request_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef DEVICE_U2F_U2F_REQUEST_H_ 5 #ifndef DEVICE_U2F_U2F_REQUEST_H_
6 #define DEVICE_U2F_U2F_REQUEST_H_ 6 #define DEVICE_U2F_U2F_REQUEST_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/scoped_observer.h" 9 #include "base/scoped_observer.h"
10 #include "device/hid/hid_device_filter.h" 10 #include "device/hid/hid_device_filter.h"
11 #include "device/hid/hid_service.h" 11 #include "device/hid/hid_service.h"
12 #include "u2f_device.h" 12 #include "u2f_device.h"
13 13
14 namespace device { 14 namespace device {
15 class U2fRequest : HidService::Observer { 15 class U2fRequest : HidService::Observer {
16 public: 16 public:
17 using ResponseCallback = base::Callback<void(U2fReturnCode status_code, 17 using ResponseCallback =
18 std::vector<uint8_t> response)>; 18 base::Callback<void(U2fReturnCode status_code,
19 const std::vector<uint8_t>& response)>;
19 20
20 U2fRequest(const ResponseCallback& callback); 21 U2fRequest(const ResponseCallback& callback);
21 virtual ~U2fRequest(); 22 virtual ~U2fRequest();
22 23
23 void Start(); 24 void Start();
24 void AddDeviceForTesting(std::unique_ptr<U2fDevice> device); 25 void AddDeviceForTesting(std::unique_ptr<U2fDevice> device);
25 26
26 protected: 27 protected:
27 enum class State { 28 enum class State {
28 INIT, 29 INIT,
(...skipping 27 matching lines...) Expand all
56 std::list<std::unique_ptr<U2fDevice>> devices_; 57 std::list<std::unique_ptr<U2fDevice>> devices_;
57 std::list<std::unique_ptr<U2fDevice>> attempted_devices_; 58 std::list<std::unique_ptr<U2fDevice>> attempted_devices_;
58 base::CancelableClosure delay_callback_; 59 base::CancelableClosure delay_callback_;
59 HidDeviceFilter filter_; 60 HidDeviceFilter filter_;
60 ScopedObserver<HidService, HidService::Observer> hid_service_observer_; 61 ScopedObserver<HidService, HidService::Observer> hid_service_observer_;
61 base::WeakPtrFactory<U2fRequest> weak_factory_; 62 base::WeakPtrFactory<U2fRequest> weak_factory_;
62 }; 63 };
63 } // namespace device 64 } // namespace device
64 65
65 #endif // DEVICE_U2F_U2F_REQUEST_H_ 66 #endif // DEVICE_U2F_U2F_REQUEST_H_
OLDNEW
« no previous file with comments | « device/u2f/u2f_register_unittest.cc ('k') | device/u2f/u2f_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698