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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_
6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 14 matching lines...) Expand all
25 // Constructs an instance of some platform-specific subclass. 25 // Constructs an instance of some platform-specific subclass.
26 static scoped_refptr<SerialIoHandler> Create( 26 static scoped_refptr<SerialIoHandler> Create(
27 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop); 27 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop);
28 28
29 typedef base::Callback<void(bool success)> OpenCompleteCallback; 29 typedef base::Callback<void(bool success)> OpenCompleteCallback;
30 30
31 // Initiates an asynchronous Open of the device. 31 // Initiates an asynchronous Open of the device.
32 virtual void Open(const std::string& port, 32 virtual void Open(const std::string& port,
33 const OpenCompleteCallback& callback); 33 const OpenCompleteCallback& callback);
34 34
35 // TODO: Comment.
36 void OnRequestAccessComplete(const std::string& port, bool success);
37
35 // Performs an async Read operation. Behavior is undefined if this is called 38 // Performs an async Read operation. Behavior is undefined if this is called
36 // while a Read is already pending. Otherwise, the Done or DoneWithError 39 // while a Read is already pending. Otherwise, the Done or DoneWithError
37 // method on |buffer| will eventually be called with a result. 40 // method on |buffer| will eventually be called with a result.
38 void Read(scoped_ptr<WritableBuffer> buffer); 41 void Read(scoped_ptr<WritableBuffer> buffer);
39 42
40 // Performs an async Write operation. Behavior is undefined if this is called 43 // Performs an async Write operation. Behavior is undefined if this is called
41 // while a Write is already pending. Otherwise, the Done or DoneWithError 44 // while a Write is already pending. Otherwise, the Done or DoneWithError
42 // method on |buffer| will eventually be called with a result. 45 // method on |buffer| will eventually be called with a result.
43 void Write(scoped_ptr<ReadOnlyBuffer> buffer); 46 void Write(scoped_ptr<ReadOnlyBuffer> buffer);
44 47
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // NOTE: Implementations of Writempl should never call WriteCompleted 98 // NOTE: Implementations of Writempl should never call WriteCompleted
96 // directly. Use QueueWriteCompleted instead to avoid reentrancy. 99 // directly. Use QueueWriteCompleted instead to avoid reentrancy.
97 virtual void WriteImpl() = 0; 100 virtual void WriteImpl() = 0;
98 101
99 // Platform-specific read cancelation. 102 // Platform-specific read cancelation.
100 virtual void CancelReadImpl() = 0; 103 virtual void CancelReadImpl() = 0;
101 104
102 // Platform-specific write cancelation. 105 // Platform-specific write cancelation.
103 virtual void CancelWriteImpl() = 0; 106 virtual void CancelWriteImpl() = 0;
104 107
108 // TODO: Comment.
109 virtual void RequestAccess(
110 const std::string& port,
111 scoped_refptr<base::MessageLoopProxy> io_message_loop);
112
105 // Performs platform-specific, one-time port configuration on open. 113 // Performs platform-specific, one-time port configuration on open.
106 virtual bool PostOpen(); 114 virtual bool PostOpen();
107 115
108 // Called by the implementation to signal that the active read has completed. 116 // Called by the implementation to signal that the active read has completed.
109 // WARNING: Calling this method can destroy the SerialIoHandler instance 117 // WARNING: Calling this method can destroy the SerialIoHandler instance
110 // if the associated I/O operation was the only thing keeping it alive. 118 // if the associated I/O operation was the only thing keeping it alive.
111 void ReadCompleted(int bytes_read, serial::ReceiveError error); 119 void ReadCompleted(int bytes_read, serial::ReceiveError error);
112 120
113 // Called by the implementation to signal that the active write has completed. 121 // Called by the implementation to signal that the active write has completed.
114 // WARNING: Calling this method may destroy the SerialIoHandler instance 122 // WARNING: Calling this method may destroy the SerialIoHandler instance
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 OpenCompleteCallback open_complete_; 195 OpenCompleteCallback open_complete_;
188 196
189 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop_; 197 scoped_refptr<base::MessageLoopProxy> file_thread_message_loop_;
190 198
191 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); 199 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler);
192 }; 200 };
193 201
194 } // namespace device 202 } // namespace device
195 203
196 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ 204 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | device/serial/serial_io_handler.cc » ('j') | device/serial/serial_io_handler_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698