OLD | NEW |
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 #include "u2f_hid_device.h" | 5 #include "u2f_hid_device.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "crypto/random.h" | 10 #include "crypto/random.h" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 base::Bind(&U2fHidDevice::OnWink, weak_factory_.GetWeakPtr(), callback)); | 291 base::Bind(&U2fHidDevice::OnWink, weak_factory_.GetWeakPtr(), callback)); |
292 } | 292 } |
293 | 293 |
294 void U2fHidDevice::OnWink(const WinkCallback& callback, | 294 void U2fHidDevice::OnWink(const WinkCallback& callback, |
295 bool success, | 295 bool success, |
296 std::unique_ptr<U2fMessage> response) { | 296 std::unique_ptr<U2fMessage> response) { |
297 callback.Run(); | 297 callback.Run(); |
298 } | 298 } |
299 | 299 |
300 std::string U2fHidDevice::GetId() { | 300 std::string U2fHidDevice::GetId() { |
301 std::ostringstream id("hid:"); | 301 std::ostringstream id("hid:", std::ios::ate); |
302 id << device_info_->device_id(); | 302 id << device_info_->device_id(); |
303 return id.str(); | 303 return id.str(); |
304 } | 304 } |
305 | 305 |
306 // static | 306 // static |
307 bool U2fHidDevice::IsTestEnabled() { | 307 bool U2fHidDevice::IsTestEnabled() { |
308 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 308 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
309 return command_line->HasSwitch(switches::kEnableU2fHidTest); | 309 return command_line->HasSwitch(switches::kEnableU2fHidTest); |
310 } | 310 } |
311 | 311 |
312 } // namespace device | 312 } // namespace device |
OLD | NEW |