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

Unified Diff: apps/moterm/moterm_model.h

Issue 1322103006: Moterm: Plumb responses back to the terminal File. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 | apps/moterm/moterm_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/moterm/moterm_model.h
diff --git a/apps/moterm/moterm_model.h b/apps/moterm/moterm_model.h
index e222aa234fa540c2fc021433f9112c87c4fb518d..478b5166976355cbbef1404ae9fe3db60f05d5d6 100644
--- a/apps/moterm/moterm_model.h
+++ b/apps/moterm/moterm_model.h
@@ -103,11 +103,26 @@ class MotermModel {
Rectangle dirty_rect;
};
+ class Delegate {
+ public:
+ // Called when a response is received (i.e., the terminal wants to put data
+ // into the input stream).
+ virtual void OnResponse(const void* buf, size_t size) = 0;
+
+ protected:
+ Delegate() {}
+ ~Delegate() {}
jamesr 2015/09/09 16:49:45 virtual (since you have a vtable already)
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Delegate);
+ };
+
// Maximum number of rows/columns.
static const unsigned kMaxRows = 500; // TODO(vtl): Made up number.
static const unsigned kMaxColumns = T_NUMCOL;
- MotermModel(const Size& max_size, const Size& size);
+ // If non-null, |delegate| must outlive this object.
+ MotermModel(const Size& max_size, const Size& size, Delegate* delegate);
~MotermModel();
// Process the given input bytes, reporting (additional) state changes to
@@ -162,6 +177,7 @@ class MotermModel {
static void OnRespondThunk(void* ctx, const void* buf, size_t size);
const Size max_size_;
+ Delegate* const delegate_;
scoped_ptr<teken_char_t[]> characters_;
scoped_ptr<teken_attr_t[]> attributes_;
« no previous file with comments | « no previous file | apps/moterm/moterm_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698