reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 1 | // 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 Reveman | 786d318 | 2017-12-20 22:04:33 | [diff] [blame] | 8 | #include "third_party/skia/include/core/SkColor.h" |
David Reveman | 3271509 | 2017-12-05 18:24:11 | [diff] [blame] | 9 | #include "ui/gfx/geometry/point.h" |
| 10 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 11 | namespace exo { |
David Reveman | 3271509 | 2017-12-05 18:24:11 | [diff] [blame] | 12 | class Surface; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 13 | |
David Reveman | 93f67c0 | 2017-09-06 03:23:08 | [diff] [blame] | 14 | // Frame types that can be used to decorate a surface. |
Mitsuru Oshima | 8f00050 | 2018-04-07 23:11:50 | [diff] [blame] | 15 | enum class SurfaceFrameType { NONE, NORMAL, SHADOW, AUTOHIDE, OVERLAY }; |
David Reveman | 93f67c0 | 2017-09-06 03:23:08 | [diff] [blame] | 16 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 17 | // Handles events on surfaces in context-specific ways. |
| 18 | class SurfaceDelegate { |
| 19 | public: |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 20 | // Called when surface was requested to commit all double-buffered state. |
| 21 | virtual void OnSurfaceCommit() = 0; |
| 22 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 23 | // 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 Laskowski | 14a16377 | 2018-02-09 19:25:18 | [diff] [blame] | 27 | // Returns true if surface should receive input events. |
| 28 | virtual bool IsInputEnabled(Surface* surface) const = 0; |
Dominik Laskowski | 3e2f9479 | 2017-12-15 00:27:10 | [diff] [blame] | 29 | |
David Reveman | 3271509 | 2017-12-05 18:24:11 | [diff] [blame] | 30 | // Called when surface was requested to use a specific frame type. |
David Reveman | 93f67c0 | 2017-09-06 03:23:08 | [diff] [blame] | 31 | virtual void OnSetFrame(SurfaceFrameType type) = 0; |
| 32 | |
David Reveman | 786d318 | 2017-12-20 22:04:33 | [diff] [blame] | 33 | // 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 Reveman | 3271509 | 2017-12-05 18:24:11 | [diff] [blame] | 37 | // 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 Zheng | 08df566 | 2018-04-04 05:08:15 | [diff] [blame] | 41 | // Called when surface was requested to set a specific startup ID label. |
| 42 | virtual void OnSetStartupId(const char* startup_id) = 0; |
| 43 | |
David Reveman | 21e2236d | 2018-04-12 06:01:10 | [diff] [blame] | 44 | // Called when surface was requested to set a specific application ID label. |
| 45 | virtual void OnSetApplicationId(const char* application_id) = 0; |
| 46 | |
Chloe Pelling | 8a8acdeb | 2020-07-07 10:45:20 | [diff] [blame] | 47 | // 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 Hollingum | bad8a05f6 | 2019-12-05 05:56:21 | [diff] [blame] | 52 | // Called when the surface's application wants it to be activated. |
| 53 | virtual void OnActivationRequested() = 0; |
| 54 | |
Mitsuru Oshima | 91322d5 | 2020-08-03 22:43:33 | [diff] [blame] | 55 | // Called when the new outoupt resource is created. |
| 56 | virtual void OnNewOutputAdded() = 0; |
| 57 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 58 | protected: |
| 59 | virtual ~SurfaceDelegate() {} |
| 60 | }; |
| 61 | |
| 62 | } // namespace exo |
| 63 | |
| 64 | #endif // COMPONENTS_EXO_SURFACE_DELEGATE_H_ |