Chromium Code Reviews| Index: components/cryptauth/secure_channel.h |
| diff --git a/components/cryptauth/secure_channel.h b/components/cryptauth/secure_channel.h |
| index 4e18af9df376ae2002bfbb1ba3d65821176dbce5..cfd054c3743a3bc8613b5cd9965029d9764ed15c 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,13 @@ class SecureChannel : public ConnectionObserver { |
| const cryptauth::WireMessage& wire_message, |
| bool success) override; |
| + protected: |
| + SecureChannel( |
|
Ryan Hansberry
2017/02/14 18:27:28
nit: one level too indented
Kyle Horimoto
2017/02/14 22:54:46
Done.
|
| + 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 +145,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_; |