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