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

Unified Diff: components/proximity_auth/device_to_device_authenticator.cc

Issue 2561203002: Migrate weave-related classes from proximity_auth/ble to cryptauth/ble. (Closed)
Patch Set: Rebase. Created 4 years 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
Index: components/proximity_auth/device_to_device_authenticator.cc
diff --git a/components/proximity_auth/device_to_device_authenticator.cc b/components/proximity_auth/device_to_device_authenticator.cc
index 62a08e2cd620ff3f5d6ec0ec90be8bd31021a1e5..cc9ccdf6dbe0f7382a87099390eb407db0ecc0e5 100644
--- a/components/proximity_auth/device_to_device_authenticator.cc
+++ b/components/proximity_auth/device_to_device_authenticator.cc
@@ -9,13 +9,13 @@
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "components/cryptauth/connection.h"
#include "components/cryptauth/secure_message_delegate.h"
-#include "components/proximity_auth/connection.h"
+#include "components/cryptauth/wire_message.h"
#include "components/proximity_auth/device_to_device_initiator_operations.h"
#include "components/proximity_auth/device_to_device_secure_context.h"
#include "components/proximity_auth/logging/logging.h"
#include "components/proximity_auth/secure_context.h"
-#include "components/proximity_auth/wire_message.h"
namespace proximity_auth {
@@ -33,7 +33,7 @@ const char kPermitIdPrefix[] = "permit://google.com/easyunlock/v1/";
} // namespace
DeviceToDeviceAuthenticator::DeviceToDeviceAuthenticator(
- Connection* connection,
+ cryptauth::Connection* connection,
const std::string& account_id,
std::unique_ptr<cryptauth::SecureMessageDelegate> secure_message_delegate)
: connection_(connection),
@@ -115,7 +115,7 @@ void DeviceToDeviceAuthenticator::OnHelloMessageCreated(
hello_message_ = message;
std::string permit_id = kPermitIdPrefix + account_id_;
connection_->SendMessage(
- base::MakeUnique<WireMessage>(hello_message_, permit_id));
+ base::MakeUnique<cryptauth::WireMessage>(hello_message_, permit_id));
}
void DeviceToDeviceAuthenticator::OnResponderAuthTimedOut() {
@@ -154,7 +154,7 @@ void DeviceToDeviceAuthenticator::OnInitiatorAuthCreated(
}
state_ = State::SENT_INITIATOR_AUTH;
- connection_->SendMessage(base::MakeUnique<WireMessage>(message));
+ connection_->SendMessage(base::MakeUnique<cryptauth::WireMessage>(message));
}
void DeviceToDeviceAuthenticator::Fail(const std::string& error_message) {
@@ -187,19 +187,19 @@ void DeviceToDeviceAuthenticator::Succeed() {
}
void DeviceToDeviceAuthenticator::OnConnectionStatusChanged(
- Connection* connection,
- Connection::Status old_status,
- Connection::Status new_status) {
+ cryptauth::Connection* connection,
+ cryptauth::Connection::Status old_status,
+ cryptauth::Connection::Status new_status) {
// We do not expect the connection to drop during authentication.
- if (new_status == Connection::DISCONNECTED) {
+ if (new_status == cryptauth::Connection::DISCONNECTED) {
Fail("Disconnected while authentication is in progress",
Result::DISCONNECTED);
}
}
void DeviceToDeviceAuthenticator::OnMessageReceived(
- const Connection& connection,
- const WireMessage& message) {
+ const cryptauth::Connection& connection,
+ const cryptauth::WireMessage& message) {
if (state_ == State::SENT_HELLO) {
PA_LOG(INFO) << "Received [Responder Auth] message, payload_size="
<< message.payload().size();
@@ -222,9 +222,10 @@ void DeviceToDeviceAuthenticator::OnMessageReceived(
}
}
-void DeviceToDeviceAuthenticator::OnSendCompleted(const Connection& connection,
- const WireMessage& message,
- bool success) {
+void DeviceToDeviceAuthenticator::OnSendCompleted(
+ const cryptauth::Connection& connection,
+ const cryptauth::WireMessage& message,
+ bool success) {
if (state_ == State::SENT_INITIATOR_AUTH) {
if (success)
Succeed();

Powered by Google App Engine
This is Rietveld 408576698