blob: a2bd955912069b7bb894aaa3642846ec360d2775 [file] [log] [blame]
revemanb195f41d2015-11-19 22:16:481// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_EXO_SURFACE_DELEGATE_H_
6#define COMPONENTS_EXO_SURFACE_DELEGATE_H_
7
David Reveman786d3182017-12-20 22:04:338#include "third_party/skia/include/core/SkColor.h"
David Reveman32715092017-12-05 18:24:119#include "ui/gfx/geometry/point.h"
10
revemanb195f41d2015-11-19 22:16:4811namespace exo {
David Reveman32715092017-12-05 18:24:1112class Surface;
revemanb195f41d2015-11-19 22:16:4813
David Reveman93f67c02017-09-06 03:23:0814// Frame types that can be used to decorate a surface.
Mitsuru Oshima8f000502018-04-07 23:11:5015enum class SurfaceFrameType { NONE, NORMAL, SHADOW, AUTOHIDE, OVERLAY };
David Reveman93f67c02017-09-06 03:23:0816
revemanb195f41d2015-11-19 22:16:4817// Handles events on surfaces in context-specific ways.
18class SurfaceDelegate {
19 public:
revemanb195f41d2015-11-19 22:16:4820 // Called when surface was requested to commit all double-buffered state.
21 virtual void OnSurfaceCommit() = 0;
22
reveman27fe2642015-11-20 06:33:3923 // Returns true if surface is in synchronized mode. ie. commit of
24 // double-buffered state should be synchronized with parent surface.
25 virtual bool IsSurfaceSynchronized() const = 0;
26
Dominik Laskowski14a163772018-02-09 19:25:1827 // Returns true if surface should receive input events.
28 virtual bool IsInputEnabled(Surface* surface) const = 0;
Dominik Laskowski3e2f94792017-12-15 00:27:1029
David Reveman32715092017-12-05 18:24:1130 // Called when surface was requested to use a specific frame type.
David Reveman93f67c02017-09-06 03:23:0831 virtual void OnSetFrame(SurfaceFrameType type) = 0;
32
David Reveman786d3182017-12-20 22:04:3333 // Called when surface was requested to use a specific set of frame colors.
34 virtual void OnSetFrameColors(SkColor active_color,
35 SkColor inactive_color) = 0;
36
David Reveman32715092017-12-05 18:24:1137 // Called when a new "parent" was requested for this surface. |position|
38 // is the initial position of surface relative to origin of parent.
39 virtual void OnSetParent(Surface* parent, const gfx::Point& position) = 0;
40
Tim Zheng08df5662018-04-04 05:08:1541 // Called when surface was requested to set a specific startup ID label.
42 virtual void OnSetStartupId(const char* startup_id) = 0;
43
David Reveman21e2236d2018-04-12 06:01:1044 // Called when surface was requested to set a specific application ID label.
45 virtual void OnSetApplicationId(const char* application_id) = 0;
46
Chloe Pelling8a8acdeb2020-07-07 10:45:2047 // Whether to hide the shelf when fullscreen. If true, shelf is inaccessible
48 // (plain fullscreen). If false, shelf auto-hides and can be shown with a
49 // mouse gesture (immersive fullscreen).
50 virtual void SetUseImmersiveForFullscreen(bool value) = 0;
51
Nicholas Hollingumbad8a05f62019-12-05 05:56:2152 // Called when the surface's application wants it to be activated.
53 virtual void OnActivationRequested() = 0;
54
Mitsuru Oshima91322d52020-08-03 22:43:3355 // Called when the new outoupt resource is created.
56 virtual void OnNewOutputAdded() = 0;
57
revemanb195f41d2015-11-19 22:16:4858 protected:
59 virtual ~SurfaceDelegate() {}
60};
61
62} // namespace exo
63
64#endif // COMPONENTS_EXO_SURFACE_DELEGATE_H_