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/command_buffer.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"; | 10 import "surfaces/public/interfaces/surface_id.mojom"; |
11 | 11 |
12 struct ViewportMetrics { | 12 struct ViewportMetrics { |
13 Size size; | 13 Size size; |
14 float device_pixel_ratio = 1.0; | 14 float device_pixel_ratio = 1.0; |
15 }; | 15 }; |
16 | 16 |
17 [Client=NativeViewportClient] | |
18 interface NativeViewport { | 17 interface NativeViewport { |
19 // TODO(sky): having a create function is awkward. Should there be a factory | 18 // TODO(sky): having a create function is awkward. Should there be a factory |
20 // to create the NativeViewport that takes the size? | 19 // to create the NativeViewport that takes the size? |
21 Create(Size size) => (uint64 native_viewport_id); | 20 Create(Size size) => (uint64 native_viewport_id, ViewportMetrics metrics); |
21 // Request updated metrics, when they become available. | |
22 RequestMetrics() => (ViewportMetrics metrics); | |
sky
2015/01/28 19:17:33
With this model how would someone know when the me
| |
22 Show(); | 23 Show(); |
23 Hide(); | 24 Hide(); |
24 Close(); | 25 Close(); |
25 SetSize(Size size); | 26 SetSize(Size size); |
26 SubmittedFrame(SurfaceId surface_id); | 27 SubmittedFrame(SurfaceId surface_id); |
27 SetEventDispatcher(NativeViewportEventDispatcher dispatcher); | 28 SetEventDispatcher(NativeViewportEventDispatcher dispatcher); |
28 }; | 29 }; |
29 | 30 |
30 interface NativeViewportEventDispatcher { | 31 interface NativeViewportEventDispatcher { |
31 OnEvent(Event event) => (); | 32 OnEvent(Event event) => (); |
32 }; | 33 }; |
33 | |
34 interface NativeViewportClient { | |
35 // OnMetricsAvailable() is sent at least once after the callback from Create() | |
36 // is called. | |
37 OnMetricsChanged(ViewportMetrics metrics); | |
38 OnDestroyed(); | |
39 }; | |
OLD | NEW |