OLD | NEW |
1 #!mojo mojo:sky_viewer | 1 #!mojo mojo:sky_viewer |
2 <!-- | 2 <!-- |
3 // Copyright 2014 The Chromium Authors. All rights reserved. | 3 // Copyright 2014 The Chromium Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
6 --> | 6 --> |
7 <sky> | 7 <sky> |
8 | 8 |
9 <import src="/gen/examples/browser/browser_host.mojom.sky" as="example" /> | 9 <import src="/gen/examples/browser/browser_host.mojom.sky" as="example" /> |
10 | 10 |
11 <import src="/sky/framework/embedder.sky" as="embedder" /> | 11 <import src="/sky/framework/embedder.sky" as="embedder" /> |
| 12 <import src="/sky/framework/sky-box.sky"/> |
12 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> | 13 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> |
13 <import src="/sky/framework/sky-input.sky" /> | 14 <import src="/sky/framework/sky-input.sky" /> |
14 <import src="/sky/framework/sky-box/sky-box.sky"/> | |
15 | 15 |
16 <sky-element name="browser-panel"> | 16 <sky-element name="browser-panel"> |
17 <template> | 17 <template> |
18 <style> | 18 <style> |
19 div { | 19 div { |
20 display: flex; | 20 display: flex; |
21 } | 21 } |
22 </style> | 22 </style> |
23 | 23 |
24 <sky-input id="text" value="{{ url }}" on-keydown="handleKeyDown" /> | 24 <sky-input id="text" value="{{ url }}" on-keydown="handleKeyDown" /> |
25 </template> | 25 </template> |
26 <script> | 26 <script> |
27 module.exports = class extends SkyElement { | 27 module.exports = class extends SkyElement { |
28 created() { | 28 created() { |
29 this.embedder = embedder.connectToEmbedderService(example.BrowserHost) | 29 this.embedder = embedder.connectToEmbedderService(example.BrowserHost) |
30 this.url = "http://"; | 30 this.url = "http://"; |
31 } | 31 } |
32 | 32 |
33 handleKeyDown(event) { | 33 handleKeyDown(event) { |
34 if (event.key == 0xD) | 34 if (event.key == 0xD) |
35 this.embedder.navigateTo(this.url); | 35 this.embedder.navigateTo(this.url); |
36 } | 36 } |
37 }.register(); | 37 }.register(); |
38 </script> | 38 </script> |
39 </sky-element> | 39 </sky-element> |
40 | 40 |
41 <browser-panel /> | 41 <browser-panel /> |
42 </sky> | 42 </sky> |
OLD | NEW |