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

Side by Side Diff: device/u2f/u2f_hid_device.cc

Issue 2763413008: Add U2F device enumeration class (Closed)
Patch Set: Fix issues causing crash Created 3 years, 8 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_hid_device.h ('k') | no next file » | 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 #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
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
OLDNEW
« no previous file with comments | « device/u2f/u2f_hid_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698