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

Unified Diff: device/u2f/u2f_register.cc

Issue 2838573002: Revert of Add U2F request state machines (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/u2f/u2f_register.h ('k') | device/u2f/u2f_register_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/u2f/u2f_register.cc
diff --git a/device/u2f/u2f_register.cc b/device/u2f/u2f_register.cc
deleted file mode 100644
index 0f43e260378fda6e2436d82c23cfef6b268f5ea9..0000000000000000000000000000000000000000
--- a/device/u2f/u2f_register.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "u2f_register.h"
-
-#include "base/memory/ptr_util.h"
-
-namespace device {
-
-U2fRegister::U2fRegister(const std::vector<uint8_t>& challenge_hash,
- const std::vector<uint8_t>& app_param,
- const ResponseCallback& cb)
- : U2fRequest(cb),
- challenge_hash_(challenge_hash),
- app_param_(app_param),
- weak_factory_(this) {}
-
-U2fRegister::~U2fRegister() {}
-
-// static
-std::unique_ptr<U2fRequest> U2fRegister::TryRegistration(
- const std::vector<uint8_t>& challenge_hash,
- const std::vector<uint8_t>& app_param,
- const ResponseCallback& cb) {
- std::unique_ptr<U2fRequest> request =
- base::MakeUnique<U2fRegister>(challenge_hash, app_param, cb);
- request->Start();
- return request;
-}
-
-void U2fRegister::TryDevice() {
- DCHECK(current_device_);
-
- current_device_->Register(
- app_param_, challenge_hash_,
- base::Bind(&U2fRegister::OnTryDevice, weak_factory_.GetWeakPtr()));
-}
-
-void U2fRegister::OnTryDevice(U2fReturnCode return_code,
- std::vector<uint8_t> response_data) {
- switch (return_code) {
- case U2fReturnCode::SUCCESS:
- state_ = State::COMPLETE;
- cb_.Run(return_code, response_data);
- break;
- case U2fReturnCode::CONDITIONS_NOT_SATISFIED:
- // Waiting for user touch, move on and try this device later
- state_ = State::IDLE;
- Transition();
- break;
- default:
- state_ = State::IDLE;
- // An error has occured, quit trying this device
- current_device_ = nullptr;
- Transition();
- break;
- }
-}
-
-} // namespace device
« no previous file with comments | « device/u2f/u2f_register.h ('k') | device/u2f/u2f_register_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698