OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 module mojo; | |
6 | |
7 import "components/view_manager/public/interfaces/context_provider.mojom"; | |
8 import "ui/mojo/geometry/geometry.mojom"; | |
9 import "ui/mojo/events/input_events.mojom"; | |
10 | |
11 struct ViewportMetrics { | |
12 Size size; | |
13 // A value of 0 indicates the real value is not yet available. | |
14 float device_pixel_ratio = 0.0; | |
15 }; | |
16 | |
17 interface NativeViewport { | |
18 // TODO(sky): having a create function is awkward. Should there be a factory | |
19 // to create the NativeViewport that takes the size? | |
20 Create(Size size) => (ViewportMetrics metrics); | |
21 | |
22 Show(); | |
23 Hide(); | |
24 Close(); | |
25 SetSize(Size size); | |
26 SetEventDispatcher(NativeViewportEventDispatcher dispatcher); | |
27 | |
28 // Requests a ContextProvider capable of producing contexts that draw to | |
29 // this native viewport. | |
30 GetContextProvider(ContextProvider& provider); | |
31 | |
32 // The initial viewport metrics will be sent in the reply to the Create | |
33 // method. Call RequestMetrics() to receive updates when the viewport metrics | |
34 // change. The reply will be sent when the viewport metrics are different from | |
35 // the values last sent, so to receive continuous updates call this method | |
36 // again after receiving the callback. | |
37 RequestMetrics() => (ViewportMetrics metrics); | |
38 }; | |
39 | |
40 interface NativeViewportEventDispatcher { | |
41 OnEvent(Event event) => (); | |
42 }; | |
OLD | NEW |