OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_COMMON_WM_WM_GLOBALS_H_ | |
6 #define ASH_COMMON_WM_WM_GLOBALS_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 #include <vector> | |
12 | |
13 #include "ash/ash_export.h" | |
14 | |
15 namespace gfx { | |
16 class Rect; | |
17 } | |
18 | |
19 namespace ash { | |
20 | |
21 class WindowResizer; | |
22 | |
23 namespace wm { | |
24 | |
25 class WindowState; | |
26 class WmActivationObserver; | |
27 class WmDisplayObserver; | |
28 class WmOverviewModeObserver; | |
29 class WmWindow; | |
30 | |
31 enum class WmUserMetricsAction; | |
32 | |
33 // Used for accessing global state. | |
34 class ASH_EXPORT WmGlobals { | |
35 public: | |
36 virtual ~WmGlobals() {} | |
37 | |
38 // This is necessary for a handful of places that is difficult to plumb | |
39 // through context. | |
40 static void Set(WmGlobals* instance); | |
41 static WmGlobals* Get(); | |
42 | |
43 // Creates a new window used as a container of other windows. No painting is | |
44 // done to the created window. | |
45 virtual WmWindow* NewContainerWindow() = 0; | |
46 | |
47 virtual WmWindow* GetFocusedWindow() = 0; | |
48 virtual WmWindow* GetActiveWindow() = 0; | |
49 | |
50 virtual WmWindow* GetPrimaryRootWindow() = 0; | |
51 | |
52 // Returns the root window for the specified display. | |
53 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; | |
54 | |
55 // Returns the root window that newly created windows should be added to. | |
56 // NOTE: this returns the root, newly created window should be added to the | |
57 // appropriate container in the returned window. | |
58 virtual WmWindow* GetRootWindowForNewWindows() = 0; | |
59 | |
60 // Returns the list of most recently used windows. | |
61 virtual std::vector<WmWindow*> GetMruWindowList() = 0; | |
62 | |
63 // Returns the list of most recently used windows excluding modals. | |
64 virtual std::vector<WmWindow*> GetMruWindowListIgnoreModals() = 0; | |
65 | |
66 // Returns true if the first window shown on first run should be | |
67 // unconditionally maximized, overriding the heuristic that normally chooses | |
68 // the window size. | |
69 virtual bool IsForceMaximizeOnFirstRun() = 0; | |
70 | |
71 virtual bool IsUserSessionBlocked() = 0; | |
72 virtual bool IsScreenLocked() = 0; | |
73 | |
74 // See aura::client::CursorClient for details on these. | |
75 virtual void LockCursor() = 0; | |
76 virtual void UnlockCursor() = 0; | |
77 | |
78 virtual std::vector<WmWindow*> GetAllRootWindows() = 0; | |
79 | |
80 virtual void RecordUserMetricsAction(WmUserMetricsAction action) = 0; | |
81 | |
82 // Returns a WindowResizer to handle dragging. |next_window_resizer| is | |
83 // the next WindowResizer in the WindowResizer chain. This may return | |
84 // |next_window_resizer|. | |
85 virtual std::unique_ptr<WindowResizer> CreateDragWindowResizer( | |
86 std::unique_ptr<WindowResizer> next_window_resizer, | |
87 wm::WindowState* window_state) = 0; | |
88 | |
89 // TODO(sky): if WindowSelectorController can't be moved over, move these | |
90 // onto their own local class. | |
91 virtual bool IsOverviewModeSelecting() = 0; | |
92 virtual bool IsOverviewModeRestoringMinimizedWindows() = 0; | |
93 | |
94 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; | |
95 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; | |
96 | |
97 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | |
98 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | |
99 | |
100 virtual void AddOverviewModeObserver(WmOverviewModeObserver* observer) = 0; | |
101 virtual void RemoveOverviewModeObserver(WmOverviewModeObserver* observer) = 0; | |
102 | |
103 private: | |
104 static WmGlobals* instance_; | |
105 }; | |
106 | |
107 } // namespace wm | |
108 } // namespace ash | |
109 | |
110 #endif // ASH_COMMON_WM_WM_GLOBALS_H_ | |
OLD | NEW |