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 a5bbf53b990b895244aa2bc9d6a69c7e023d8381..08eac8bbd7778cfc5a722da7b22892b7f62faee4 100644 |
| --- a/athena/wm/window_manager_impl.cc |
| +++ b/athena/wm/window_manager_impl.cc |
| @@ -10,6 +10,7 @@ |
| #include "athena/wm/public/window_manager_observer.h" |
| #include "athena/wm/split_view_controller.h" |
| #include "athena/wm/window_overview_mode.h" |
| +#include "athena/wm/window_stack_provider.h" |
| #include "base/logging.h" |
| #include "base/observer_list.h" |
| #include "ui/aura/layout_manager.h" |
| @@ -20,6 +21,7 @@ namespace athena { |
| namespace { |
| class WindowManagerImpl : public WindowManager, |
| + public WindowStackProvider, |
| public WindowOverviewModeDelegate, |
| public aura::WindowObserver, |
| public AcceleratorHandler { |
| @@ -31,17 +33,28 @@ class WindowManagerImpl : public WindowManager, |
| // WindowManager: |
| virtual void ToggleOverview() OVERRIDE { |
| + LOG(ERROR) << "ToggleOverview"; |
| if (overview_) { |
|
Jun Mukai
2014/07/25 20:21:30
Keep in mind that pkotwicz is changing the code ar
|
| - overview_.reset(); |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| OnOverviewModeExit()); |
| + overview_.reset(); |
| } else { |
| - overview_ = WindowOverviewMode::Create(container_.get(), this); |
| + // Re-stack all windows in the order defined by ordered_windows_. |
| + aura::Window::Windows::iterator it; |
| + for (it = ordered_windows_.begin(); it != ordered_windows_.end(); ++it) { |
| + container_->StackChildAtTop(*it); |
| + } |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| OnOverviewModeEnter()); |
| + overview_ = |
| + WindowOverviewMode::Create(container_.get(), GetWindowStack(), this); |
| } |
| } |
| + virtual bool IsOverviewModeActive() OVERRIDE { |
| + return overview_; |
| + } |
| + |
| private: |
| enum Command { |
| COMMAND_TOGGLE_OVERVIEW, |
| @@ -65,10 +78,24 @@ class WindowManagerImpl : public WindowManager, |
| observers_.RemoveObserver(observer); |
| } |
| - // WindowOverviewModeDelegate: |
| - virtual void OnSelectWindow(aura::Window* window) OVERRIDE { |
| + // WindowStackProvider: |
| + virtual void MoveWindowToFront(aura::Window* window) OVERRIDE{ |
| CHECK_EQ(container_.get(), window->parent()); |
| + aura::Window::Windows::iterator it = std::find( |
| + ordered_windows_.begin(), ordered_windows_.end(), window); |
| + DCHECK(it != ordered_windows_.end()); |
| + ordered_windows_.erase(it); |
| + ordered_windows_.push_back(window); |
| container_->StackChildAtTop(window); |
|
oshima
2014/07/28 17:58:43
This should have called wm::ActivateWindow instead
mfomitchev
2014/08/05 19:56:57
Done.
|
| + } |
| + |
| + virtual const aura::Window::Windows& GetWindowStack() OVERRIDE { |
| + return ordered_windows_; |
| + } |
| + |
| + // WindowOverviewModeDelegate: |
| + virtual void OnSelectWindow(aura::Window* window) OVERRIDE { |
| + MoveWindowToFront(window); |
| overview_.reset(); |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, |
| OnOverviewModeExit()); |
| @@ -80,6 +107,16 @@ class WindowManagerImpl : public WindowManager, |
| container_.reset(); |
| } |
| + virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { |
| + aura::Window::Windows::iterator it = std::find( |
| + ordered_windows_.begin(), ordered_windows_.end(), window); |
| + ordered_windows_.erase(it); |
| + } |
| + |
| + virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { |
| + ordered_windows_.push_back(new_window); |
| + } |
| + |
| // AcceleratorHandler: |
| virtual bool IsCommandEnabled(int command_id) const OVERRIDE { return true; } |
| virtual bool OnAcceleratorFired(int command_id, |
| @@ -93,6 +130,7 @@ class WindowManagerImpl : public WindowManager, |
| } |
| scoped_ptr<aura::Window> container_; |
| + aura::Window::Windows ordered_windows_; |
|
oshima
2014/07/25 21:41:10
what's the reason to keep its own list?
mfomitchev
2014/07/25 23:27:38
The order within the container changes when you in
oshima
2014/07/28 17:58:42
StackChildAtTop does change the order within the c
mfomitchev
2014/07/28 18:15:00
I can't rely on the container's window order for t
oshima
2014/07/28 18:35:20
I know that container's window order isn't enough
mfomitchev
2014/07/28 18:57:42
SplitViewController implements window switching -
mfomitchev
2014/08/05 19:56:57
I have implemented a very basic, stripped down Mru
|
| scoped_ptr<WindowOverviewMode> overview_; |
| scoped_ptr<BezelController> bezel_controller_; |
| scoped_ptr<SplitViewController> split_view_controller_; |
| @@ -138,7 +176,8 @@ WindowManagerImpl::WindowManagerImpl() { |
| container_->SetLayoutManager(new AthenaContainerLayoutManager); |
| container_->AddObserver(this); |
| bezel_controller_.reset(new BezelController(container_.get())); |
| - split_view_controller_.reset(new SplitViewController()); |
| + split_view_controller_.reset(new SplitViewController( |
| + container_.get(), this, this)); |
| bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
| container_->AddPreTargetHandler(bezel_controller_.get()); |
| instance = this; |