// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

library fuchsia.ui.policy;

using fuchsia.ui.gfx;
using fuchsia.ui.viewsv1token;

// The Presenter service provides a way for applications to ask that a
// specified view be added to a view tree, leaving any window management
// concerns up to the discretion of the presenter implementation.
//
// TODO(SCN-599): this will be replaced by Presenter2
[Discoverable]
interface Presenter {
    1: Present2(handle<eventpair> view_owner_token, request<Presentation>? presentation_request);

    // Sets new default renderer params and forces them on for the duration of the
    // presenter's lifetime. Only applies to any subsequent calls to Present().
    // Used for testing.
    2: HACK_SetRendererParams(bool enable_clipping, vector<fuchsia.ui.gfx.RendererParam> params);

    // Set the input path. Root presenter will send to ViewManager (legacy) or Scenic.
    3: HACK_SetInputPath(bool use_legacy);

    // Query the input path. Return true if ViewManager receives input.
    4: HACK_QueryInputPath() -> (bool use_legacy);
};

// The Presenter service provides a way for applications to ask that a
// specified view be added to a view tree, leaving any window management
// concerns up to the discretion of the presenter implementation.
//
// TODO(SCN-595): this is the new presenter interface, which will be renamed
// to Presenter after the original is deleted.
[Discoverable]
interface Presenter2 {
    // Usage: the client creates a pair of eventpairs and uses one to create a
    // View in their Scenic session.  The other eventpair is passed to this
    // method as |view_holder_token|; the Presenter2 service will use this to
    // create a ViewHolder which is embedded within an appropriate Scenic scene,
    // such that the client View it will receive input events, etc.
    1: PresentView(handle<eventpair> view_holder_token, request<Presentation>? presentation_request);
};