| 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_H_ | 5 #ifndef ASH_WM_WORKSPACE_H_ |
| 6 #define ASH_WM_WORKSPACE_H_ | 6 #define ASH_WM_WORKSPACE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Returns the type of workspace that can contain |window|. | 41 // Returns the type of workspace that can contain |window|. |
| 42 static Type TypeForWindow(aura::Window* window); | 42 static Type TypeForWindow(aura::Window* window); |
| 43 | 43 |
| 44 Type type() const { return type_; } | 44 Type type() const { return type_; } |
| 45 | 45 |
| 46 // Returns true if this workspace has no windows. | 46 // Returns true if this workspace has no windows. |
| 47 bool is_empty() const { return windows_.empty(); } | 47 bool is_empty() const { return windows_.empty(); } |
| 48 size_t num_windows() const { return windows_.size(); } | 48 size_t num_windows() const { return windows_.size(); } |
| 49 const std::vector<aura::Window*>& windows() const { return windows_; } | 49 const std::vector<aura::Window*>& windows() const { return windows_; } |
| 50 | 50 |
| 51 // Returns the work area bounds of this workspace in viewport coordinates. | |
| 52 const gfx::Rect& bounds() const { return bounds_; } | |
| 53 | |
| 54 // Adds the |window| at the position after the window |after|. It | 51 // Adds the |window| at the position after the window |after|. It |
| 55 // inserts at the end if |after| is NULL. Return true if the | 52 // inserts at the end if |after| is NULL. Return true if the |
| 56 // |window| was successfully added to this workspace, or false if it | 53 // |window| was successfully added to this workspace, or false if it |
| 57 // failed. | 54 // failed. |
| 58 bool AddWindowAfter(aura::Window* window, aura::Window* after); | 55 bool AddWindowAfter(aura::Window* window, aura::Window* after); |
| 59 | 56 |
| 60 // Removes |window| from this workspace. | 57 // Removes |window| from this workspace. |
| 61 void RemoveWindow(aura::Window* window); | 58 void RemoveWindow(aura::Window* window); |
| 62 | 59 |
| 63 // Return true if this workspace has |window|. | 60 // Return true if this workspace has |window|. |
| 64 bool Contains(aura::Window* window) const; | 61 bool Contains(aura::Window* window) const; |
| 65 | 62 |
| 66 // Activates this workspace. | 63 // Activates this workspace. |
| 67 void Activate(); | 64 void Activate(); |
| 68 | 65 |
| 69 // Sets the bounds of the workspace. | |
| 70 void SetBounds(const gfx::Rect& bounds); | |
| 71 | |
| 72 protected: | 66 protected: |
| 73 // Sets the bounds of the specified window. | 67 // Sets the bounds of the specified window. |
| 74 void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds); | 68 void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds); |
| 75 | 69 |
| 76 // Sets the ignore window. See WorkspaceManager::set_ignored_window() for | 70 // Sets the ignore window. See WorkspaceManager::set_ignored_window() for |
| 77 // details. | 71 // details. |
| 78 void SetIgnoredWindow(aura::Window* window); | 72 void SetIgnoredWindow(aura::Window* window); |
| 79 | 73 |
| 80 // Returns true if the given |window| can be added to this workspace. | 74 // Returns true if the given |window| can be added to this workspace. |
| 81 virtual bool CanAdd(aura::Window* window) const = 0; | 75 virtual bool CanAdd(aura::Window* window) const = 0; |
| 82 | 76 |
| 83 // Invoked from AddWindowAfter(). | 77 // Invoked from AddWindowAfter(). |
| 84 virtual void OnWindowAddedAfter(aura::Window* window, | 78 virtual void OnWindowAddedAfter(aura::Window* window, |
| 85 aura::Window* after) = 0; | 79 aura::Window* after) = 0; |
| 86 | 80 |
| 87 // Invoked from RemoveWindow(). | 81 // Invoked from RemoveWindow(). |
| 88 virtual void OnWindowRemoved(aura::Window* window) = 0; | 82 virtual void OnWindowRemoved(aura::Window* window) = 0; |
| 89 | 83 |
| 90 // Invoked when the size of the workspace changes. |old_bounds| is the | |
| 91 // previous bounds. | |
| 92 virtual void OnWorkspaceSizeChanged(const gfx::Rect& old_bounds) = 0; | |
| 93 | |
| 94 private: | 84 private: |
| 95 const Type type_; | 85 const Type type_; |
| 96 | 86 |
| 97 WorkspaceManager* workspace_manager_; | 87 WorkspaceManager* workspace_manager_; |
| 98 | 88 |
| 99 // Windows in the workspace in layout order. | 89 // Windows in the workspace in layout order. |
| 100 std::vector<aura::Window*> windows_; | 90 std::vector<aura::Window*> windows_; |
| 101 | 91 |
| 102 gfx::Rect bounds_; | |
| 103 | |
| 104 DISALLOW_COPY_AND_ASSIGN(Workspace); | 92 DISALLOW_COPY_AND_ASSIGN(Workspace); |
| 105 }; | 93 }; |
| 106 | 94 |
| 107 typedef std::vector<Workspace*> Workspaces; | 95 typedef std::vector<Workspace*> Workspaces; |
| 108 | 96 |
| 109 } // namespace internal | 97 } // namespace internal |
| 110 } // namespace ash | 98 } // namespace ash |
| 111 | 99 |
| 112 #endif // ASH_WM_WORKSPACE_H_ | 100 #endif // ASH_WM_WORKSPACE_H_ |
| OLD | NEW |