16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file.
46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
56e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#ifndef ATHENA_WM_WINDOW_LIST_PROVIDER_IMPL_H_
66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#define ATHENA_WM_WINDOW_LIST_PROVIDER_IMPL_H_
76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "athena/wm/public/window_list_provider.h"
91320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "ui/aura/window_observer.h"
106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)namespace athena {
126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass WindowListProviderObserver;
141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// This implementation of the WindowListProviderImpl uses the same order as in
166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// the container window's stacking order.
171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass ATHENA_EXPORT WindowListProviderImpl : public WindowListProvider,
181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                             public aura::WindowObserver {
196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) public:
206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  explicit WindowListProviderImpl(aura::Window* container);
216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  virtual ~WindowListProviderImpl();
226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) private:
241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void RecreateWindowList();
251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
266e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  // WindowListProvider:
271320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void AddObserver(WindowListProviderObserver* observer) OVERRIDE;
281320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void RemoveObserver(WindowListProviderObserver* observer) OVERRIDE;
291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual const aura::Window::Windows& GetWindowList() const OVERRIDE;
301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual bool IsWindowInList(aura::Window* window) const OVERRIDE;
311320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual bool IsValidWindow(aura::Window* window) const OVERRIDE;
321320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void StackWindowFrontOf(aura::Window* window,
331320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                  aura::Window*reference_window) OVERRIDE;
341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void StackWindowBehindTo(aura::Window* window,
351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                   aura::Window*reference_window) OVERRIDE;
361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // aura::WindowObserver:
381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void OnWillRemoveWindow(aura::Window* old_window) OVERRIDE;
401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE;
416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
426e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  aura::Window* container_;
431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  aura::Window::Windows window_list_;
441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  ObserverList<WindowListProviderObserver> observers_;
456e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
466e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(WindowListProviderImpl);
476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)};
486e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
496e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}  // namespace athena
506e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)
516e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#endif  // ATHENA_WM_WINDOW_LIST_PROVIDER_IMPL_H_
52