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/context_provider.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 | 10 |
11 struct ViewportMetrics { | 11 struct ViewportMetrics { |
12 Size size; | 12 Size size; |
13 float device_pixel_ratio = 1.0; | 13 float device_pixel_ratio = 1.0; |
14 }; | 14 }; |
15 | 15 |
| 16 struct SurfaceConfiguration { |
| 17 uint8 red_bits = 8; |
| 18 uint8 green_bits = 8; |
| 19 uint8 blue_bits = 8; |
| 20 uint8 alpha_bits = 8; |
| 21 uint8 depth_bits; |
| 22 uint8 stencil_bits; |
| 23 }; |
| 24 |
16 interface NativeViewport { | 25 interface NativeViewport { |
17 // TODO(sky): having a create function is awkward. Should there be a factory | 26 // TODO(sky): having a create function is awkward. Should there be a factory |
18 // to create the NativeViewport that takes the size? | 27 // to create the NativeViewport that takes the size? |
19 Create(Size size) => (ViewportMetrics metrics); | 28 Create(Size size, SurfaceConfiguration? requested_configuration) => (ViewportM
etrics metrics); |
20 | 29 |
21 Show(); | 30 Show(); |
22 Hide(); | 31 Hide(); |
23 Close(); | 32 Close(); |
24 SetSize(Size size); | 33 SetSize(Size size); |
25 SetEventDispatcher(NativeViewportEventDispatcher dispatcher); | 34 SetEventDispatcher(NativeViewportEventDispatcher dispatcher); |
26 | 35 |
27 // Requests a ContextProvider capable of producing contexts that draw to | 36 // Requests a ContextProvider capable of producing contexts that draw to |
28 // this native viewport. | 37 // this native viewport. |
29 GetContextProvider(ContextProvider& provider); | 38 GetContextProvider(ContextProvider& provider); |
30 | 39 |
31 // The initial viewport metrics will be sent in the reply to the Create | 40 // The initial viewport metrics will be sent in the reply to the Create |
32 // method. Call RequestMetrics() to receive updates when the viewport metrics | 41 // method. Call RequestMetrics() to receive updates when the viewport metrics |
33 // change. The reply will be sent when the viewport metrics are different from | 42 // change. The reply will be sent when the viewport metrics are different from |
34 // the values last sent, so to receive continuous updates call this method | 43 // the values last sent, so to receive continuous updates call this method |
35 // again after receiving the callback. | 44 // again after receiving the callback. |
36 RequestMetrics() => (ViewportMetrics metrics); | 45 RequestMetrics() => (ViewportMetrics metrics); |
37 }; | 46 }; |
38 | 47 |
39 interface NativeViewportEventDispatcher { | 48 interface NativeViewportEventDispatcher { |
40 OnEvent(Event event) => (); | 49 OnEvent(Event event) => (); |
41 }; | 50 }; |
OLD | NEW |