Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: ash/wm/workspace/workspace.h

Issue 11201002: Removes worskpace 1 code. Will rename next. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove constants and add back kDisableLoginAnimations Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_WORKSPACE_H_
6 #define ASH_WM_WORKSPACE_H_
7
8 #include <vector>
9
10 #include "ash/ash_export.h"
11 #include "base/basictypes.h"
12 #include "ui/gfx/rect.h"
13
14 namespace aura {
15 class Window;
16 }
17
18 namespace ash {
19 namespace internal {
20
21 class WorkspaceManager;
22
23 // A workspace contains a number of windows. The number of windows a Workspace
24 // may contain is dictated by the type. Typically only one workspace is visible
25 // at a time. The exception to that is when overview mode is active.
26 class ASH_EXPORT Workspace {
27 public:
28 // Type of workspace. The type of workspace dictates the types of windows the
29 // workspace can contain.
30 enum Type {
31 // The workspace holds a single maximized or full screen window.
32 TYPE_MAXIMIZED,
33
34 // Workspace contains non-maximized windows.
35 TYPE_MANAGED,
36 };
37
38 Workspace(WorkspaceManager* manager, Type type);
39 virtual ~Workspace();
40
41 // Returns the type of workspace that can contain |window|.
42 static Type TypeForWindow(aura::Window* window);
43
44 Type type() const { return type_; }
45
46 // Returns true if this workspace has no windows.
47 bool is_empty() const { return windows_.empty(); }
48 size_t num_windows() const { return windows_.size(); }
49 const std::vector<aura::Window*>& windows() const { return windows_; }
50
51 // Adds the |window| at the position after the window |after|. It
52 // inserts at the end if |after| is NULL. Return true if the
53 // |window| was successfully added to this workspace, or false if it
54 // failed.
55 bool AddWindowAfter(aura::Window* window, aura::Window* after);
56
57 // Removes |window| from this workspace.
58 void RemoveWindow(aura::Window* window);
59
60 // Return true if this workspace has |window|.
61 bool Contains(aura::Window* window) const;
62
63 // Activates this workspace.
64 void Activate();
65
66 protected:
67 // Sets the bounds of the specified window.
68 void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds);
69
70 // Returns true if the given |window| can be added to this workspace.
71 virtual bool CanAdd(aura::Window* window) const = 0;
72
73 // Invoked from AddWindowAfter().
74 virtual void OnWindowAddedAfter(aura::Window* window,
75 aura::Window* after) = 0;
76
77 // Invoked from RemoveWindow().
78 virtual void OnWindowRemoved(aura::Window* window) = 0;
79
80 private:
81 const Type type_;
82
83 WorkspaceManager* workspace_manager_;
84
85 // Windows in the workspace in layout order.
86 std::vector<aura::Window*> windows_;
87
88 DISALLOW_COPY_AND_ASSIGN(Workspace);
89 };
90
91 typedef std::vector<Workspace*> Workspaces;
92
93 } // namespace internal
94 } // namespace ash
95
96 #endif // ASH_WM_WORKSPACE_H_
OLDNEW
« no previous file with comments | « ash/wm/workspace/multi_window_resize_controller_unittest.cc ('k') | ash/wm/workspace/workspace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698