Avi Drissman | 3a215d1e | 2022-09-07 19:43:09 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [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 ASH_WM_WINDOW_STATE_DELEGATE_H_ |
| 6 | #define ASH_WM_WINDOW_STATE_DELEGATE_H_ |
| 7 | |
Xiyuan Xia | e3b8049 | 2022-03-29 16:17:27 | [diff] [blame] | 8 | #include <memory> |
| 9 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 10 | #include "ash/ash_export.h" |
Xiyuan Xia | e3b8049 | 2022-03-29 16:17:27 | [diff] [blame] | 11 | #include "ash/public/cpp/presentation_time_recorder.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 12 | |
Mitsuru Oshima | 89e5c135 | 2018-01-17 07:29:39 | [diff] [blame] | 13 | namespace gfx { |
Mitsuru Oshima | 62488648 | 2020-01-09 19:53:40 | [diff] [blame] | 14 | class PointF; |
Mitsuru Oshima | 89e5c135 | 2018-01-17 07:29:39 | [diff] [blame] | 15 | } |
| 16 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 17 | namespace ash { |
James Cook | 00e65e9 | 2019-07-25 03:19:08 | [diff] [blame] | 18 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 19 | class WindowState; |
| 20 | |
| 21 | class ASH_EXPORT WindowStateDelegate { |
| 22 | public: |
| 23 | WindowStateDelegate(); |
Peter Boström | ec31a04 | 2021-09-16 23:37:34 | [diff] [blame] | 24 | |
| 25 | WindowStateDelegate(const WindowStateDelegate&) = delete; |
| 26 | WindowStateDelegate& operator=(const WindowStateDelegate&) = delete; |
| 27 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 28 | virtual ~WindowStateDelegate(); |
| 29 | |
Sean Kau | 8542a12 | 2021-10-15 22:46:06 | [diff] [blame] | 30 | // Toggles the window into or out of the fullscreen state. If the window is |
| 31 | // not fullscreen and the window supports immersive fullscreen |
| 32 | // ToggleFullscreen() should put the window into immersive fullscreen instead |
| 33 | // of the default fullscreen type. The caller (ash::WindowState) falls backs |
| 34 | // to the default implementation if this returns false. |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 35 | virtual bool ToggleFullscreen(WindowState* window_state); |
| 36 | |
Sean Kau | 8542a12 | 2021-10-15 22:46:06 | [diff] [blame] | 37 | // Toggles the locked fullscreen state, aka Pinned and TrustedPinned, where a |
| 38 | // window has exclusive control of the screen. Implementers should implement |
| 39 | // restrictions related to the relevant pinned mode for their window in this |
| 40 | // function. |
| 41 | virtual void ToggleLockedFullscreen(WindowState* window_state); |
| 42 | |
Mitsuru Oshima | 89e5c135 | 2018-01-17 07:29:39 | [diff] [blame] | 43 | // Invoked when the user started drag operation. |component| must be |
| 44 | // a member of ui::HitTestCompat enum and specifies which part of |
| 45 | // the window the pointer device was on when the user started drag |
Xiyuan Xia | e3b8049 | 2022-03-29 16:17:27 | [diff] [blame] | 46 | // operation. Returns a presentation time recorder that could be used to |
| 47 | // track resize latency. |
| 48 | virtual std::unique_ptr<PresentationTimeRecorder> OnDragStarted( |
| 49 | int component); |
Mitsuru Oshima | 89e5c135 | 2018-01-17 07:29:39 | [diff] [blame] | 50 | |
| 51 | // Invoked when the user finished drag operation. |cancel| is true |
| 52 | // if the drag operation was canceled. |
Mitsuru Oshima | 62488648 | 2020-01-09 19:53:40 | [diff] [blame] | 53 | virtual void OnDragFinished(bool cancel, const gfx::PointF& location) {} |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 54 | }; |
| 55 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 56 | } // namespace ash |
| 57 | |
| 58 | #endif // ASH_WM_WINDOW_STATE_DELEGATE_H_ |