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.
5 #ifndef ASH_WM_WORKSPACE_CONTROLLER_H_
6 #define ASH_WM_WORKSPACE_CONTROLLER_H_
9 #include "ash/ash_export.h"
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/root_window_observer.h"
13 #include "ui/aura/window_observer.h"
14 #include "ui/base/models/simple_menu_model.h"
33 class WorkspaceEventFilter
;
34 class WorkspaceLayoutManager
;
35 class WorkspaceManager
;
37 // WorkspaceController acts as a central place that ties together all the
38 // various workspace pieces: WorkspaceManager, WorkspaceLayoutManager and
39 // WorkspaceEventFilter.
40 class ASH_EXPORT WorkspaceController
:
41 public aura::RootWindowObserver
,
42 public aura::WindowObserver
,
43 public ui::SimpleMenuModel::Delegate
{
45 explicit WorkspaceController(aura::Window
* viewport
);
46 virtual ~WorkspaceController();
48 void ToggleOverview();
50 // Returns the workspace manager that this controler owns.
51 WorkspaceManager
* workspace_manager() {
52 return workspace_manager_
.get();
55 // Shows the menu allowing you to configure various aspects of workspaces.
56 void ShowMenu(views::Widget
* widget
, const gfx::Point
& location
);
58 // aura::RootWindowObserver overrides:
59 virtual void OnRootWindowResized(const gfx::Size
& new_size
) OVERRIDE
;
61 // aura::WindowObserver overrides:
62 virtual void OnWindowPropertyChanged(aura::Window
* window
,
64 intptr_t old
) OVERRIDE
;
66 // ui::SimpleMenuModel::Delegate overrides:
67 virtual bool IsCommandIdChecked(int command_id
) const OVERRIDE
;
68 virtual bool IsCommandIdEnabled(int command_id
) const OVERRIDE
;
69 virtual void ExecuteCommand(int command_id
) OVERRIDE
;
70 virtual bool GetAcceleratorForCommandId(
72 ui::Accelerator
* accelerator
) OVERRIDE
;
80 aura::Window
* viewport_
;
82 scoped_ptr
<WorkspaceManager
> workspace_manager_
;
84 // Owned by the window its attached to.
85 WorkspaceLayoutManager
* layout_manager_
;
87 // Owned by |viewport_|.
88 WorkspaceEventFilter
* event_filter_
;
90 #if !defined(OS_MACOSX)
91 scoped_ptr
<views::MenuRunner
> menu_runner_
;
94 DISALLOW_COPY_AND_ASSIGN(WorkspaceController
);
97 } // namespace internal
100 #endif // ASH_WM_WORKSPACE_CONTROLLER_H_