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

Side by Side Diff: device/u2f/u2f_device.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 | « no previous file | device/u2f/u2f_register.h » ('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_DEVICE_H_ 5 #ifndef DEVICE_U2F_U2F_DEVICE_H_
6 #define DEVICE_U2F_U2F_DEVICE_H_ 6 #define DEVICE_U2F_U2F_DEVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "u2f_apdu_response.h" 12 #include "u2f_apdu_response.h"
13 #include "u2f_return_code.h" 13 #include "u2f_return_code.h"
14 14
15 namespace device { 15 namespace device {
16 16
17 class U2fApduCommand; 17 class U2fApduCommand;
18 18
19 // Device abstraction for an individual U2F device. A U2F device defines the 19 // Device abstraction for an individual U2F device. A U2F device defines the
20 // standardized Register, Sign, and GetVersion methods. 20 // standardized Register, Sign, and GetVersion methods.
21 class U2fDevice { 21 class U2fDevice {
22 public: 22 public:
23 enum class ProtocolVersion { 23 enum class ProtocolVersion {
24 U2F_V2, 24 U2F_V2,
25 UNKNOWN, 25 UNKNOWN,
26 }; 26 };
27 27
28 using MessageCallback = 28 using MessageCallback =
29 base::Callback<void(U2fReturnCode, std::vector<uint8_t>)>; 29 base::Callback<void(U2fReturnCode, const std::vector<uint8_t>&)>;
30 using VersionCallback = 30 using VersionCallback =
31 base::Callback<void(bool success, ProtocolVersion version)>; 31 base::Callback<void(bool success, ProtocolVersion version)>;
32 using DeviceCallback = 32 using DeviceCallback =
33 base::Callback<void(bool success, 33 base::Callback<void(bool success,
34 std::unique_ptr<U2fApduResponse> response)>; 34 std::unique_ptr<U2fApduResponse> response)>;
35 using WinkCallback = base::Callback<void()>; 35 using WinkCallback = base::Callback<void()>;
36 36
37 virtual ~U2fDevice(); 37 virtual ~U2fDevice();
38 38
39 // Raw messages parameters are defined by the specification at 39 // Raw messages parameters are defined by the specification at
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void OnWink(const WinkCallback& callback, 82 void OnWink(const WinkCallback& callback,
83 bool success, 83 bool success,
84 std::unique_ptr<U2fApduResponse> response); 84 std::unique_ptr<U2fApduResponse> response);
85 85
86 DISALLOW_COPY_AND_ASSIGN(U2fDevice); 86 DISALLOW_COPY_AND_ASSIGN(U2fDevice);
87 }; 87 };
88 88
89 } // namespace device 89 } // namespace device
90 90
91 #endif // DEVICE_U2F_U2F_DEVICE_H_ 91 #endif // DEVICE_U2F_U2F_DEVICE_H_
OLDNEW
« no previous file with comments | « no previous file | device/u2f/u2f_register.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698