| Index: content/browser/web_contents/web_contents_view_aura.h
|
| diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
|
| index bccb677ec2e58646312e1e24e9a892c3ca2b2f44..349541c2648990d58511c90c0d69de65a147eaf1 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.h
|
| +++ b/content/browser/web_contents/web_contents_view_aura.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_
|
| #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_
|
|
|
| +#include <set>
|
| #include <vector>
|
|
|
| #include "base/memory/ref_counted.h"
|
| @@ -14,7 +15,9 @@
|
| #include "content/port/browser/render_view_host_delegate_view.h"
|
| #include "content/port/browser/web_contents_view_port.h"
|
| #include "ui/aura/client/drag_drop_delegate.h"
|
| +#include "ui/aura/root_window_observer.h"
|
| #include "ui/aura/window_delegate.h"
|
| +#include "ui/aura/window_observer.h"
|
| #include "ui/compositor/layer_animation_observer.h"
|
|
|
| namespace aura {
|
| @@ -33,13 +36,66 @@ class WebContentsViewDelegate;
|
| class WebContentsImpl;
|
| class WebDragDestDelegate;
|
|
|
| +class WebContentsViewAuraWindowObserverDelegate {
|
| + public:
|
| + WebContentsViewAuraWindowObserverDelegate() { }
|
| + virtual ~WebContentsViewAuraWindowObserverDelegate() { }
|
| +
|
| + virtual aura::Window* GetDelegateWindow() = 0;
|
| + virtual void AddDelegateWindowObserver(aura::WindowObserver* observer) = 0;
|
| + virtual void RemoveDelegateWindowObserver(aura::WindowObserver* observer) = 0;
|
| + virtual void RemoveRootWindowObserver(aura::RootWindowObserver* observer) = 0;
|
| + virtual void AddRootWindowObserver(aura::RootWindowObserver* observer) = 0;
|
| + virtual void UpdateEditingController() = 0;
|
| + virtual void SendScreenRects() = 0;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraWindowObserverDelegate);
|
| +};
|
| +
|
| +// Observer class that tracks the associated window, its ancestors, and the
|
| +// root window to make sure that screen rect are sent to the renderer when
|
| +// ever there is the possibility of the visible bounds changing.
|
| +class WebContentsViewAuraWindowObserver : public aura::WindowObserver,
|
| + public aura::RootWindowObserver {
|
| + public:
|
| + explicit WebContentsViewAuraWindowObserver(
|
| + WebContentsViewAuraWindowObserverDelegate* delegate);
|
| + virtual ~WebContentsViewAuraWindowObserver();
|
| +
|
| + // Overridden from aura::WindowObserver:
|
| + virtual void OnWindowParentChanged(aura::Window* window,
|
| + aura::Window* parent) OVERRIDE;
|
| + virtual void OnWindowBoundsChanged(aura::Window* window,
|
| + const gfx::Rect& old_bounds,
|
| + const gfx::Rect& new_bounds) OVERRIDE;
|
| + virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE;
|
| +
|
| + virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE;
|
| +
|
| + // Overridden RootWindowObserver:
|
| + virtual void OnRootWindowHostMoved(const aura::RootWindow* root,
|
| + const gfx::Point& new_origin) OVERRIDE;
|
| +
|
| + private:
|
| + std::set<aura::Window*> GenerateAncestors(aura::Window* window);
|
| + void AddToObserved(const std::set<aura::Window*>& windows);
|
| + void RemoveFromObserved(const std::set<aura::Window*>& windows);
|
| +
|
| + WebContentsViewAuraWindowObserverDelegate* delegate_;
|
| + std::set<aura::Window*> observed_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraWindowObserver);
|
| +};
|
| +
|
| class CONTENT_EXPORT WebContentsViewAura
|
| : public WebContentsViewPort,
|
| public RenderViewHostDelegateView,
|
| NON_EXPORTED_BASE(public OverscrollControllerDelegate),
|
| public ui::ImplicitAnimationObserver,
|
| public aura::WindowDelegate,
|
| - public aura::client::DragDropDelegate {
|
| + public aura::client::DragDropDelegate,
|
| + public WebContentsViewAuraWindowObserverDelegate {
|
| public:
|
| WebContentsViewAura(WebContentsImpl* web_contents,
|
| WebContentsViewDelegate* delegate);
|
| @@ -49,7 +105,6 @@ class CONTENT_EXPORT WebContentsViewAura
|
| void SetTouchEditableForTest(TouchEditableImplAura* touch_editable);
|
|
|
| private:
|
| - class WindowObserver;
|
| #if defined(OS_WIN)
|
| class ChildWindowObserver;
|
| #endif
|
| @@ -186,13 +241,26 @@ class CONTENT_EXPORT WebContentsViewAura
|
| virtual void OnDragExited() OVERRIDE;
|
| virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
|
|
|
| + // Overriden from WebContentsViewAuraWindowObserverDelegate
|
| + virtual aura::Window* GetDelegateWindow() OVERRIDE;
|
| + virtual void AddDelegateWindowObserver(aura::WindowObserver* observer)
|
| + OVERRIDE;
|
| + virtual void RemoveDelegateWindowObserver(aura::WindowObserver* observer)
|
| + OVERRIDE;
|
| + virtual void RemoveRootWindowObserver(aura::RootWindowObserver* observer)
|
| + OVERRIDE;
|
| + virtual void AddRootWindowObserver(aura::RootWindowObserver* observer)
|
| + OVERRIDE;
|
| + virtual void UpdateEditingController() OVERRIDE;
|
| + virtual void SendScreenRects() OVERRIDE;
|
| +
|
| scoped_ptr<aura::Window> window_;
|
|
|
| // The window that shows the screenshot of the history page during an
|
| // overscroll navigation gesture.
|
| scoped_ptr<aura::Window> overscroll_window_;
|
|
|
| - scoped_ptr<WindowObserver> window_observer_;
|
| + scoped_ptr<WebContentsViewAuraWindowObserver> window_observer_;
|
| #if defined(OS_WIN)
|
| scoped_ptr<ChildWindowObserver> child_window_observer_;
|
| #endif
|
|
|