Chromium Code Reviews| Index: athena/wm/window_manager_impl.cc |
| diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
| index e7cd444c3a7a19838dff65f78a30c8deca4e3b09..f6488e395c14a5790d898a6e001444a2116d5300 100644 |
| --- a/athena/wm/window_manager_impl.cc |
| +++ b/athena/wm/window_manager_impl.cc |
| @@ -10,6 +10,7 @@ |
| #include "athena/input/public/accelerator_manager.h" |
| #include "athena/screen/public/screen_manager.h" |
| #include "athena/wm/bezel_controller.h" |
| +#include "athena/wm/mru_window_tracker.h" |
| #include "athena/wm/public/window_manager_observer.h" |
| #include "athena/wm/split_view_controller.h" |
| #include "athena/wm/title_drag_controller.h" |
| @@ -39,6 +40,8 @@ class WindowManagerImpl : public WindowManager, |
| // WindowManager: |
| virtual void ToggleOverview() OVERRIDE; |
| + virtual bool IsOverviewModeActive() OVERRIDE; |
| + |
| private: |
| enum Command { |
| COMMAND_TOGGLE_OVERVIEW, |
| @@ -71,13 +74,16 @@ class WindowManagerImpl : public WindowManager, |
| virtual void OnTitleDragCompleted(aura::Window* window) OVERRIDE; |
| virtual void OnTitleDragCanceled(aura::Window* window) OVERRIDE; |
| + // Should be declared first so that it is destoyed last. |
| + ObserverList<WindowManagerObserver> observers_; |
| + |
| scoped_ptr<aura::Window> container_; |
| + scoped_ptr<MruWindowTracker> mru_window_tracker_; |
| scoped_ptr<WindowOverviewMode> overview_; |
| scoped_ptr<BezelController> bezel_controller_; |
| scoped_ptr<SplitViewController> split_view_controller_; |
| scoped_ptr<wm::WMState> wm_state_; |
| scoped_ptr<TitleDragController> title_drag_controller_; |
| - ObserverList<WindowManagerObserver> observers_; |
|
sadrul
2014/08/13 05:17:29
The CL is still breaking the asan builders. This c
mfomitchev
2014/08/13 13:27:31
Ok, I've done that. It seems a bit unfortunate tha
|
| DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); |
| }; |
| @@ -109,8 +115,10 @@ WindowManagerImpl::WindowManagerImpl() { |
| container_.reset(ScreenManager::Get()->CreateDefaultContainer(params)); |
| container_->SetLayoutManager(new AthenaContainerLayoutManager); |
| container_->AddObserver(this); |
| + mru_window_tracker_.reset(new MruWindowTracker(container_.get())); |
| bezel_controller_.reset(new BezelController(container_.get())); |
| - split_view_controller_.reset(new SplitViewController()); |
| + split_view_controller_.reset(new SplitViewController( |
| + container_.get(), mru_window_tracker_.get(), this)); |
| bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
| container_->AddPreTargetHandler(bezel_controller_.get()); |
| title_drag_controller_.reset(new TitleDragController(container_.get(), this)); |
| @@ -148,15 +156,26 @@ void WindowManagerImpl::ToggleOverview() { |
| SetInOverview(overview_.get() == NULL); |
| } |
| +bool WindowManagerImpl::IsOverviewModeActive() { |
| + return overview_; |
| +} |
| + |
| void WindowManagerImpl::SetInOverview(bool active) { |
| bool in_overview = !!overview_; |
| if (active == in_overview) |
| return; |
| if (active) { |
| - overview_ = WindowOverviewMode::Create(container_.get(), this); |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| OnOverviewModeEnter()); |
| + // Re-stack all windows in the order defined by mru_window_tracker_. |
| + aura::Window::Windows window_list = mru_window_tracker_->GetWindowList(); |
| + aura::Window::Windows::iterator it; |
| + for (it = window_list.begin(); it != window_list.end(); ++it) |
| + container_->StackChildAtTop(*it); |
| + overview_ = WindowOverviewMode::Create(container_.get(), |
| + mru_window_tracker_.get(), |
| + this); |
| } else { |
| overview_.reset(); |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| @@ -182,8 +201,7 @@ void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { |
| } |
| void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
| - CHECK_EQ(container_.get(), window->parent()); |
| - container_->StackChildAtTop(window); |
| + mru_window_tracker_->MoveToFront(window); |
| wm::ActivateWindow(window); |
| SetInOverview(false); |
| } |