| Index: ash/wm/workspace/workspace_manager.h
|
| diff --git a/ash/wm/workspace/workspace_manager.h b/ash/wm/workspace/workspace_manager.h
|
| index 99560e94643da9e141158b32ca069d9814e4fd0e..651b159061fd22e35cf90b1533d880e18dac0b7a 100644
|
| --- a/ash/wm/workspace/workspace_manager.h
|
| +++ b/ash/wm/workspace/workspace_manager.h
|
| @@ -9,8 +9,8 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| -#include "base/observer_list.h"
|
| #include "ash/ash_export.h"
|
| +#include "ui/aura/window_observer.h"
|
| #include "ui/gfx/insets.h"
|
| #include "ui/gfx/size.h"
|
|
|
| @@ -26,34 +26,32 @@ class Rect;
|
| namespace ash {
|
| namespace internal {
|
| class Workspace;
|
| -class WorkspaceObserver;
|
| +class WorkspaceManagerTest;
|
|
|
| // WorkspaceManager manages multiple workspaces in the desktop.
|
| -class ASH_EXPORT WorkspaceManager {
|
| +class ASH_EXPORT WorkspaceManager : public aura::WindowObserver{
|
| public:
|
| explicit WorkspaceManager(aura::Window* viewport);
|
| virtual ~WorkspaceManager();
|
|
|
| - // Returns the Window this WorkspaceManager controls.
|
| - aura::Window* contents_view() { return contents_view_; }
|
| + // Returns true if |window| should be managed by the WorkspaceManager.
|
| + bool IsManagedWindow(aura::Window* window) const;
|
|
|
| - // Create new workspace. Workspace objects are managed by
|
| - // this WorkspaceManager. Deleting workspace will automatically
|
| - // remove the workspace from the workspace_manager.
|
| - Workspace* CreateWorkspace();
|
| + // Adds/removes a window creating/destroying workspace as necessary.
|
| + void AddWindow(aura::Window* window);
|
| + void RemoveWindow(aura::Window* window);
|
|
|
| - // Returns the active workspace.
|
| - Workspace* GetActiveWorkspace() const;
|
| + // Activates the workspace containing |window|. Does nothing if |window| is
|
| + // NULL or not contained in a workspace.
|
| + void SetActiveWorkspaceByWindow(aura::Window* window);
|
|
|
| - // Returns the workspace that contanis the |window|.
|
| - Workspace* FindBy(aura::Window* window) const;
|
| + // Returns the Window this WorkspaceManager controls.
|
| + aura::Window* contents_view() { return contents_view_; }
|
|
|
| // Returns the window for rotate operation based on the |location|.
|
| + // TODO: this isn't currently used; remove if we do away with overview.
|
| aura::Window* FindRotateWindowForLocation(const gfx::Point& location);
|
|
|
| - // Sets the bounds of all workspaces.
|
| - void LayoutWorkspaces();
|
| -
|
| // Returns the bounds in which a window can be moved/resized.
|
| gfx::Rect GetDragAreaBounds();
|
|
|
| @@ -61,25 +59,9 @@ class ASH_EXPORT WorkspaceManager {
|
| void SetOverview(bool overview);
|
| bool is_overview() const { return is_overview_; }
|
|
|
| - // Rotate windows by moving |source| window to the position of |target|.
|
| - void RotateWindows(aura::Window* source, aura::Window* target);
|
| -
|
| // Sets the size of a single workspace (all workspaces have the same size).
|
| void SetWorkspaceSize(const gfx::Size& workspace_size);
|
|
|
| - // Adds/Removes workspace observer.
|
| - void AddObserver(WorkspaceObserver* observer);
|
| - void RemoveObserver(WorkspaceObserver* observer);
|
| -
|
| - // Returns true if this workspace manager is laying out windows.
|
| - // When true, LayoutManager must give windows their requested bounds.
|
| - bool layout_in_progress() const { return layout_in_progress_; }
|
| -
|
| - // Sets the |layout_in_progress_| flag.
|
| - void set_layout_in_progress(bool layout_in_progress) {
|
| - layout_in_progress_ = layout_in_progress;
|
| - }
|
| -
|
| // Sets/Returns the ignored window that the workspace manager does not
|
| // set bounds on.
|
| void set_ignored_window(aura::Window* ignored_window) {
|
| @@ -87,23 +69,52 @@ class ASH_EXPORT WorkspaceManager {
|
| }
|
| aura::Window* ignored_window() { return ignored_window_; }
|
|
|
| + // Overriden from aura::WindowObserver:
|
| + virtual void OnWindowPropertyChanged(aura::Window* window,
|
| + const char* name,
|
| + void* old) OVERRIDE;
|
| +
|
| private:
|
| friend class Workspace;
|
| + friend class WorkspaceManagerTest;
|
|
|
| void AddWorkspace(Workspace* workspace);
|
| void RemoveWorkspace(Workspace* workspace);
|
|
|
| + // Create new workspace. Workspace objects are managed by
|
| + // this WorkspaceManager. Deleting workspace will automatically
|
| + // remove the workspace from the workspace_manager.
|
| + Workspace* CreateWorkspace();
|
| +
|
| + // Returns the active workspace.
|
| + Workspace* GetActiveWorkspace() const;
|
| +
|
| + // Returns the workspace that contanis the |window|.
|
| + Workspace* FindBy(aura::Window* window) const;
|
| +
|
| // Sets the active workspace.
|
| void SetActiveWorkspace(Workspace* workspace);
|
|
|
| - // Returns the bounds of the work are given |workspace_bounds|.
|
| - gfx::Rect GetWorkAreaBounds(const gfx::Rect& workspace_bounds);
|
| + // Returns the bounds of the work area.
|
| + gfx::Rect GetWorkAreaBounds();
|
|
|
| // Returns the index of the workspace that contains the |window|.
|
| int GetWorkspaceIndexContaining(aura::Window* window) const;
|
|
|
| - // Update contents_view size and move the viewport to the active workspace.
|
| - void UpdateContentsView();
|
| + // Sets the bounds of |window|. This sets |ignored_window_| to |window| so
|
| + // that the bounds change is allowed through.
|
| + void SetWindowBounds(aura::Window* window, const gfx::Rect& bounds);
|
| +
|
| + // Resets the bounds of |window| to its restored bounds (if set), ensuring
|
| + // it fits in the the windows current workspace.
|
| + void SetWindowBoundsFromRestoreBounds(aura::Window* window);
|
| +
|
| + // Invoked when the maximized state of |window| changes.
|
| + void MaximizedStateChanged(aura::Window* window);
|
| +
|
| + // Returns the Workspace whose type is TYPE_NORMAL, or NULL if there isn't
|
| + // one.
|
| + Workspace* GetNormalWorkspace();
|
|
|
| aura::Window* contents_view_;
|
|
|
| @@ -118,14 +129,9 @@ class ASH_EXPORT WorkspaceManager {
|
| // True if the workspace manager is in overview mode.
|
| bool is_overview_;
|
|
|
| - // True if this layout manager is laying out windows.
|
| - bool layout_in_progress_;
|
| -
|
| // The window that WorkspaceManager does not set the bounds on.
|
| aura::Window* ignored_window_;
|
|
|
| - ObserverList<WorkspaceObserver> observers_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(WorkspaceManager);
|
| };
|
|
|
|
|