OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // |MotermDriver| is a class providing a |mojo.files.File| interface, | 5 // |MotermDriver| is a class providing a |mojo.files.File| interface, |
6 // implementing termios-type features (e.g., line editing; TODO(vtl): lots to do | 6 // implementing termios-type features (e.g., line editing; TODO(vtl): lots to do |
7 // here), and appropriately processing bytes to/from the terminal (which gets | 7 // here), and appropriately processing bytes to/from the terminal (which gets |
8 // and sends "raw" data). In essence, this class includes what would | 8 // and sends "raw" data). In essence, this class includes what would |
9 // traditionally be called the terminal driver in a Unix kernel. | 9 // traditionally be called the terminal driver in a Unix kernel. |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // closed or otherwise "broken"). | 32 // closed or otherwise "broken"). |
33 class Client { | 33 class Client { |
34 public: | 34 public: |
35 // Called when we receive data (for the client to "display"). | 35 // Called when we receive data (for the client to "display"). |
36 // TODO(vtl): Maybe add a way to throttle (e.g., for the client to not | 36 // TODO(vtl): Maybe add a way to throttle (e.g., for the client to not |
37 // accept all the data). | 37 // accept all the data). |
38 // TODO(vtl): It's "probably OK" to call |Detach()| from inside this method, | 38 // TODO(vtl): It's "probably OK" to call |Detach()| from inside this method, |
39 // but not verified. | 39 // but not verified. |
40 virtual void OnDataReceived(const void* bytes, size_t num_bytes) = 0; | 40 virtual void OnDataReceived(const void* bytes, size_t num_bytes) = 0; |
41 | 41 |
42 // Called when the terminal "file" is closed (via |Close()|. (The client may | 42 // Called when the terminal "file" is closed (via |Close()|). (The client |
43 // optionally call |Detach()| in response.) | 43 // may optionally call |Detach()| in response.) |
44 virtual void OnClosed() = 0; | 44 virtual void OnClosed() = 0; |
45 | 45 |
46 // Called when this object is destroyed (which will happen if the other end | 46 // Called when this object is destroyed (which will happen if the other end |
47 // of the message pipe is closed). The client must not call |Detach()| in | 47 // of the message pipe is closed). The client must not call |Detach()| in |
48 // response. (Obviously, this will only be called if the client has not | 48 // response. (Obviously, this will only be called if the client has not |
49 // called |Detach()|.) | 49 // called |Detach()|.) |
50 virtual void OnDestroyed() = 0; | 50 virtual void OnDestroyed() = 0; |
51 }; | 51 }; |
52 | 52 |
53 // Static factory method. |client| must either outlive us, or if not call | 53 // Static factory method. |client| must either outlive us, or if not call |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // Output settings: | 168 // Output settings: |
169 // If true, will convert output CRs to CR-NL pairs. | 169 // If true, will convert output CRs to CR-NL pairs. |
170 bool onlcr_; | 170 bool onlcr_; |
171 | 171 |
172 base::WeakPtrFactory<MotermDriver> weak_factory_; | 172 base::WeakPtrFactory<MotermDriver> weak_factory_; |
173 | 173 |
174 DISALLOW_COPY_AND_ASSIGN(MotermDriver); | 174 DISALLOW_COPY_AND_ASSIGN(MotermDriver); |
175 }; | 175 }; |
176 | 176 |
177 #endif // APPS_MOTERM_MOTERM_DRIVER_H_ | 177 #endif // APPS_MOTERM_MOTERM_DRIVER_H_ |
OLD | NEW |