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

Unified Diff: device/serial/serial_io_handler.h

Issue 646053002: Implement permission_broker for serial devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix device_unittests. Created 6 years, 2 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 | « no previous file | device/serial/serial_io_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_io_handler.h
diff --git a/device/serial/serial_io_handler.h b/device/serial/serial_io_handler.h
index 5b2d0592db6983e52e65c67014fb01cf81d91ab7..46e0ed0fa2be1efd29b34935617ada01426c4a05 100644
--- a/device/serial/serial_io_handler.h
+++ b/device/serial/serial_io_handler.h
@@ -24,7 +24,8 @@ class SerialIoHandler : public base::NonThreadSafe,
public:
// Constructs an instance of some platform-specific subclass.
static scoped_refptr<SerialIoHandler> Create(
- scoped_refptr<base::MessageLoopProxy> file_thread_message_loop);
+ scoped_refptr<base::MessageLoopProxy> file_thread_message_loop,
+ scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop);
typedef base::Callback<void(bool success)> OpenCompleteCallback;
@@ -32,6 +33,9 @@ class SerialIoHandler : public base::NonThreadSafe,
virtual void Open(const std::string& port,
const OpenCompleteCallback& callback);
+ // Signals that the access request for |port| is complete.
+ void OnRequestAccessComplete(const std::string& port, bool success);
+
// Performs an async Read operation. Behavior is undefined if this is called
// while a Read is already pending. Otherwise, the Done or DoneWithError
// method on |buffer| will eventually be called with a result.
@@ -79,7 +83,8 @@ class SerialIoHandler : public base::NonThreadSafe,
protected:
explicit SerialIoHandler(
- scoped_refptr<base::MessageLoopProxy> file_thread_message_loop);
+ scoped_refptr<base::MessageLoopProxy> file_thread_message_loop,
+ scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop);
virtual ~SerialIoHandler();
// Performs a platform-specific read operation. This must guarantee that
@@ -92,7 +97,7 @@ class SerialIoHandler : public base::NonThreadSafe,
// Performs a platform-specific write operation. This must guarantee that
// WriteCompleted is called when the underlying async operation is completed
// or the SerialIoHandler instance will leak.
- // NOTE: Implementations of Writempl should never call WriteCompleted
+ // NOTE: Implementations of WriteImpl should never call WriteCompleted
// directly. Use QueueWriteCompleted instead to avoid reentrancy.
virtual void WriteImpl() = 0;
@@ -102,6 +107,12 @@ class SerialIoHandler : public base::NonThreadSafe,
// Platform-specific write cancelation.
virtual void CancelWriteImpl() = 0;
+ // Requests access to the underlying serial device, if needed.
+ virtual void RequestAccess(
+ const std::string& port,
+ scoped_refptr<base::MessageLoopProxy> file_message_loop,
+ scoped_refptr<base::MessageLoopProxy> ui_message_loop);
+
// Performs platform-specific, one-time port configuration on open.
virtual bool PostOpen();
@@ -187,6 +198,8 @@ class SerialIoHandler : public base::NonThreadSafe,
OpenCompleteCallback open_complete_;
scoped_refptr<base::MessageLoopProxy> file_thread_message_loop_;
+ // On Chrome OS, PermissionBrokerClient should be called on the UI thread.
+ scoped_refptr<base::MessageLoopProxy> ui_thread_message_loop_;
DISALLOW_COPY_AND_ASSIGN(SerialIoHandler);
};
« no previous file with comments | « no previous file | device/serial/serial_io_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698