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 |
11 #ifndef APPS_MOTERM_MOTERM_DRIVER_H_ | 11 #ifndef APPS_MOTERM_MOTERM_DRIVER_H_ |
12 #define APPS_MOTERM_MOTERM_DRIVER_H_ | 12 #define APPS_MOTERM_MOTERM_DRIVER_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 #include <stdint.h> | 15 #include <stdint.h> |
16 | 16 |
17 #include <deque> | 17 #include <deque> |
18 | 18 |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
21 #include "mojo/public/cpp/bindings/interface_request.h" | 21 #include "mojo/public/cpp/bindings/interface_request.h" |
22 #include "mojo/public/cpp/bindings/strong_binding.h" | 22 #include "mojo/public/cpp/bindings/strong_binding.h" |
23 #include "mojo/services/files/public/interfaces/file.mojom.h" | 23 #include "mojo/services/files/interfaces/file.mojom.h" |
24 #include "mojo/services/files/public/interfaces/types.mojom.h" | 24 #include "mojo/services/files/interfaces/types.mojom.h" |
25 | 25 |
26 // TODO(vtl): Maybe we should Mojo-fy the driver and run it as a separate app? | 26 // TODO(vtl): Maybe we should Mojo-fy the driver and run it as a separate app? |
27 class MotermDriver : public mojo::files::File { | 27 class MotermDriver : public mojo::files::File { |
28 public: | 28 public: |
29 // The |Client| is basically the terminal implementation itself, to which | 29 // The |Client| is basically the terminal implementation itself, to which |
30 // processed output (from an application, to the "file", through the driver) | 30 // processed output (from an application, to the "file", through the driver) |
31 // is sent. It also receives other notifications (e.g., when the "file" is | 31 // is sent. It also receives other notifications (e.g., when the "file" is |
32 // closed or otherwise "broken"). | 32 // closed or otherwise "broken"). |
33 class Client { | 33 class Client { |
34 public: | 34 public: |
(...skipping 133 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 |