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

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

Issue 2835133003: Reland of Add U2F request state machines (Closed)
Patch Set: Initialize variable 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_device.cc ('k') | 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 #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 "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "crypto/random.h" 11 #include "crypto/random.h"
12 #include "device/base/device_client.h" 12 #include "device/base/device_client.h"
13 #include "device/hid/hid_connection.h" 13 #include "device/hid/hid_connection.h"
14 #include "u2f_apdu_command.h" 14 #include "u2f_apdu_command.h"
15 #include "u2f_message.h" 15 #include "u2f_message.h"
16 16
17 namespace device { 17 namespace device {
18 18
19 namespace switches { 19 namespace switches {
20 static constexpr char kEnableU2fHidTest[] = "enable-u2f-hid-tests"; 20 static constexpr char kEnableU2fHidTest[] = "enable-u2f-hid-tests";
21 } // namespace switches 21 } // namespace switches
22 22
23 U2fHidDevice::U2fHidDevice(scoped_refptr<HidDeviceInfo> device_info) 23 U2fHidDevice::U2fHidDevice(scoped_refptr<HidDeviceInfo> device_info)
24 : U2fDevice(), 24 : U2fDevice(),
25 state_(State::INIT), 25 state_(State::INIT),
26 device_info_(device_info), 26 device_info_(device_info),
27 weak_factory_(this) { 27 weak_factory_(this) {
28 channel_id_ = kBroadcastChannel; 28 channel_id_ = kBroadcastChannel;
29 capabilities_ = 0;
Reilly Grant (use Gerrit) 2017/04/24 21:07:49 nit: combine these lines with the initialization o
Casey Piper 2017/04/24 21:21:23 Since the variables are from the base class, is th
Reilly Grant (use Gerrit) 2017/04/24 21:38:37 Oh, I didn't realize they were in the base class.
Casey Piper 2017/04/24 22:52:53 Done.
29 } 30 }
30 31
31 U2fHidDevice::~U2fHidDevice() { 32 U2fHidDevice::~U2fHidDevice() {
32 // Cleanup connection 33 // Cleanup connection
33 if (connection_ && !connection_->closed()) 34 if (connection_ && !connection_->closed())
34 connection_->Close(); 35 connection_->Close();
35 } 36 }
36 37
37 void U2fHidDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command, 38 void U2fHidDevice::DeviceTransact(std::unique_ptr<U2fApduCommand> command,
38 const DeviceCallback& callback) { 39 const DeviceCallback& callback) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return id.str(); 338 return id.str();
338 } 339 }
339 340
340 // static 341 // static
341 bool U2fHidDevice::IsTestEnabled() { 342 bool U2fHidDevice::IsTestEnabled() {
342 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 343 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
343 return command_line->HasSwitch(switches::kEnableU2fHidTest); 344 return command_line->HasSwitch(switches::kEnableU2fHidTest);
344 } 345 }
345 346
346 } // namespace device 347 } // namespace device
OLDNEW
« no previous file with comments | « device/u2f/u2f_device.cc ('k') | device/u2f/u2f_register.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698