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

Unified Diff: remoting/host/security_key/remote_security_key_message_reader_impl.h

Issue 1852283003: Updating Message Reader and Writer classes to use an interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback Created 4 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
Index: remoting/host/security_key/remote_security_key_message_reader_impl.h
diff --git a/remoting/host/security_key/remote_security_key_message_reader.h b/remoting/host/security_key/remote_security_key_message_reader_impl.h
similarity index 62%
copy from remoting/host/security_key/remote_security_key_message_reader.h
copy to remoting/host/security_key/remote_security_key_message_reader_impl.h
index 08ed9297a3be8a942e8793378ca68e1d88186f89..e1e07473ab295dc2c2bd89ebf6023bf6a633c215 100644
--- a/remoting/host/security_key/remote_security_key_message_reader.h
+++ b/remoting/host/security_key/remote_security_key_message_reader_impl.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_H_
-#define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_H_
+#ifndef REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
+#define REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_
#include "base/callback.h"
#include "base/files/file.h"
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread.h"
+#include "remoting/host/security_key/remote_security_key_message_reader.h"
#include "remoting/host/security_key/security_key_message.h"
namespace base {
@@ -19,21 +20,17 @@ class SingleThreadTaskRunner;
namespace remoting {
-// Used for receiving remote security key messages using a file handle.
-class RemoteSecurityKeyMessageReader {
+// RemoteSecurityKeyMessageReader implementation that receives messages from
+// a pipe.
+class RemoteSecurityKeyMessageReaderImpl
+ : public RemoteSecurityKeyMessageReader {
public:
- explicit RemoteSecurityKeyMessageReader(base::File input_file);
- ~RemoteSecurityKeyMessageReader();
-
- // Starts reading messages from the input file provided in the C'Tor.
- // |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);
+ explicit RemoteSecurityKeyMessageReaderImpl(base::File input_file);
+ ~RemoteSecurityKeyMessageReaderImpl() override;
+
+ // RemoteSecurityKeyMessageReader interface.
+ void Start(const SecurityKeyMessageCallback& message_callback,
+ const base::Closure& error_callback) override;
private:
// Reads a message from the remote security key process and passes it to
@@ -59,12 +56,12 @@ class RemoteSecurityKeyMessageReader {
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> read_task_runner_;
- base::WeakPtr<RemoteSecurityKeyMessageReader> reader_;
- base::WeakPtrFactory<RemoteSecurityKeyMessageReader> weak_factory_;
+ base::WeakPtr<RemoteSecurityKeyMessageReaderImpl> reader_;
+ base::WeakPtrFactory<RemoteSecurityKeyMessageReaderImpl> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReader);
+ DISALLOW_COPY_AND_ASSIGN(RemoteSecurityKeyMessageReaderImpl);
};
} // namespace remoting
-#endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_H_
+#endif // REMOTING_HOST_SECURITY_KEY_REMOTE_SECURITY_KEY_MESSAGE_READER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698