blob: 5b4100e98e9ea0294aef117c612514e6a0e1b8a1 [file] [log] [blame]
James Cook40f7d752018-05-25 18:21:581// 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 Cook40f7d752018-05-25 18:21:5810#include "ash/ash_export.h"
James Cook40f7d752018-05-25 18:21:5811#include "base/macros.h"
James Cook40f7d752018-05-25 18:21:5812
13namespace aura {
14class Window;
15}
16
17namespace ash {
18
James Cook7363ebc2018-08-10 21:17:2419// TODO(jamescook): Move |root_window_for_new_windows_| to Shell and delete
James Cook05b3a3f2018-08-07 00:38:5520// this class.
James Cook7363ebc2018-08-10 21:17:2421class ASH_EXPORT ShellState {
James Cook40f7d752018-05-25 18:21:5822 public:
23 ShellState();
James Cook7363ebc2018-08-10 21:17:2424 ~ShellState();
James Cook40f7d752018-05-25 18:21:5825
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 Cook40f7d752018-05-25 18:21:5836 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 Cook40f7d752018-05-25 18:21:5847 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_