| Index: ui/aura/window.h
|
| diff --git a/ui/aura/window.h b/ui/aura/window.h
|
| index 4b1b52314097617e60fe2e082018d4293effc6f5..5527f81218d023dd5bafc9efcf429beca59d9284 100644
|
| --- a/ui/aura/window.h
|
| +++ b/ui/aura/window.h
|
| @@ -16,6 +16,7 @@
|
| #include "base/strings/string16.h"
|
| #include "ui/aura/aura_export.h"
|
| #include "ui/aura/client/window_types.h"
|
| +#include "ui/aura/window_layer_type.h"
|
| #include "ui/aura/window_observer.h"
|
| #include "ui/compositor/layer_animator.h"
|
| #include "ui/compositor/layer_delegate.h"
|
| @@ -32,6 +33,7 @@
|
| namespace gfx {
|
| class Display;
|
| class Transform;
|
| +class Vector2d;
|
| }
|
|
|
| namespace ui {
|
| @@ -74,6 +76,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
| // Initializes the window. This creates the window's layer.
|
| void Init(ui::LayerType layer_type);
|
|
|
| + // TODO(sky): replace other Init() with this once m32 is more baked.
|
| + void InitWithWindowLayerType(WindowLayerType layer_type);
|
| +
|
| // Creates a new layer for the window. Erases the layer-owned bounds, so the
|
| // caller may wish to set new bounds and other state on the window/layer.
|
| // Returns the old layer, which can be used for animations. Caller owns the
|
| @@ -107,7 +112,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
| WindowDelegate* delegate() { return delegate_; }
|
| const WindowDelegate* delegate() const { return delegate_; }
|
|
|
| - const gfx::Rect& bounds() const;
|
| + const gfx::Rect& bounds() const { return bounds_; }
|
|
|
| Window* parent() { return parent_; }
|
| const Window* parent() const { return parent_; }
|
| @@ -411,6 +416,22 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
| // to.
|
| void RemoveChildImpl(Window* child, Window* new_parent);
|
|
|
| + // If this Window has a layer the layer's parent is set to NULL, otherwise
|
| + // UnparentLayers() is invoked on all the children. |offset| is the offset
|
| + // relative to the nearest ancestor with a layer.
|
| + void UnparentLayers(bool has_layerless_ancestor,
|
| + const gfx::Vector2d& offset);
|
| +
|
| + // If this Window has a layer it is added to |parent| and the origin set to
|
| + // |offset|. Otherwise this recurses through the children invoking
|
| + // ReparentLayers(). The net effect is both setting the parent of layers to
|
| + // |parent| as well as updating bounds of windows with a layerless ancestor.
|
| + void ReparentLayers(ui::Layer* parent, const gfx::Vector2d& offset);
|
| +
|
| + // Offsets the first encountered Windows with layers by |offset|. This
|
| + // recurses through all layerless Windows, stopping at windows with layers.
|
| + void OffsetLayerBounds(const gfx::Vector2d& offset);
|
| +
|
| // Called when this window's parent has changed.
|
| void OnParentChanged();
|
|
|
| @@ -473,11 +494,12 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
| // Notifies this window and its parent hierarchy.
|
| void NotifyWindowVisibilityChangedUp(aura::Window* target, bool visible);
|
|
|
| - // Invoked from the closure returned by PrepareForLayerBoundsChange() after
|
| - // the bounds of the layer has changed. |old_bounds| is the previous bounds of
|
| - // the layer, and |contained_mouse| is true if the mouse was previously within
|
| - // the window's bounds.
|
| - void OnLayerBoundsChanged(const gfx::Rect& old_bounds, bool contained_mouse);
|
| + // Invoked when the bounds of the window changes. This may be invoked directly
|
| + // by us, or from the closure returned by PrepareForLayerBoundsChange() after
|
| + // the bounds of the layer has changed. |old_bounds| is the previous bounds,
|
| + // and |contained_mouse| is true if the mouse was previously within the
|
| + // window's bounds.
|
| + void OnWindowBoundsChanged(const gfx::Rect& old_bounds, bool contained_mouse);
|
|
|
| // Overridden from ui::LayerDelegate:
|
| virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
|
| @@ -497,6 +519,20 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
|
| // Returns true if the mouse is currently within our bounds.
|
| bool ContainsMouse();
|
|
|
| + // Returns the first ancestor (starting at |this|) with a layer. |offset| is
|
| + // set to the offset from |this| to the first ancestor with a layer.
|
| + Window* GetAncestorWithLayer(gfx::Vector2d* offset) {
|
| + return const_cast<Window*>(
|
| + const_cast<const Window*>(this)->GetAncestorWithLayer(offset));
|
| + }
|
| + const Window* GetAncestorWithLayer(gfx::Vector2d* offset) const;
|
| +
|
| + // Bounds of this window relative to the parent. This is cached as the bounds
|
| + // of the Layer and Window are not necessarily the same. In particular bounds
|
| + // of the Layer are relative to the first ancestor with a Layer, where as this
|
| + // is relative to the parent Window.
|
| + gfx::Rect bounds_;
|
| +
|
| WindowEventDispatcher* dispatcher_;
|
|
|
| client::WindowType type_;
|
|
|