| 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/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
| 8 #include "athena/wm/bezel_controller.h" |
| 9 #include "athena/wm/split_view_controller.h" |
| 8 #include "athena/wm/window_overview_mode.h" | 10 #include "athena/wm/window_overview_mode.h" |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "ui/aura/layout_manager.h" | 12 #include "ui/aura/layout_manager.h" |
| 11 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 12 #include "ui/wm/public/window_types.h" | 14 #include "ui/wm/public/window_types.h" |
| 13 | 15 |
| 14 namespace athena { | 16 namespace athena { |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 class WindowManagerImpl : public WindowManager, | 19 class WindowManagerImpl : public WindowManager, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 41 | 43 |
| 42 // aura::WindowObserver | 44 // aura::WindowObserver |
| 43 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { | 45 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE { |
| 44 if (window == container_) | 46 if (window == container_) |
| 45 container_.reset(); | 47 container_.reset(); |
| 46 } | 48 } |
| 47 | 49 |
| 48 scoped_ptr<aura::Window> container_; | 50 scoped_ptr<aura::Window> container_; |
| 49 scoped_ptr<ui::EventHandler> temp_handler_; | 51 scoped_ptr<ui::EventHandler> temp_handler_; |
| 50 scoped_ptr<WindowOverviewMode> overview_; | 52 scoped_ptr<WindowOverviewMode> overview_; |
| 53 scoped_ptr<BezelController> bezel_controller_; |
| 54 scoped_ptr<SplitViewController> split_view_controller_; |
| 51 | 55 |
| 52 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); | 56 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
| 53 }; | 57 }; |
| 54 | 58 |
| 55 class WindowManagerImpl* instance = NULL; | 59 class WindowManagerImpl* instance = NULL; |
| 56 | 60 |
| 57 class AthenaContainerLayoutManager : public aura::LayoutManager { | 61 class AthenaContainerLayoutManager : public aura::LayoutManager { |
| 58 public: | 62 public: |
| 59 AthenaContainerLayoutManager() {} | 63 AthenaContainerLayoutManager() {} |
| 60 virtual ~AthenaContainerLayoutManager() {} | 64 virtual ~AthenaContainerLayoutManager() {} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 event->key_code() == ui::VKEY_F6) { | 98 event->key_code() == ui::VKEY_F6) { |
| 95 instance->ToggleOverview(); | 99 instance->ToggleOverview(); |
| 96 } | 100 } |
| 97 } | 101 } |
| 98 | 102 |
| 99 DISALLOW_COPY_AND_ASSIGN(TempEventHandler); | 103 DISALLOW_COPY_AND_ASSIGN(TempEventHandler); |
| 100 }; | 104 }; |
| 101 | 105 |
| 102 WindowManagerImpl::WindowManagerImpl() | 106 WindowManagerImpl::WindowManagerImpl() |
| 103 : container_(ScreenManager::Get()->CreateDefaultContainer("MainContainer")), | 107 : container_(ScreenManager::Get()->CreateDefaultContainer("MainContainer")), |
| 104 temp_handler_(new TempEventHandler()) { | 108 temp_handler_(new TempEventHandler()), |
| 109 bezel_controller_(new BezelController(container_.get())), |
| 110 split_view_controller_(new SplitViewController()) { |
| 105 container_->SetLayoutManager(new AthenaContainerLayoutManager); | 111 container_->SetLayoutManager(new AthenaContainerLayoutManager); |
| 106 container_->AddObserver(this); | 112 container_->AddObserver(this); |
| 107 container_->AddPreTargetHandler(temp_handler_.get()); | 113 container_->AddPreTargetHandler(temp_handler_.get()); |
| 114 container_->AddPreTargetHandler(bezel_controller_.get()); |
| 115 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
| 108 instance = this; | 116 instance = this; |
| 109 } | 117 } |
| 110 | 118 |
| 111 WindowManagerImpl::~WindowManagerImpl() { | 119 WindowManagerImpl::~WindowManagerImpl() { |
| 112 if (container_) { | 120 if (container_) { |
| 113 container_->RemovePreTargetHandler(temp_handler_.get()); | 121 container_->RemovePreTargetHandler(temp_handler_.get()); |
| 114 container_->RemoveObserver(this); | 122 container_->RemoveObserver(this); |
| 115 } | 123 } |
| 116 container_.reset(); | 124 container_.reset(); |
| 117 instance = NULL; | 125 instance = NULL; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 142 } | 150 } |
| 143 | 151 |
| 144 // static | 152 // static |
| 145 void WindowManager::Shutdown() { | 153 void WindowManager::Shutdown() { |
| 146 DCHECK(instance); | 154 DCHECK(instance); |
| 147 delete instance; | 155 delete instance; |
| 148 DCHECK(!instance); | 156 DCHECK(!instance); |
| 149 } | 157 } |
| 150 | 158 |
| 151 } // namespace athena | 159 } // namespace athena |
| OLD | NEW |