OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_H_ | 5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_H_ |
6 #define ASH_WM_WORKSPACE_WORKSPACE_H_ | 6 #define ASH_WM_WORKSPACE_WORKSPACE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace aura { | 14 namespace aura { |
15 class Window; | 15 class Window; |
16 } | 16 } |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Rect; | 19 class Rect; |
20 } | 20 } |
21 | 21 |
22 namespace ash { | 22 namespace ash { |
23 namespace internal { | 23 namespace internal { |
24 | 24 |
25 class WorkspaceEventHandler; | 25 class WorkspaceEventHandler; |
26 class WorkspaceLayoutManager; | 26 class WorkspaceLayoutManager; |
27 class WorkspaceManager; | 27 class WorkspaceManager; |
28 | 28 |
29 // Workspace is used to maintain either a single fullscreen windows (including | 29 // Workspace is used to maintain any number of windows (for the desktop). |
30 // transients and other windows) or any number of windows (for the | 30 // Workspace is used by WorkspaceManager to manage a set of windows. |
31 // desktop). Workspace is used by WorkspaceManager to manage a set of windows. | |
32 class ASH_EXPORT Workspace { | 31 class ASH_EXPORT Workspace { |
33 public: | 32 public: |
34 Workspace(WorkspaceManager* manager, | 33 Workspace(WorkspaceManager* manager, |
35 aura::Window* parent, | 34 aura::Window* parent); |
36 bool is_fullscreen); | |
37 ~Workspace(); | 35 ~Workspace(); |
38 | 36 |
39 // Returns the topmost activatable window. This corresponds to the most | 37 // Returns the topmost activatable window. This corresponds to the most |
40 // recently activated window in the workspace. | 38 // recently activated window in the workspace. |
41 aura::Window* GetTopmostActivatableWindow(); | 39 aura::Window* GetTopmostActivatableWindow(); |
42 | 40 |
43 // Resets state. This should be used before destroying the Workspace. | 41 // Resets state. This should be used before destroying the Workspace. |
44 aura::Window* ReleaseWindow(); | 42 aura::Window* ReleaseWindow(); |
45 | 43 |
46 bool is_fullscreen() const { return is_fullscreen_; } | |
47 | |
48 aura::Window* window() { return window_; } | 44 aura::Window* window() { return window_; } |
49 | 45 |
50 const WorkspaceLayoutManager* workspace_layout_manager() const { | 46 const WorkspaceLayoutManager* workspace_layout_manager() const { |
51 return workspace_layout_manager_; | 47 return workspace_layout_manager_; |
52 } | 48 } |
53 WorkspaceLayoutManager* workspace_layout_manager() { | 49 WorkspaceLayoutManager* workspace_layout_manager() { |
54 return workspace_layout_manager_; | 50 return workspace_layout_manager_; |
55 } | 51 } |
56 | 52 |
57 const WorkspaceManager* workspace_manager() const { | 53 const WorkspaceManager* workspace_manager() const { |
58 return workspace_manager_; | 54 return workspace_manager_; |
59 } | 55 } |
60 WorkspaceManager* workspace_manager() { return workspace_manager_; } | 56 WorkspaceManager* workspace_manager() { return workspace_manager_; } |
61 | 57 |
62 // Returns true if the Workspace should be moved to pending. This is true | |
63 // if there are no visible fullscreen windows. | |
64 bool ShouldMoveToPending() const; | |
65 | |
66 // Returns the number of fullscreen windows (including minimized windows that | |
67 // would be fullscreen on restore). This does not consider visibility. | |
68 int GetNumFullscreenWindows() const; | |
69 | |
70 private: | 58 private: |
71 // Is this a workspace for fullscreen windows? | |
72 const bool is_fullscreen_; | |
73 | |
74 WorkspaceManager* workspace_manager_; | 59 WorkspaceManager* workspace_manager_; |
75 | 60 |
76 // Our Window, owned by |parent| passed to the constructor. | 61 // Our Window, owned by |parent| passed to the constructor. |
77 aura::Window* window_; | 62 aura::Window* window_; |
78 | 63 |
79 scoped_ptr<WorkspaceEventHandler> event_handler_; | 64 scoped_ptr<WorkspaceEventHandler> event_handler_; |
80 | 65 |
81 WorkspaceLayoutManager* workspace_layout_manager_; | 66 WorkspaceLayoutManager* workspace_layout_manager_; |
82 | 67 |
83 DISALLOW_COPY_AND_ASSIGN(Workspace); | 68 DISALLOW_COPY_AND_ASSIGN(Workspace); |
84 }; | 69 }; |
85 | 70 |
86 } // namespace internal | 71 } // namespace internal |
87 } // namespace ash | 72 } // namespace ash |
88 | 73 |
89 #endif // ASH_WM_WORKSPACE_WORKSPACE_H_ | 74 #endif // ASH_WM_WORKSPACE_WORKSPACE_H_ |
OLD | NEW |