| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 ATHENA_WM_WINDOW_MANAGER_IMPL_H_ | |
| 6 #define ATHENA_WM_WINDOW_MANAGER_IMPL_H_ | |
| 7 | |
| 8 #include "athena/athena_export.h" | |
| 9 #include "athena/input/public/accelerator_manager.h" | |
| 10 #include "athena/wm/public/window_list_provider_observer.h" | |
| 11 #include "athena/wm/public/window_manager.h" | |
| 12 #include "athena/wm/title_drag_controller.h" | |
| 13 #include "athena/wm/window_overview_mode.h" | |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/observer_list.h" | |
| 16 #include "ui/aura/window_observer.h" | |
| 17 | |
| 18 namespace wm { | |
| 19 class ShadowController; | |
| 20 class WMState; | |
| 21 } | |
| 22 | |
| 23 namespace athena { | |
| 24 | |
| 25 namespace test { | |
| 26 class WindowManagerImplTestApi; | |
| 27 } | |
| 28 | |
| 29 class SplitViewController; | |
| 30 class WindowListProviderImpl; | |
| 31 class WindowManagerObserver; | |
| 32 | |
| 33 class ATHENA_EXPORT WindowManagerImpl : public WindowManager, | |
| 34 public WindowOverviewModeDelegate, | |
| 35 public WindowListProviderObserver, | |
| 36 public aura::WindowObserver, | |
| 37 public AcceleratorHandler, | |
| 38 public TitleDragControllerDelegate { | |
| 39 public: | |
| 40 WindowManagerImpl(); | |
| 41 ~WindowManagerImpl() override; | |
| 42 | |
| 43 void ToggleSplitView(); | |
| 44 | |
| 45 // WindowManager: | |
| 46 void EnterOverview() override; | |
| 47 // Exits overview and activates the previously active activity | |
| 48 void ExitOverview() override; | |
| 49 bool IsOverviewModeActive() override; | |
| 50 | |
| 51 private: | |
| 52 friend class test::WindowManagerImplTestApi; | |
| 53 friend class AthenaContainerLayoutManager; | |
| 54 | |
| 55 enum Command { | |
| 56 CMD_EXIT_OVERVIEW, | |
| 57 CMD_TOGGLE_OVERVIEW, | |
| 58 CMD_TOGGLE_SPLIT_VIEW, | |
| 59 }; | |
| 60 | |
| 61 const AcceleratorData kEscAcceleratorData = {TRIGGER_ON_PRESS, | |
| 62 ui::VKEY_ESCAPE, | |
| 63 ui::EF_NONE, | |
| 64 CMD_EXIT_OVERVIEW, | |
| 65 AF_NONE}; | |
| 66 | |
| 67 // Exits overview mode without changing activation. The caller should | |
| 68 // ensure that a window is active after exiting overview mode. | |
| 69 void ExitOverviewNoActivate(); | |
| 70 | |
| 71 void InstallAccelerators(); | |
| 72 | |
| 73 // WindowManager: | |
| 74 void AddObserver(WindowManagerObserver* observer) override; | |
| 75 void RemoveObserver(WindowManagerObserver* observer) override; | |
| 76 void ToggleSplitViewForTest() override; | |
| 77 WindowListProvider* GetWindowListProvider() override; | |
| 78 | |
| 79 // WindowOverviewModeDelegate: | |
| 80 void OnSelectWindow(aura::Window* window) override; | |
| 81 void OnSelectSplitViewWindow(aura::Window* left, | |
| 82 aura::Window* right, | |
| 83 aura::Window* to_activate) override; | |
| 84 | |
| 85 // WindowListProviderObserver: | |
| 86 void OnWindowStackingChangedInList() override; | |
| 87 void OnWindowAddedToList(aura::Window* window) override; | |
| 88 void OnWindowRemovedFromList(aura::Window* removed_window, | |
| 89 int index) override; | |
| 90 | |
| 91 // aura::WindowObserver: | |
| 92 void OnWindowDestroying(aura::Window* window) override; | |
| 93 | |
| 94 // AcceleratorHandler: | |
| 95 bool IsCommandEnabled(int command_id) const override; | |
| 96 bool OnAcceleratorFired(int command_id, | |
| 97 const ui::Accelerator& accelerator) override; | |
| 98 | |
| 99 // TitleDragControllerDelegate: | |
| 100 aura::Window* GetWindowBehind(aura::Window* window) override; | |
| 101 void OnTitleDragStarted(aura::Window* window) override; | |
| 102 void OnTitleDragCompleted(aura::Window* window) override; | |
| 103 void OnTitleDragCanceled(aura::Window* window) override; | |
| 104 | |
| 105 scoped_ptr<aura::Window> container_; | |
| 106 scoped_ptr<WindowListProviderImpl> window_list_provider_; | |
| 107 scoped_ptr<WindowOverviewMode> overview_; | |
| 108 scoped_ptr<SplitViewController> split_view_controller_; | |
| 109 scoped_ptr<wm::WMState> wm_state_; | |
| 110 scoped_ptr<TitleDragController> title_drag_controller_; | |
| 111 scoped_ptr<wm::ShadowController> shadow_controller_; | |
| 112 ObserverList<WindowManagerObserver> observers_; | |
| 113 | |
| 114 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | |
| 115 }; | |
| 116 | |
| 117 } // namespace athena | |
| 118 | |
| 119 #endif // ATHENA_WM_WINDOW_MANAGER_IMPL_H_ | |
| OLD | NEW |