| 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/input/public/accelerator_manager.h" | 7 #include "athena/input/public/accelerator_manager.h" |
| 8 #include "athena/screen/public/screen_manager.h" | 8 #include "athena/screen/public/screen_manager.h" |
| 9 #include "athena/wm/bezel_controller.h" |
| 9 #include "athena/wm/public/window_manager_observer.h" | 10 #include "athena/wm/public/window_manager_observer.h" |
| 11 #include "athena/wm/split_view_controller.h" |
| 10 #include "athena/wm/window_overview_mode.h" | 12 #include "athena/wm/window_overview_mode.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 13 #include "ui/aura/layout_manager.h" | 15 #include "ui/aura/layout_manager.h" |
| 14 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 15 #include "ui/wm/public/window_types.h" | 17 #include "ui/wm/public/window_types.h" |
| 16 | 18 |
| 17 namespace athena { | 19 namespace athena { |
| 18 namespace { | 20 namespace { |
| 19 | 21 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 switch (command_id) { | 87 switch (command_id) { |
| 86 case COMMAND_TOGGLE_OVERVIEW: | 88 case COMMAND_TOGGLE_OVERVIEW: |
| 87 ToggleOverview(); | 89 ToggleOverview(); |
| 88 break; | 90 break; |
| 89 } | 91 } |
| 90 return true; | 92 return true; |
| 91 } | 93 } |
| 92 | 94 |
| 93 scoped_ptr<aura::Window> container_; | 95 scoped_ptr<aura::Window> container_; |
| 94 scoped_ptr<WindowOverviewMode> overview_; | 96 scoped_ptr<WindowOverviewMode> overview_; |
| 97 scoped_ptr<BezelController> bezel_controller_; |
| 98 scoped_ptr<SplitViewController> split_view_controller_; |
| 95 ObserverList<WindowManagerObserver> observers_; | 99 ObserverList<WindowManagerObserver> observers_; |
| 96 | 100 |
| 97 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | 101 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
| 98 }; | 102 }; |
| 99 | 103 |
| 100 class WindowManagerImpl* instance = NULL; | 104 class WindowManagerImpl* instance = NULL; |
| 101 | 105 |
| 102 class AthenaContainerLayoutManager : public aura::LayoutManager { | 106 class AthenaContainerLayoutManager : public aura::LayoutManager { |
| 103 public: | 107 public: |
| 104 AthenaContainerLayoutManager() {} | 108 AthenaContainerLayoutManager() {} |
| (...skipping 21 matching lines...) Expand all Loading... |
| 126 | 130 |
| 127 DISALLOW_COPY_AND_ASSIGN(AthenaContainerLayoutManager); | 131 DISALLOW_COPY_AND_ASSIGN(AthenaContainerLayoutManager); |
| 128 }; | 132 }; |
| 129 | 133 |
| 130 WindowManagerImpl::WindowManagerImpl() { | 134 WindowManagerImpl::WindowManagerImpl() { |
| 131 ScreenManager::ContainerParams params("DefaultContainer"); | 135 ScreenManager::ContainerParams params("DefaultContainer"); |
| 132 params.can_activate_children = true; | 136 params.can_activate_children = true; |
| 133 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); | 137 container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); |
| 134 container_->SetLayoutManager(new AthenaContainerLayoutManager); | 138 container_->SetLayoutManager(new AthenaContainerLayoutManager); |
| 135 container_->AddObserver(this); | 139 container_->AddObserver(this); |
| 140 bezel_controller_.reset(new BezelController(container_.get())); |
| 141 split_view_controller_.reset(new SplitViewController()); |
| 142 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
| 143 container_->AddPreTargetHandler(bezel_controller_.get()); |
| 136 instance = this; | 144 instance = this; |
| 137 InstallAccelerators(); | 145 InstallAccelerators(); |
| 138 } | 146 } |
| 139 | 147 |
| 140 WindowManagerImpl::~WindowManagerImpl() { | 148 WindowManagerImpl::~WindowManagerImpl() { |
| 141 if (container_) | 149 if (container_) { |
| 142 container_->RemoveObserver(this); | 150 container_->RemoveObserver(this); |
| 151 container_->RemovePreTargetHandler(bezel_controller_.get()); |
| 152 } |
| 143 container_.reset(); | 153 container_.reset(); |
| 144 instance = NULL; | 154 instance = NULL; |
| 145 } | 155 } |
| 146 | 156 |
| 147 void WindowManagerImpl::Layout() { | 157 void WindowManagerImpl::Layout() { |
| 148 if (!container_) | 158 if (!container_) |
| 149 return; | 159 return; |
| 150 gfx::Rect bounds = gfx::Rect(container_->bounds().size()); | 160 gfx::Rect bounds = gfx::Rect(container_->bounds().size()); |
| 151 const aura::Window::Windows& children = container_->children(); | 161 const aura::Window::Windows& children = container_->children(); |
| 152 for (aura::Window::Windows::const_iterator iter = children.begin(); | 162 for (aura::Window::Windows::const_iterator iter = children.begin(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 175 DCHECK(!instance); | 185 DCHECK(!instance); |
| 176 } | 186 } |
| 177 | 187 |
| 178 // static | 188 // static |
| 179 WindowManager* WindowManager::GetInstance() { | 189 WindowManager* WindowManager::GetInstance() { |
| 180 DCHECK(instance); | 190 DCHECK(instance); |
| 181 return instance; | 191 return instance; |
| 182 } | 192 } |
| 183 | 193 |
| 184 } // namespace athena | 194 } // namespace athena |
| OLD | NEW |