| 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_CONTROLLER_H_ | 5 #ifndef ASH_WM_WORKSPACE_CONTROLLER_H_ |
| 6 #define ASH_WM_WORKSPACE_CONTROLLER_H_ | 6 #define ASH_WM_WORKSPACE_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 13 #include "ui/base/models/simple_menu_model.h" | |
| 14 | 13 |
| 15 namespace aura { | 14 namespace aura { |
| 16 class Window; | 15 class Window; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace gfx { | |
| 20 class Point; | |
| 21 class Size; | |
| 22 } | |
| 23 | |
| 24 namespace views { | |
| 25 class MenuRunner; | |
| 26 class Widget; | |
| 27 } | |
| 28 | |
| 29 namespace ash { | 18 namespace ash { |
| 30 namespace internal { | 19 namespace internal { |
| 31 | 20 |
| 32 class WorkspaceControllerTestHelper; | 21 class WorkspaceControllerTestHelper; |
| 33 class WorkspaceEventFilter; | 22 class WorkspaceEventFilter; |
| 34 class WorkspaceLayoutManager; | 23 class WorkspaceLayoutManager; |
| 35 class WorkspaceManager; | 24 class WorkspaceManager; |
| 36 | 25 |
| 37 // WorkspaceController acts as a central place that ties together all the | 26 // WorkspaceController acts as a central place that ties together all the |
| 38 // various workspace pieces: WorkspaceManager, WorkspaceLayoutManager and | 27 // various workspace pieces: WorkspaceManager, WorkspaceLayoutManager and |
| 39 // WorkspaceEventFilter. | 28 // WorkspaceEventFilter. |
| 40 class ASH_EXPORT WorkspaceController : | 29 class ASH_EXPORT WorkspaceController : |
| 41 public aura::WindowObserver, | 30 public aura::WindowObserver { |
| 42 public ui::SimpleMenuModel::Delegate { | |
| 43 public: | 31 public: |
| 44 explicit WorkspaceController(aura::Window* viewport); | 32 explicit WorkspaceController(aura::Window* viewport); |
| 45 virtual ~WorkspaceController(); | 33 virtual ~WorkspaceController(); |
| 46 | 34 |
| 47 void ToggleOverview(); | 35 void ToggleOverview(); |
| 48 | 36 |
| 49 // Returns the workspace manager that this controller owns. | 37 // Returns the workspace manager that this controller owns. |
| 50 WorkspaceManager* workspace_manager() { | 38 WorkspaceManager* workspace_manager() { |
| 51 return workspace_manager_.get(); | 39 return workspace_manager_.get(); |
| 52 } | 40 } |
| 53 | 41 |
| 54 // Shows the menu allowing you to configure various aspects of workspaces. | |
| 55 void ShowMenu(views::Widget* widget, const gfx::Point& location); | |
| 56 | |
| 57 // Sets the size of the grid. | 42 // Sets the size of the grid. |
| 58 void SetGridSize(int grid_size); | 43 void SetGridSize(int grid_size); |
| 59 | 44 |
| 60 // aura::WindowObserver overrides: | 45 // aura::WindowObserver overrides: |
| 61 virtual void OnWindowPropertyChanged(aura::Window* window, | 46 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 62 const void* key, | 47 const void* key, |
| 63 intptr_t old) OVERRIDE; | 48 intptr_t old) OVERRIDE; |
| 64 | 49 |
| 65 // ui::SimpleMenuModel::Delegate overrides: | |
| 66 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
| 67 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
| 68 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
| 69 virtual bool GetAcceleratorForCommandId( | |
| 70 int command_id, | |
| 71 ui::Accelerator* accelerator) OVERRIDE; | |
| 72 | |
| 73 private: | 50 private: |
| 74 friend class WorkspaceControllerTestHelper; | 51 friend class WorkspaceControllerTestHelper; |
| 75 | 52 |
| 76 enum MenuItem { | |
| 77 MENU_CHANGE_WALLPAPER, | |
| 78 }; | |
| 79 | |
| 80 aura::Window* viewport_; | 53 aura::Window* viewport_; |
| 81 | 54 |
| 82 scoped_ptr<WorkspaceManager> workspace_manager_; | 55 scoped_ptr<WorkspaceManager> workspace_manager_; |
| 83 | 56 |
| 84 // Owned by the window its attached to. | 57 // Owned by the window its attached to. |
| 85 WorkspaceLayoutManager* layout_manager_; | 58 WorkspaceLayoutManager* layout_manager_; |
| 86 | 59 |
| 87 // Owned by |viewport_|. | 60 // Owned by |viewport_|. |
| 88 WorkspaceEventFilter* event_filter_; | 61 WorkspaceEventFilter* event_filter_; |
| 89 | 62 |
| 90 #if !defined(OS_MACOSX) | |
| 91 scoped_ptr<views::MenuRunner> menu_runner_; | |
| 92 #endif | |
| 93 | |
| 94 DISALLOW_COPY_AND_ASSIGN(WorkspaceController); | 63 DISALLOW_COPY_AND_ASSIGN(WorkspaceController); |
| 95 }; | 64 }; |
| 96 | 65 |
| 97 } // namespace internal | 66 } // namespace internal |
| 98 } // namespace ash | 67 } // namespace ash |
| 99 | 68 |
| 100 #endif // ASH_WM_WORKSPACE_CONTROLLER_H_ | 69 #endif // ASH_WM_WORKSPACE_CONTROLLER_H_ |
| OLD | NEW |