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

Unified Diff: components/cryptauth/secure_channel.h

Issue 2697763002: [CrOS Tether]: Create BleConnectionManager, which manages secure connections between the current de… (Closed)
Patch Set: Add missing DEP. Created 3 years, 10 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/fake_secure_channel.cc ('k') | components/cryptauth/secure_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cryptauth/secure_channel.h
diff --git a/components/cryptauth/secure_channel.h b/components/cryptauth/secure_channel.h
index 4e18af9df376ae2002bfbb1ba3d65821176dbce5..3732f242ed6f4822cb7dd27883d787d5d564209e 100644
--- a/components/cryptauth/secure_channel.h
+++ b/components/cryptauth/secure_channel.h
@@ -67,19 +67,34 @@ class SecureChannel : public ConnectionObserver {
CreateSecureMessageDelegate() = 0;
};
- SecureChannel(
- std::unique_ptr<Connection> connection,
- std::unique_ptr<Delegate> delegate);
+ class Factory {
+ public:
+ static std::unique_ptr<SecureChannel> NewInstance(
+ std::unique_ptr<Connection> connection,
+ std::unique_ptr<Delegate> delegate);
+
+ static void SetInstanceForTesting(Factory* factory);
+
+ protected:
+ virtual std::unique_ptr<SecureChannel> BuildInstance(
+ std::unique_ptr<Connection> connection,
+ std::unique_ptr<Delegate> delegate);
+
+ private:
+ static Factory* factory_instance_;
+ };
+
~SecureChannel() override;
- void Initialize();
+ virtual void Initialize();
- void SendMessage(const std::string& feature, const std::string& payload);
+ virtual void SendMessage(const std::string& feature,
+ const std::string& payload);
- void Disconnect();
+ virtual void Disconnect();
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
Status status() const {
return status_;
@@ -95,6 +110,12 @@ class SecureChannel : public ConnectionObserver {
const cryptauth::WireMessage& wire_message,
bool success) override;
+ protected:
+ SecureChannel(std::unique_ptr<Connection> connection,
+ std::unique_ptr<Delegate> delegate);
+
+ Status status_;
+
private:
// Message waiting to be sent. Note that this is *not* the message that will
// end up being sent over the wire; before that can be done, the payload must
@@ -123,7 +144,6 @@ class SecureChannel : public ConnectionObserver {
std::unique_ptr<Delegate> delegate_;
std::unique_ptr<Authenticator> authenticator_;
std::unique_ptr<SecureContext> secure_context_;
- Status status_;
std::deque<PendingMessage> queued_messages_;
std::unique_ptr<PendingMessage> pending_message_;
base::ObserverList<Observer> observer_list_;
« no previous file with comments | « components/cryptauth/fake_secure_channel.cc ('k') | components/cryptauth/secure_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698