Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Unified Diff: ui/views/widget/native_widget_layer_reorderer_aura.h

Issue 15114002: Reorder the NativeViews attached to a view via kViewHostKey according to the position of the view (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/native_widget_layer_reorderer_aura.h
diff --git a/ui/views/widget/native_widget_layer_reorderer_aura.h b/ui/views/widget/native_widget_layer_reorderer_aura.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a53a8e611e81de410b5863aba99d52e861eeb19
--- /dev/null
+++ b/ui/views/widget/native_widget_layer_reorderer_aura.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_
+#define UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_
+
+#include "base/compiler_specific.h"
+#include "ui/aura/window_observer.h"
+
+namespace aura {
+class Window;
+}
+
+namespace views {
+class View;
+
+// Class which ensures the following z-order of the widget's child layers from
+// topmost to bottommost:
+// 1) Layers for child windows with a NULL layer delegate.
+// 2) Layers for views and layers for child windows attached to a view ordered
+// according to the order of the views in the view hierarchy.
+// 3) Layers for child windows not attached to a view and layers not owned by
+// a window or a view.
+// The order of child windows is kept in sync with the order of the layers.
+class NativeWidgetLayerReordererAura : public aura::WindowObserver {
+ public:
+ NativeWidgetLayerReordererAura(aura::Window* window, View* root_view);
+ virtual ~NativeWidgetLayerReordererAura();
+
+ // Explicitly reorder |window_|'s child layers. This method should be called
+ // when the view hierarchy changes.
+ void ReorderLayers();
+
+ private:
+ // Stop observing |window| and its children.
+ void StopObserving(aura::Window* window);
+
+ // aura::WindowObserver overrides:
+ virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE;
+ virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE;
+ virtual void OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) OVERRIDE;
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
+
+ // The window and the root view of the native widget which owns the
+ // NativeWidgetLayerReordererAura.
+ aura::Window* window_;
+ View* root_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeWidgetLayerReordererAura);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_LAYER_REORDERER_AURA_H_

Powered by Google App Engine
This is Rietveld 408576698