OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_ |
| 6 #define UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "ui/aura/window_observer.h" |
| 10 |
| 11 namespace aura { |
| 12 class Window; |
| 13 } |
| 14 |
| 15 namespace views { |
| 16 class View; |
| 17 |
| 18 // Class which ensures the following z-order of the widget's child layers from |
| 19 // topmost to bottommost: |
| 20 // 1) Layers for child windows with a NULL layer delegate. |
| 21 // 2) Layers for views and layers for child windows attached to a view ordered |
| 22 // according to the order of the views in the view hierarchy. |
| 23 // 3) Layers for child windows not attached to a view and layers not owned by |
| 24 // a window or a view. |
| 25 // The order of child windows is kept in sync with the order of the layers. |
| 26 class NativeWidgetLayerReordererAura : public aura::WindowObserver { |
| 27 public: |
| 28 NativeWidgetLayerReordererAura(aura::Window* window, View* root_view); |
| 29 virtual ~NativeWidgetLayerReordererAura(); |
| 30 |
| 31 // Explicitly reorder |window_|'s child layers. This method should be called |
| 32 // when the view hierarchy changes. |
| 33 void ReorderLayers(); |
| 34 |
| 35 private: |
| 36 // Stop observing |window| and its children. |
| 37 void StopObserving(aura::Window* window); |
| 38 |
| 39 // aura::WindowObserver overrides: |
| 40 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; |
| 41 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; |
| 42 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 43 const void* key, |
| 44 intptr_t old) OVERRIDE; |
| 45 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 46 |
| 47 // The window and the root view of the native widget which owns the |
| 48 // NativeWidgetLayerReordererAura. |
| 49 aura::Window* window_; |
| 50 View* root_view_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(NativeWidgetLayerReordererAura); |
| 53 }; |
| 54 |
| 55 } // namespace views |
| 56 |
| 57 #endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_ |
OLD | NEW |