James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 1 | // Copyright 2018 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 ASH_SHELL_STATE_H_ |
| 6 | #define ASH_SHELL_STATE_H_ |
| 7 | |
| 8 | #include <stdint.h> |
| 9 | |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 10 | #include "ash/ash_export.h" |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 11 | #include "base/macros.h" |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 12 | |
| 13 | namespace aura { |
| 14 | class Window; |
| 15 | } |
| 16 | |
| 17 | namespace ash { |
| 18 | |
James Cook | 7363ebc | 2018-08-10 21:17:24 | [diff] [blame] | 19 | // TODO(jamescook): Move |root_window_for_new_windows_| to Shell and delete |
James Cook | 05b3a3f | 2018-08-07 00:38:55 | [diff] [blame] | 20 | // this class. |
James Cook | 7363ebc | 2018-08-10 21:17:24 | [diff] [blame] | 21 | class ASH_EXPORT ShellState { |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 22 | public: |
| 23 | ShellState(); |
James Cook | 7363ebc | 2018-08-10 21:17:24 | [diff] [blame] | 24 | ~ShellState(); |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 25 | |
| 26 | // Returns the root window that newly created windows should be added to. |
| 27 | // Value can be temporarily overridden using ScopedRootWindowForNewWindows. |
| 28 | // NOTE: This returns the root; newly created windows should be added to the |
| 29 | // appropriate container in the returned window. |
| 30 | aura::Window* GetRootWindowForNewWindows() const; |
| 31 | |
| 32 | // Updates the root window and notifies observers. |
| 33 | // NOTE: Prefer ScopedRootWindowForNewWindows. |
| 34 | void SetRootWindowForNewWindows(aura::Window* root); |
| 35 | |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 36 | private: |
| 37 | friend class ScopedRootWindowForNewWindows; |
| 38 | |
| 39 | // Sends a state update to all clients. |
| 40 | void NotifyAllClients(); |
| 41 | |
| 42 | int64_t GetDisplayIdForNewWindows() const; |
| 43 | |
| 44 | // Sets the value and updates clients. |
| 45 | void SetScopedRootWindowForNewWindows(aura::Window* root); |
| 46 | |
James Cook | 40f7d75 | 2018-05-25 18:21:58 | [diff] [blame] | 47 | aura::Window* root_window_for_new_windows_ = nullptr; |
| 48 | |
| 49 | // See ScopedRootWindowForNewWindows. |
| 50 | aura::Window* scoped_root_window_for_new_windows_ = nullptr; |
| 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(ShellState); |
| 53 | }; |
| 54 | |
| 55 | } // namespace ash |
| 56 | |
| 57 | #endif // ASH_SHELL_STATE_H_ |