| Index: remoting/host/security_key/remote_security_key_message_reader.h
|
| diff --git a/remoting/host/security_key/remote_security_key_message_reader.h b/remoting/host/security_key/remote_security_key_message_reader.h
|
| index 08ed9297a3be8a942e8793378ca68e1d88186f89..035244e5f34ca320cceeb7e91fe6dab06bca103b 100644
|
| --- a/remoting/host/security_key/remote_security_key_message_reader.h
|
| +++ b/remoting/host/security_key/remote_security_key_message_reader.h
|
| @@ -5,64 +5,26 @@
|
| #ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_H_
|
| #define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_H_
|
|
|
| -#include "base/callback.h"
|
| -#include "base/files/file.h"
|
| -#include "base/macros.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| -#include "base/memory/weak_ptr.h"
|
| -#include "base/threading/thread.h"
|
| +#include "base/callback_forward.h"
|
| #include "remoting/host/security_key/security_key_message.h"
|
|
|
| -namespace base {
|
| -class SingleThreadTaskRunner;
|
| -} // namespace base
|
| -
|
| namespace remoting {
|
|
|
| -// Used for receiving remote security key messages using a file handle.
|
| +// Interface used for listening for remote security key messages and notifying
|
| +// listeners when one is received.
|
| class RemoteSecurityKeyMessageReader {
|
| public:
|
| - explicit RemoteSecurityKeyMessageReader(base::File input_file);
|
| - ~RemoteSecurityKeyMessageReader();
|
| + virtual ~RemoteSecurityKeyMessageReader() {}
|
|
|
| - // Starts reading messages from the input file provided in the C'Tor.
|
| + // Starts the process of listening for security key messages.
|
| // |message_callback| is called for each received message.
|
| // |error_callback| is called in case of an error or the file is closed.
|
| // This method is asynchronous, callbacks will be called on the thread this
|
| // method is called on. These callbacks can be called up to the point this
|
| // instance is destroyed and may be destroyed as a result of the callback
|
| // being invoked.
|
| - void Start(SecurityKeyMessageCallback message_callback,
|
| - base::Closure error_callback);
|
| -
|
| - private:
|
| - // Reads a message from the remote security key process and passes it to
|
| - // |message_callback_| on the originating thread. Run on |read_task_runner_|.
|
| - void ReadMessage();
|
| -
|
| - // Callback run on |read_task_runner_| when an error occurs or EOF is reached.
|
| - void NotifyError();
|
| -
|
| - // Used for callbacks on the appropriate task runner to signal status changes.
|
| - // These callbacks are invoked on |main_task_runner_|.
|
| - void InvokeMessageCallback(scoped_ptr<SecurityKeyMessage> message);
|
| - void InvokeErrorCallback();
|
| -
|
| - base::File read_stream_;
|
| -
|
| - // Caller-supplied message and error callbacks.
|
| - SecurityKeyMessageCallback message_callback_;
|
| - base::Closure error_callback_;
|
| -
|
| - // Thread used for blocking IO operations.
|
| - base::Thread reader_thread_;
|
| - scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
|
| - scoped_refptr<base::SingleThreadTaskRunner> read_task_runner_;
|
| -
|
| - base::WeakPtr<RemoteSecurityKeyMessageReader> reader_;
|
| - base::WeakPtrFactory<RemoteSecurityKeyMessageReader> weak_factory_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReader);
|
| + virtual void Start(const SecurityKeyMessageCallback& message_callback,
|
| + const base::Closure& error_callback) = 0;
|
| };
|
|
|
| } // namespace remoting
|
|
|