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

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

Issue 2842003002: Reuse WeakFactory from U2fDevice derived classes (Closed)
Patch Set: 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/mock_u2f_device.cc ('k') | device/u2f/u2f_device.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_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"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static constexpr uint8_t kWinkCapability = 0x01; 53 static constexpr uint8_t kWinkCapability = 0x01;
54 static constexpr uint8_t kLockCapability = 0x02; 54 static constexpr uint8_t kLockCapability = 0x02;
55 static constexpr uint32_t kBroadcastChannel = 0xffffffff; 55 static constexpr uint32_t kBroadcastChannel = 0xffffffff;
56 56
57 U2fDevice(); 57 U2fDevice();
58 58
59 // Pure virtual function defined by each device type, implementing 59 // Pure virtual function defined by each device type, implementing
60 // the device communication transaction. 60 // the device communication transaction.
61 virtual void DeviceTransact(std::unique_ptr<U2fApduCommand> command, 61 virtual void DeviceTransact(std::unique_ptr<U2fApduCommand> command,
62 const DeviceCallback& callback) = 0; 62 const DeviceCallback& callback) = 0;
63 virtual base::WeakPtr<U2fDevice> GetWeakPtr() = 0;
63 64
64 uint32_t channel_id_; 65 uint32_t channel_id_;
65 uint8_t capabilities_; 66 uint8_t capabilities_;
66 67
67 private: 68 private:
68 void OnRegisterComplete(const MessageCallback& callback, 69 void OnRegisterComplete(const MessageCallback& callback,
69 bool success, 70 bool success,
70 std::unique_ptr<U2fApduResponse> register_response); 71 std::unique_ptr<U2fApduResponse> register_response);
71 void OnSignComplete(const MessageCallback& callback, 72 void OnSignComplete(const MessageCallback& callback,
72 bool success, 73 bool success,
73 std::unique_ptr<U2fApduResponse> sign_response); 74 std::unique_ptr<U2fApduResponse> sign_response);
74 void OnVersionComplete(const VersionCallback& callback, 75 void OnVersionComplete(const VersionCallback& callback,
75 bool success, 76 bool success,
76 std::unique_ptr<U2fApduResponse> version_response); 77 std::unique_ptr<U2fApduResponse> version_response);
77 void OnLegacyVersionComplete( 78 void OnLegacyVersionComplete(
78 const VersionCallback& callback, 79 const VersionCallback& callback,
79 bool success, 80 bool success,
80 std::unique_ptr<U2fApduResponse> legacy_version_response); 81 std::unique_ptr<U2fApduResponse> legacy_version_response);
81 void OnWink(const WinkCallback& callback, 82 void OnWink(const WinkCallback& callback,
82 bool success, 83 bool success,
83 std::unique_ptr<U2fApduResponse> response); 84 std::unique_ptr<U2fApduResponse> response);
84 85
85 base::WeakPtrFactory<U2fDevice> weak_factory_;
86
87 DISALLOW_COPY_AND_ASSIGN(U2fDevice); 86 DISALLOW_COPY_AND_ASSIGN(U2fDevice);
88 }; 87 };
89 88
90 } // namespace device 89 } // namespace device
91 90
92 #endif // DEVICE_U2F_U2F_DEVICE_H_ 91 #endif // DEVICE_U2F_U2F_DEVICE_H_
OLDNEW
« no previous file with comments | « device/u2f/mock_u2f_device.cc ('k') | device/u2f/u2f_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698