| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ | 5 #ifndef UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ |
| 6 #define UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ | 6 #define UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/aura/window.h" | |
| 11 #include "ui/aura/window_observer.h" | 10 #include "ui/aura/window_observer.h" |
| 12 #include "ui/views/controls/native/native_view_host_wrapper.h" | 11 #include "ui/views/controls/native/native_view_host_wrapper.h" |
| 13 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 14 | 13 |
| 15 namespace views { | 14 namespace views { |
| 16 | 15 |
| 17 class NativeViewHost; | 16 class NativeViewHost; |
| 18 | 17 |
| 19 // Aura implementation of NativeViewHostWrapper. | 18 // Aura implementation of NativeViewHostWrapper. |
| 20 class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper, | 19 class VIEWS_EXPORT NativeViewHostAura : public NativeViewHostWrapper, |
| 21 public aura::WindowObserver { | 20 public aura::WindowObserver { |
| 22 public: | 21 public: |
| 23 explicit NativeViewHostAura(NativeViewHost* host); | 22 explicit NativeViewHostAura(NativeViewHost* host); |
| 24 virtual ~NativeViewHostAura(); | 23 virtual ~NativeViewHostAura(); |
| 25 | 24 |
| 26 // Overridden from NativeViewHostWrapper: | 25 // Overridden from NativeViewHostWrapper: |
| 27 virtual void AttachNativeView() OVERRIDE; | 26 virtual void NativeViewWillAttach() OVERRIDE; |
| 28 virtual void NativeViewDetaching(bool destroyed) OVERRIDE; | 27 virtual void NativeViewDetaching(bool destroyed) OVERRIDE; |
| 29 virtual void AddedToWidget() OVERRIDE; | 28 virtual void AddedToWidget() OVERRIDE; |
| 30 virtual void RemovedFromWidget() OVERRIDE; | 29 virtual void RemovedFromWidget() OVERRIDE; |
| 31 virtual void InstallClip(int x, int y, int w, int h) OVERRIDE; | 30 virtual void InstallClip(int x, int y, int w, int h) OVERRIDE; |
| 32 virtual bool HasInstalledClip() OVERRIDE; | 31 virtual bool HasInstalledClip() OVERRIDE; |
| 33 virtual void UninstallClip() OVERRIDE; | 32 virtual void UninstallClip() OVERRIDE; |
| 34 virtual void ShowWidget(int x, int y, int w, int h) OVERRIDE; | 33 virtual void ShowWidget(int x, int y, int w, int h) OVERRIDE; |
| 35 virtual void HideWidget() OVERRIDE; | 34 virtual void HideWidget() OVERRIDE; |
| 36 virtual void SetFocus() OVERRIDE; | 35 virtual void SetFocus() OVERRIDE; |
| 37 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 36 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 38 virtual gfx::NativeCursor GetCursor(int x, int y) OVERRIDE; | 37 virtual gfx::NativeCursor GetCursor(int x, int y) OVERRIDE; |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 friend class NativeViewHostAuraTest; | |
| 42 | |
| 43 // Overridden from aura::WindowObserver: | 40 // Overridden from aura::WindowObserver: |
| 44 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 41 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
| 45 | 42 |
| 46 // Reparents the native view with the clipping window existing between it and | |
| 47 // its old parent, so that the fast resize path works. | |
| 48 void AddClippingWindow(); | |
| 49 | |
| 50 // If the native view has been reparented via AddClippingWindow, this call | |
| 51 // undoes it. | |
| 52 void RemoveClippingWindow(); | |
| 53 | |
| 54 // Our associated NativeViewHost. | 43 // Our associated NativeViewHost. |
| 55 NativeViewHost* host_; | 44 NativeViewHost* host_; |
| 56 | 45 |
| 57 // Window that exists between the native view and the parent that allows for | 46 // Have we installed a clip region? |
| 58 // clipping to occur. This is positioned in the coordinate space of | 47 bool installed_clip_; |
| 59 // host_->GetWidget(). | |
| 60 aura::Window clipping_window_; | |
| 61 scoped_ptr<gfx::Rect> clip_rect_; | |
| 62 | 48 |
| 63 DISALLOW_COPY_AND_ASSIGN(NativeViewHostAura); | 49 DISALLOW_COPY_AND_ASSIGN(NativeViewHostAura); |
| 64 }; | 50 }; |
| 65 | 51 |
| 66 } // namespace views | 52 } // namespace views |
| 67 | 53 |
| 68 #endif // UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ | 54 #endif // UI_VIEWS_CONTROLS_NATIVE_NATIVE_VIEW_HOST_AURA_H_ |
| OLD | NEW |