diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 16:34:51 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 16:34:51 +0000 |
commit | a3301dc481459341169381ed35cd20f5022823b2 (patch) | |
tree | 5b421cde79989939edc925bde317884783cef4ca /ash/wm/workspace_controller.h | |
parent | 5bb69ef0273481de128dfa9f3f4753db3e6e1f92 (diff) | |
download | chromium_src-a3301dc481459341169381ed35cd20f5022823b2.zip chromium_src-a3301dc481459341169381ed35cd20f5022823b2.tar.gz chromium_src-a3301dc481459341169381ed35cd20f5022823b2.tar.bz2 |
Move some more WM functionality down into ash.
http://crbug.com/108457
TEST=none
TBR=sky
Review URL: http://codereview.chromium.org/9035001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/workspace_controller.h')
-rw-r--r-- | ash/wm/workspace_controller.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/ash/wm/workspace_controller.h b/ash/wm/workspace_controller.h new file mode 100644 index 0000000..587c4f9 --- /dev/null +++ b/ash/wm/workspace_controller.h @@ -0,0 +1,91 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_AURA_SHELL_WORKSPACE_CONTROLLER_H_ +#define UI_AURA_SHELL_WORKSPACE_CONTROLLER_H_ +#pragma once + +#include "ash/wm/workspace/workspace_observer.h" +#include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "ui/aura/root_window_observer.h" +#include "ui/aura/window_observer.h" +#include "ui/aura_shell/aura_shell_export.h" +#include "ui/aura_shell/launcher/launcher_model_observer.h" + +namespace aura { +class Window; +} + +namespace gfx { +class Size; +} + +namespace aura_shell { +class LauncherModel; + +namespace internal { + +class WorkspaceManager; + +// WorkspaceControlls owns a WorkspaceManager. WorkspaceControlls bridges +// events From RootWindowObserver translating them to WorkspaceManager, and +// a move event between Laucher and Workspace. +class AURA_SHELL_EXPORT WorkspaceController : + public aura::RootWindowObserver, + public aura::WindowObserver, + public aura_shell::internal::WorkspaceObserver, + public aura_shell::LauncherModelObserver { + public: + explicit WorkspaceController(aura::Window* workspace_viewport); + virtual ~WorkspaceController(); + + void ToggleOverview(); + + void SetLauncherModel(LauncherModel* launcher_model); + + // Returns the workspace manager that this controler owns. + WorkspaceManager* workspace_manager() { + return workspace_manager_.get(); + } + + // aura::RootWindowObserver overrides: + virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; + + // aura::WindowObserver overrides: + virtual void OnWindowPropertyChanged(aura::Window* window, + const char* key, + void* old) OVERRIDE; + + // WorkspaceObserver overrides: + virtual void WindowMoved(WorkspaceManager* manager, + aura::Window* source, + aura::Window* target) OVERRIDE; + virtual void ActiveWorkspaceChanged(WorkspaceManager* manager, + Workspace* old) OVERRIDE; + + // Invoked after an item has been added to the model. + virtual void LauncherItemAdded(int index) OVERRIDE; + virtual void LauncherItemRemoved(int index) OVERRIDE; + virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE; + virtual void LauncherItemImagesChanged(int index) OVERRIDE; + virtual void LauncherItemImagesWillChange(int index) OVERRIDE {} + + private: + scoped_ptr<WorkspaceManager> workspace_manager_; + + // Owned by Launcher. + LauncherModel* launcher_model_; + + // True while the controller is moving window either on workspace or launcher. + // Used to prevent infinite recursive call between the workspace and launcher. + bool ignore_move_event_; + + DISALLOW_COPY_AND_ASSIGN(WorkspaceController); +}; + +} // namespace internal +} // namespace aura_shell + +#endif // UI_AURA_SHELL_WORKSPACE_CONTROLLER_H_ |