blob: ee53e81bbe9f1e8fa883a189cb3a9dfceed4ef03 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mojo;
import "geometry/interfaces/geometry.mojom";
import "gpu/interfaces/context_provider.mojom";
import "native_viewport/interfaces/native_viewport_event_dispatcher.mojom";
struct ViewportMetrics {
Size size;
float device_pixel_ratio = 1.0;
};
struct SurfaceConfiguration {
uint8 red_bits = 8;
uint8 green_bits = 8;
uint8 blue_bits = 8;
uint8 alpha_bits = 8;
uint8 depth_bits;
uint8 stencil_bits;
};
[ServiceName="mojo::NativeViewport"]
interface NativeViewport {
// TODO(sky): having a create function is awkward. Should there be a factory
// to create the NativeViewport that takes the size?
// When the viewport is created it is initially shown.
Create(Size size, SurfaceConfiguration? requested_configuration) => (ViewportMetrics metrics);
Show();
Hide();
Close();
SetSize(Size size);
SetEventDispatcher(NativeViewportEventDispatcher dispatcher);
// Requests a ContextProvider capable of producing contexts that draw to
// this native viewport.
GetContextProvider(ContextProvider& provider);
// The initial viewport metrics will be sent in the reply to the Create
// method. Call RequestMetrics() to receive updates when the viewport metrics
// change. The reply will be sent when the viewport metrics are different from
// the values last sent, so to receive continuous updates call this method
// again after receiving the callback.
RequestMetrics() => (ViewportMetrics metrics);
};