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

Unified Diff: components/cryptauth/secure_channel.cc

Issue 2800883003: [CrOS Tether] Update SecureChannel and BleConnectionManager to use CryptAuthService instead of a Del (Closed)
Patch Set: Added BleConnectionManager refactor as well. 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 | « components/cryptauth/secure_channel.h ('k') | components/cryptauth/secure_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cryptauth/secure_channel.cc
diff --git a/components/cryptauth/secure_channel.cc b/components/cryptauth/secure_channel.cc
index a51b5c8e5871f7df80f50cec2a6ab8b97b259969..9048f4d4f8b1ed86f37307be47504ef56207fb12 100644
--- a/components/cryptauth/secure_channel.cc
+++ b/components/cryptauth/secure_channel.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
+#include "components/cryptauth/cryptauth_service.h"
#include "components/cryptauth/wire_message.h"
#include "components/proximity_auth/logging/logging.h"
@@ -17,12 +18,12 @@ SecureChannel::Factory* SecureChannel::Factory::factory_instance_ = nullptr;
// static
std::unique_ptr<SecureChannel> SecureChannel::Factory::NewInstance(
std::unique_ptr<Connection> connection,
- std::unique_ptr<Delegate> delegate) {
+ CryptAuthService* cryptauth_service) {
if (!factory_instance_) {
factory_instance_ = new Factory();
}
return factory_instance_->BuildInstance(std::move(connection),
- std::move(delegate));
+ cryptauth_service);
}
// static
@@ -32,9 +33,9 @@ void SecureChannel::Factory::SetInstanceForTesting(Factory* factory) {
std::unique_ptr<SecureChannel> SecureChannel::Factory::BuildInstance(
std::unique_ptr<Connection> connection,
- std::unique_ptr<Delegate> delegate) {
+ CryptAuthService* cryptauth_service) {
return base::WrapUnique(
- new SecureChannel(std::move(connection), std::move(delegate)));
+ new SecureChannel(std::move(connection), cryptauth_service));
}
// static
@@ -55,8 +56,6 @@ std::string SecureChannel::StatusToString(const Status& status) {
}
}
-SecureChannel::Delegate::~Delegate() {}
-
SecureChannel::PendingMessage::PendingMessage() {}
SecureChannel::PendingMessage::PendingMessage(
@@ -66,15 +65,15 @@ SecureChannel::PendingMessage::PendingMessage(
SecureChannel::PendingMessage::~PendingMessage() {}
SecureChannel::SecureChannel(std::unique_ptr<Connection> connection,
- std::unique_ptr<Delegate> delegate)
+ CryptAuthService* cryptauth_service)
: status_(Status::DISCONNECTED),
connection_(std::move(connection)),
- delegate_(std::move(delegate)),
+ cryptauth_service_(cryptauth_service),
weak_ptr_factory_(this) {
DCHECK(connection_);
DCHECK(!connection_->IsConnected());
DCHECK(!connection_->remote_device().user_id.empty());
- DCHECK(delegate_);
+ DCHECK(cryptauth_service);
connection_->AddObserver(this);
}
@@ -201,9 +200,8 @@ void SecureChannel::Authenticate() {
DCHECK(!authenticator_);
authenticator_ = DeviceToDeviceAuthenticator::Factory::NewInstance(
- connection_.get(),
- connection_->remote_device().user_id,
- delegate_->CreateSecureMessageDelegate());
+ connection_.get(), connection_->remote_device().user_id,
+ cryptauth_service_->CreateSecureMessageDelegate());
authenticator_->Authenticate(
base::Bind(&SecureChannel::OnAuthenticationResult,
weak_ptr_factory_.GetWeakPtr()));
« no previous file with comments | « components/cryptauth/secure_channel.h ('k') | components/cryptauth/secure_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698