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

Unified Diff: sky/examples/terminal/terminal.sky

Issue 1019323002: Make the terminal demo able (to try) to connect to anything. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « sky/examples/terminal/index.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/terminal/terminal.sky
diff --git a/sky/examples/terminal/terminal.sky b/sky/examples/terminal/terminal.sky
index 8f964cd218c4a97f648a150e6cf160b6c41500be..489e46e5d35205012b958c8c166664cdbf102bb1 100644
--- a/sky/examples/terminal/terminal.sky
+++ b/sky/examples/terminal/terminal.sky
@@ -13,9 +13,10 @@
background-color: black;
color: rgb(255, 191, 0);
font-family: 'Courier', 'monospace';
+ font-size: small;
}
.line {
- white-space: pre;
+ white-space: nowrap;
}
</style>
<sky-scrollable id="control" contenteditable />
@@ -60,7 +61,10 @@ class TerminalDisplayImpl extends SkyElement implements TerminalDisplay {
// Initialize with the first line.
_newLine();
- _connect(getAttribute('url'));
+ var url = getAttribute('url');
+ if (url != null) {
+ connect(url);
+ }
}
void _handleKeyDown(KeyboardEvent event) {
@@ -111,15 +115,19 @@ class TerminalDisplayImpl extends SkyElement implements TerminalDisplay {
_newLine();
}
- // TODO(vtl): Should we always auto-connect? Should there be facilities for
- // programmatically connecting? (What if the |url| attribute isn't set?)
- void _connect(String url) {
+ void connect(String url) {
var terminalClient = new terminal.TerminalClientProxy.unbound();
embedder.connectToService(url, terminalClient);
terminalClient.ptr.connectToTerminal(new TerminalFileImpl(this).stub);
terminalClient.close();
}
+ void putString(String s) {
+ for (var i = 0; i < s.length; i++) {
+ putChar(s.codeUnitAt(i));
+ }
+ }
+
// |TerminalDisplay| implementation:
@override
« no previous file with comments | « sky/examples/terminal/index.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698