Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 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 UI_AURA_WINDOW_TREE_HOST_OBSERVER_H_ |
| 6 | #define UI_AURA_WINDOW_TREE_HOST_OBSERVER_H_ |
| 7 | |
yjliu | a98c7e43 | 2021-02-26 00:34:51 | [diff] [blame] | 8 | #include "base/containers/flat_set.h" |
| 9 | #include "components/viz/common/surfaces/frame_sink_id.h" |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 10 | #include "ui/aura/aura_export.h" |
David Bienvenu | d0ddda3 | 2018-11-01 16:59:16 | [diff] [blame] | 11 | #include "ui/aura/window.h" |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 12 | |
Scott Violet | 53091cdb2 | 2021-11-02 21:27:12 | [diff] [blame] | 13 | class SkRegion; |
| 14 | |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 15 | namespace aura { |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 16 | class WindowTreeHost; |
| 17 | |
| 18 | class AURA_EXPORT WindowTreeHostObserver { |
| 19 | public: |
| 20 | // Called when the host's client size has changed. |
Sadrul Habib Chowdhury | 9730637 | 2017-08-09 05:47:34 | [diff] [blame] | 21 | virtual void OnHostResized(WindowTreeHost* host) {} |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 22 | |
| 23 | // Called when the host is moved on screen. |
Mitsuru Oshima | 410e5dc3 | 2022-07-26 20:01:43 | [diff] [blame] | 24 | virtual void OnHostMovedInPixels(WindowTreeHost* host) {} |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 25 | |
thomasanderson | 06405c5 | 2016-05-03 22:52:22 | [diff] [blame] | 26 | // Called when the host is moved to a different workspace. |
Sadrul Habib Chowdhury | 9730637 | 2017-08-09 05:47:34 | [diff] [blame] | 27 | virtual void OnHostWorkspaceChanged(WindowTreeHost* host) {} |
thomasanderson | 06405c5 | 2016-05-03 22:52:22 | [diff] [blame] | 28 | |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 29 | // Called when the native window system sends the host request to close. |
Sadrul Habib Chowdhury | 9730637 | 2017-08-09 05:47:34 | [diff] [blame] | 30 | virtual void OnHostCloseRequested(WindowTreeHost* host) {} |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 31 | |
David Bienvenu | d0ddda3 | 2018-11-01 16:59:16 | [diff] [blame] | 32 | // Called when the occlusion status of the native window changes, iff |
| 33 | // occlusion tracking is enabled for a descendant of the root. |
| 34 | virtual void OnOcclusionStateChanged(WindowTreeHost* host, |
Scott Violet | 53091cdb2 | 2021-11-02 21:27:12 | [diff] [blame] | 35 | Window::OcclusionState new_state, |
| 36 | const SkRegion& occluded_region) {} |
David Bienvenu | d0ddda3 | 2018-11-01 16:59:16 | [diff] [blame] | 37 | |
Scott Violet | 436e625 | 2019-04-10 18:24:23 | [diff] [blame] | 38 | // Called before processing a bounds change. The bounds change may result in |
| 39 | // one or both of OnHostResized() and OnHostMovedInPixels() being called. |
| 40 | // This is not supported by all WindowTreeHosts. |
| 41 | // OnHostWillProcessBoundsChange() is always followed by |
| 42 | // OnHostDidProcessBoundsChange(). |
| 43 | virtual void OnHostWillProcessBoundsChange(WindowTreeHost* host) {} |
| 44 | virtual void OnHostDidProcessBoundsChange(WindowTreeHost* host) {} |
| 45 | |
yjliu | a98c7e43 | 2021-02-26 00:34:51 | [diff] [blame] | 46 | virtual void OnCompositingFrameSinksToThrottleUpdated( |
| 47 | const aura::WindowTreeHost* host, |
| 48 | const base::flat_set<viz::FrameSinkId>& ids) {} |
| 49 | |
Andrew Wolfers | 79957f8 | 2024-08-16 19:08:58 | [diff] [blame] | 50 | virtual void OnSetPreferredRefreshRate(WindowTreeHost* host, |
| 51 | float preferred_refresh_rate) {} |
| 52 | |
Mitsuru Oshima | d470cb3 | 2024-12-04 00:24:31 | [diff] [blame] | 53 | // Called when the local surface id of the frame sink embedded in `host` has |
| 54 | // changed. |
| 55 | virtual void OnLocalSurfaceIdChanged(WindowTreeHost* host, |
| 56 | const viz::LocalSurfaceId& id) {} |
| 57 | |
[email protected] | 2d6eb74 | 2014-03-05 18:59:03 | [diff] [blame] | 58 | protected: |
| 59 | virtual ~WindowTreeHostObserver() {} |
| 60 | }; |
| 61 | |
| 62 | } // namespace aura |
| 63 | |
| 64 | #endif // UI_AURA_WINDOW_TREE_HOST_OBSERVER_H_ |