Chromium Code Reviews| Index: ui/views/controls/native/native_view_host_aura.h |
| diff --git a/ui/views/controls/native/native_view_host_aura.h b/ui/views/controls/native/native_view_host_aura.h |
| index eba4b99c9fdf2c0b5cb45c7c571e7b5dc0aca9cc..5f8b6da6ade76f9f9a1726b661879e63cfc0c49c 100644 |
| --- a/ui/views/controls/native/native_view_host_aura.h |
| +++ b/ui/views/controls/native/native_view_host_aura.h |
| @@ -7,7 +7,10 @@ |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
|
sky
2013/10/01 15:06:43
remove include.
rharrison
2013/10/02 19:02:50
Done.
|
| +#include "ui/aura/window.h" |
|
sky
2013/10/01 15:06:43
Can you forward declare window?
rharrison
2013/10/02 19:02:50
Changed code to have clipping_window_ owned by thi
|
| #include "ui/aura/window_observer.h" |
| +#include "ui/compositor/layer.h" |
|
sky
2013/10/01 15:06:43
Is this needed?
rharrison
2013/10/02 19:02:50
Done.
|
| #include "ui/views/controls/native/native_view_host_wrapper.h" |
| #include "ui/views/views_export.h" |
| @@ -23,7 +26,7 @@ class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper, |
| virtual ~NativeViewHostAura(); |
| // Overridden from NativeViewHostWrapper: |
| - virtual void NativeViewWillAttach() OVERRIDE; |
| + virtual void AttachNativeView() OVERRIDE; |
| virtual void NativeViewDetaching(bool destroyed) OVERRIDE; |
| virtual void AddedToWidget() OVERRIDE; |
| virtual void RemovedFromWidget() OVERRIDE; |
| @@ -36,15 +39,46 @@ class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper, |
| virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| private: |
| + friend class NativeViewHostAuraTest; |
| + |
| // Overridden from aura::WindowObserver: |
| virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| + // Calculates the origin of the native view for the fast resize path, so it |
| + // can be clipped correctly. This value is affected by the current gravity |
| + // being applied. The formula for this calulation is: |
| + // |
| + // x' = width_scaling_factor * (content_width - clip_width) |
| + // y' = height_scaling_factor * (content_heigth - clip_height) |
| + // |
| + // , where the scaling factors are either 0, 0.5, or 1.0 depending on the |
| + // current gravity. |
| + gfx::Point CalculateNativeViewOrigin(const gfx::Rect& input_rect, |
| + const gfx::Rect& native_rect) const; |
| + |
| + // Reparents the native view with the clipping window existing between it and |
| + // its old parent, so that the fast resize path works. |
| + void AddClippingWindow(); |
| + |
| + // If the native view has been reparented via AddClippingWindow, this call |
| + // undoes it. |
| + void RemoveClippingWindow(); |
| + |
| // Our associated NativeViewHost. |
| NativeViewHost* host_; |
| // Have we installed a clip region? |
| bool installed_clip_; |
| + // Window that exists between the native view and the parent that allows for |
| + // clipping to occur. |
| + aura::Window* clipping_window_; // non-owned |
| + |
| + // The bounds of the content layer before clipping occurs on the fast resize |
| + // path. This is restored when the clip is uninstalled. This is done since the |
| + // contents needs to be places relatively to the clip that is about to occur. |
| + gfx::Rect orig_bounds_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(NativeViewHostAura); |
| }; |