OLD | NEW |
---|---|
(Empty) | |
1 #!mojo:sky_viewer | |
2 <!-- | |
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 | |
5 // found in the LICENSE file. | |
6 --> | |
7 <sky> | |
8 <import src="/sky/framework/sky-button/sky-button.sky"/> | |
9 <import src="/sky/framework/sky-checkbox/sky-checkbox.sky"/> | |
10 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement"/> | |
11 <!-- HACK: Hard-coded out/Debug path is wrong, but we can't both expose | |
12 /examples so that c++ can load this .sky url as well as map /examples to the gen | |
13 directory. We'll need a location for mapping /gen urls, presumably to /gen. --> | |
14 <import src="/out/Debug/gen/examples/wm_flow/wm/window_frame_host.mojom.sky" as= "example" /> | |
15 <import src="/sky/framework/shell.sky" as="shell" /> | |
16 | |
17 <style> | |
18 /* FIXME: Hack until the requirement of a single root element is lifted. */ | |
19 sky { height: 100%; } | |
20 </style> | |
21 | |
22 <sky-element name="window-frame"> | |
23 <template> | |
24 <style> | |
25 :host { | |
26 height: 100%; | |
27 background-color: lightgrey; | |
28 } | |
29 /* Nest two flexboxes and make the right side take up as much as possible */ | |
30 window-bar { | |
31 display: flex; | |
32 } | |
33 left { | |
34 flex: 1; | |
35 display: flex; | |
36 align-content: flex-start; | |
37 } | |
38 /* Also making the checkbox and label a flexbox for convenience */ | |
39 right { | |
40 display: flex; | |
41 } | |
42 | |
43 /* Style sky controls to make them look more like ui/views */ | |
44 sky-button { | |
45 border: none; | |
46 border: 1px solid blue; | |
47 padding: 2px; | |
48 } | |
49 sky-button:hover { | |
50 border: 1px solid lightblue; | |
51 background-color: darkgrey; | |
52 } | |
53 </style> | |
54 <window-bar> | |
55 <left> | |
56 <sky-checkbox on-click="handleCaptureClick" />Capture | |
57 </left> | |
58 <right> | |
59 <sky-button on-click="handleEmbiggenClick">Embiggen</sky-button> | |
60 <sky-button on-click="handleBegoneClick">Begone</sky-button> | |
61 </right> | |
62 </window-bar> | |
63 </template> | |
64 <script> | |
65 module.exports = class extends SkyElement { | |
66 // Unclear if this belongs on shell or not? | |
67 connectToEmbedderService(service, client) { | |
68 var handle = internals.connectToEmbedderService(service.name); | |
69 return shell.wrapHandle(handle, service, client); | |
abarth-chromium
2015/01/06 21:20:43
This should be in Sky
| |
70 } | |
71 created() { | |
72 this.embedder = this.connectToEmbedderService(example.WindowFrameHost); | |
73 this.addEventListener('mousedown', function() { | |
74 this.embedder.activateWindow(); | |
75 }.bind(this)); | |
76 } | |
77 handleCaptureClick(event) { | |
78 this.embedder.setCapture(event.target.checked); | |
79 } | |
80 handleEmbiggenClick(event) { | |
81 this.embedder.toggleMaximize(); | |
82 } | |
83 handleBegoneClick(event) { | |
84 this.embedder.closeWindow(); | |
85 } | |
86 }.register(); | |
87 </script> | |
88 </sky-element> | |
89 | |
90 <window-frame /> | |
91 | |
92 </sky> | |
OLD | NEW |