OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "athena/wm/public/window_manager.h" | 5 #include "athena/wm/public/window_manager.h" |
6 | 6 |
7 #include "athena/common/container_priorities.h" | 7 #include "athena/common/container_priorities.h" |
8 #include "athena/input/public/accelerator_manager.h" | 8 #include "athena/input/public/accelerator_manager.h" |
9 #include "athena/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
10 #include "athena/wm/bezel_controller.h" | 10 #include "athena/wm/bezel_controller.h" |
11 #include "athena/wm/public/window_manager_observer.h" | 11 #include "athena/wm/public/window_manager_observer.h" |
12 #include "athena/wm/split_view_controller.h" | 12 #include "athena/wm/split_view_controller.h" |
13 #include "athena/wm/window_overview_mode.h" | 13 #include "athena/wm/window_overview_mode.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "ui/aura/layout_manager.h" | 16 #include "ui/aura/layout_manager.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/wm/core/window_util.h" | 18 #include "ui/wm/core/window_util.h" |
| 19 #include "ui/wm/core/wm_state.h" |
19 #include "ui/wm/public/window_types.h" | 20 #include "ui/wm/public/window_types.h" |
20 | 21 |
21 namespace athena { | 22 namespace athena { |
22 namespace { | 23 namespace { |
23 | 24 |
24 class WindowManagerImpl : public WindowManager, | 25 class WindowManagerImpl : public WindowManager, |
25 public WindowOverviewModeDelegate, | 26 public WindowOverviewModeDelegate, |
26 public aura::WindowObserver, | 27 public aura::WindowObserver, |
27 public AcceleratorHandler { | 28 public AcceleratorHandler { |
28 public: | 29 public: |
(...skipping 28 matching lines...) Expand all Loading... |
57 | 58 |
58 // AcceleratorHandler: | 59 // AcceleratorHandler: |
59 virtual bool IsCommandEnabled(int command_id) const OVERRIDE; | 60 virtual bool IsCommandEnabled(int command_id) const OVERRIDE; |
60 virtual bool OnAcceleratorFired(int command_id, | 61 virtual bool OnAcceleratorFired(int command_id, |
61 const ui::Accelerator& accelerator) OVERRIDE; | 62 const ui::Accelerator& accelerator) OVERRIDE; |
62 | 63 |
63 scoped_ptr<aura::Window> container_; | 64 scoped_ptr<aura::Window> container_; |
64 scoped_ptr<WindowOverviewMode> overview_; | 65 scoped_ptr<WindowOverviewMode> overview_; |
65 scoped_ptr<BezelController> bezel_controller_; | 66 scoped_ptr<BezelController> bezel_controller_; |
66 scoped_ptr<SplitViewController> split_view_controller_; | 67 scoped_ptr<SplitViewController> split_view_controller_; |
| 68 scoped_ptr<wm::WMState> wm_state_; |
67 ObserverList<WindowManagerObserver> observers_; | 69 ObserverList<WindowManagerObserver> observers_; |
68 | 70 |
69 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | 71 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
70 }; | 72 }; |
71 | 73 |
72 class AthenaContainerLayoutManager : public aura::LayoutManager { | 74 class AthenaContainerLayoutManager : public aura::LayoutManager { |
73 public: | 75 public: |
74 AthenaContainerLayoutManager(); | 76 AthenaContainerLayoutManager(); |
75 virtual ~AthenaContainerLayoutManager(); | 77 virtual ~AthenaContainerLayoutManager(); |
76 | 78 |
(...skipping 16 matching lines...) Expand all Loading... |
93 WindowManagerImpl::WindowManagerImpl() { | 95 WindowManagerImpl::WindowManagerImpl() { |
94 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); | 96 ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); |
95 params.can_activate_children = true; | 97 params.can_activate_children = true; |
96 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); | 98 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); |
97 container_->SetLayoutManager(new AthenaContainerLayoutManager); | 99 container_->SetLayoutManager(new AthenaContainerLayoutManager); |
98 container_->AddObserver(this); | 100 container_->AddObserver(this); |
99 bezel_controller_.reset(new BezelController(container_.get())); | 101 bezel_controller_.reset(new BezelController(container_.get())); |
100 split_view_controller_.reset(new SplitViewController()); | 102 split_view_controller_.reset(new SplitViewController()); |
101 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); | 103 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
102 container_->AddPreTargetHandler(bezel_controller_.get()); | 104 container_->AddPreTargetHandler(bezel_controller_.get()); |
| 105 wm_state_.reset(new wm::WMState()); |
103 instance = this; | 106 instance = this; |
104 InstallAccelerators(); | 107 InstallAccelerators(); |
105 } | 108 } |
106 | 109 |
107 WindowManagerImpl::~WindowManagerImpl() { | 110 WindowManagerImpl::~WindowManagerImpl() { |
108 overview_.reset(); | 111 overview_.reset(); |
109 if (container_) { | 112 if (container_) { |
110 container_->RemoveObserver(this); | 113 container_->RemoveObserver(this); |
111 container_->RemovePreTargetHandler(bezel_controller_.get()); | 114 container_->RemovePreTargetHandler(bezel_controller_.get()); |
112 } | 115 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 DCHECK(!instance); | 251 DCHECK(!instance); |
249 } | 252 } |
250 | 253 |
251 // static | 254 // static |
252 WindowManager* WindowManager::GetInstance() { | 255 WindowManager* WindowManager::GetInstance() { |
253 DCHECK(instance); | 256 DCHECK(instance); |
254 return instance; | 257 return instance; |
255 } | 258 } |
256 | 259 |
257 } // namespace athena | 260 } // namespace athena |
OLD | NEW |