| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| 7 | 7 |
| 8 #include <set> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 13 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "content/port/browser/render_view_host_delegate_view.h" | 15 #include "content/port/browser/render_view_host_delegate_view.h" |
| 15 #include "content/port/browser/web_contents_view_port.h" | 16 #include "content/port/browser/web_contents_view_port.h" |
| 16 #include "ui/aura/client/drag_drop_delegate.h" | 17 #include "ui/aura/client/drag_drop_delegate.h" |
| 18 #include "ui/aura/root_window_observer.h" |
| 17 #include "ui/aura/window_delegate.h" | 19 #include "ui/aura/window_delegate.h" |
| 20 #include "ui/aura/window_observer.h" |
| 18 #include "ui/compositor/layer_animation_observer.h" | 21 #include "ui/compositor/layer_animation_observer.h" |
| 19 | 22 |
| 20 namespace aura { | 23 namespace aura { |
| 21 class Window; | 24 class Window; |
| 22 } | 25 } |
| 23 | 26 |
| 24 namespace ui { | 27 namespace ui { |
| 25 class DropTargetEvent; | 28 class DropTargetEvent; |
| 26 } | 29 } |
| 27 | 30 |
| 28 namespace content { | 31 namespace content { |
| 29 class OverscrollNavigationOverlay; | 32 class OverscrollNavigationOverlay; |
| 30 class ShadowLayerDelegate; | 33 class ShadowLayerDelegate; |
| 31 class TouchEditableImplAura; | 34 class TouchEditableImplAura; |
| 32 class WebContentsViewDelegate; | 35 class WebContentsViewDelegate; |
| 33 class WebContentsImpl; | 36 class WebContentsImpl; |
| 34 class WebDragDestDelegate; | 37 class WebDragDestDelegate; |
| 35 | 38 |
| 39 class WebContentsViewAuraWindowObserverDelegate { |
| 40 public: |
| 41 WebContentsViewAuraWindowObserverDelegate() { } |
| 42 virtual ~WebContentsViewAuraWindowObserverDelegate() { } |
| 43 |
| 44 virtual aura::Window* GetDelegateWindow() = 0; |
| 45 virtual void AddDelegateWindowObserver(aura::WindowObserver* observer) = 0; |
| 46 virtual void RemoveDelegateWindowObserver(aura::WindowObserver* observer) = 0; |
| 47 virtual void RemoveRootWindowObserver(aura::RootWindowObserver* observer) = 0; |
| 48 virtual void AddRootWindowObserver(aura::RootWindowObserver* observer) = 0; |
| 49 virtual void UpdateEditingController() = 0; |
| 50 virtual void SendScreenRects() = 0; |
| 51 |
| 52 private: |
| 53 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraWindowObserverDelegate); |
| 54 }; |
| 55 |
| 56 // Observer class that tracks the associated window, its ancestors, and the |
| 57 // root window to make sure that screen rect are sent to the renderer when |
| 58 // ever there is the possibility of the visible bounds changing. |
| 59 class WebContentsViewAuraWindowObserver : public aura::WindowObserver, |
| 60 public aura::RootWindowObserver { |
| 61 public: |
| 62 explicit WebContentsViewAuraWindowObserver( |
| 63 WebContentsViewAuraWindowObserverDelegate* delegate); |
| 64 virtual ~WebContentsViewAuraWindowObserver(); |
| 65 |
| 66 // Overridden from aura::WindowObserver: |
| 67 virtual void OnWindowParentChanged(aura::Window* window, |
| 68 aura::Window* parent) OVERRIDE; |
| 69 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 70 const gfx::Rect& old_bounds, |
| 71 const gfx::Rect& new_bounds) OVERRIDE; |
| 72 virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE; |
| 73 |
| 74 virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE; |
| 75 |
| 76 // Overridden RootWindowObserver: |
| 77 virtual void OnRootWindowHostMoved(const aura::RootWindow* root, |
| 78 const gfx::Point& new_origin) OVERRIDE; |
| 79 |
| 80 private: |
| 81 std::set<aura::Window*> GenerateAncestors(aura::Window* window); |
| 82 void AddToObserved(const std::set<aura::Window*>& windows); |
| 83 void RemoveFromObserved(const std::set<aura::Window*>& windows); |
| 84 |
| 85 WebContentsViewAuraWindowObserverDelegate* delegate_; |
| 86 std::set<aura::Window*> observed_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraWindowObserver); |
| 89 }; |
| 90 |
| 36 class CONTENT_EXPORT WebContentsViewAura | 91 class CONTENT_EXPORT WebContentsViewAura |
| 37 : public WebContentsViewPort, | 92 : public WebContentsViewPort, |
| 38 public RenderViewHostDelegateView, | 93 public RenderViewHostDelegateView, |
| 39 NON_EXPORTED_BASE(public OverscrollControllerDelegate), | 94 NON_EXPORTED_BASE(public OverscrollControllerDelegate), |
| 40 public ui::ImplicitAnimationObserver, | 95 public ui::ImplicitAnimationObserver, |
| 41 public aura::WindowDelegate, | 96 public aura::WindowDelegate, |
| 42 public aura::client::DragDropDelegate { | 97 public aura::client::DragDropDelegate, |
| 98 public WebContentsViewAuraWindowObserverDelegate { |
| 43 public: | 99 public: |
| 44 WebContentsViewAura(WebContentsImpl* web_contents, | 100 WebContentsViewAura(WebContentsImpl* web_contents, |
| 45 WebContentsViewDelegate* delegate); | 101 WebContentsViewDelegate* delegate); |
| 46 | 102 |
| 47 void SetupOverlayWindowForTesting(); | 103 void SetupOverlayWindowForTesting(); |
| 48 | 104 |
| 49 void SetTouchEditableForTest(TouchEditableImplAura* touch_editable); | 105 void SetTouchEditableForTest(TouchEditableImplAura* touch_editable); |
| 50 | 106 |
| 51 private: | 107 private: |
| 52 class WindowObserver; | |
| 53 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
| 54 class ChildWindowObserver; | 109 class ChildWindowObserver; |
| 55 #endif | 110 #endif |
| 56 | 111 |
| 57 virtual ~WebContentsViewAura(); | 112 virtual ~WebContentsViewAura(); |
| 58 | 113 |
| 59 void SizeChangedCommon(const gfx::Size& size); | 114 void SizeChangedCommon(const gfx::Size& size); |
| 60 | 115 |
| 61 void EndDrag(WebKit::WebDragOperationsMask ops); | 116 void EndDrag(WebKit::WebDragOperationsMask ops); |
| 62 | 117 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Overridden from ui::EventHandler: | 234 // Overridden from ui::EventHandler: |
| 180 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 235 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 181 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 236 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 182 | 237 |
| 183 // Overridden from aura::client::DragDropDelegate: | 238 // Overridden from aura::client::DragDropDelegate: |
| 184 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 239 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 185 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 240 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 186 virtual void OnDragExited() OVERRIDE; | 241 virtual void OnDragExited() OVERRIDE; |
| 187 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 242 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 188 | 243 |
| 244 // Overriden from WebContentsViewAuraWindowObserverDelegate |
| 245 virtual aura::Window* GetDelegateWindow() OVERRIDE; |
| 246 virtual void AddDelegateWindowObserver(aura::WindowObserver* observer) |
| 247 OVERRIDE; |
| 248 virtual void RemoveDelegateWindowObserver(aura::WindowObserver* observer) |
| 249 OVERRIDE; |
| 250 virtual void RemoveRootWindowObserver(aura::RootWindowObserver* observer) |
| 251 OVERRIDE; |
| 252 virtual void AddRootWindowObserver(aura::RootWindowObserver* observer) |
| 253 OVERRIDE; |
| 254 virtual void UpdateEditingController() OVERRIDE; |
| 255 virtual void SendScreenRects() OVERRIDE; |
| 256 |
| 189 scoped_ptr<aura::Window> window_; | 257 scoped_ptr<aura::Window> window_; |
| 190 | 258 |
| 191 // The window that shows the screenshot of the history page during an | 259 // The window that shows the screenshot of the history page during an |
| 192 // overscroll navigation gesture. | 260 // overscroll navigation gesture. |
| 193 scoped_ptr<aura::Window> overscroll_window_; | 261 scoped_ptr<aura::Window> overscroll_window_; |
| 194 | 262 |
| 195 scoped_ptr<WindowObserver> window_observer_; | 263 scoped_ptr<WebContentsViewAuraWindowObserver> window_observer_; |
| 196 #if defined(OS_WIN) | 264 #if defined(OS_WIN) |
| 197 scoped_ptr<ChildWindowObserver> child_window_observer_; | 265 scoped_ptr<ChildWindowObserver> child_window_observer_; |
| 198 #endif | 266 #endif |
| 199 | 267 |
| 200 // The WebContentsImpl whose contents we display. | 268 // The WebContentsImpl whose contents we display. |
| 201 WebContentsImpl* web_contents_; | 269 WebContentsImpl* web_contents_; |
| 202 | 270 |
| 203 scoped_ptr<WebContentsViewDelegate> delegate_; | 271 scoped_ptr<WebContentsViewDelegate> delegate_; |
| 204 | 272 |
| 205 WebKit::WebDragOperationsMask current_drag_op_; | 273 WebKit::WebDragOperationsMask current_drag_op_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 230 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; | 298 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; |
| 231 | 299 |
| 232 scoped_ptr<TouchEditableImplAura> touch_editable_; | 300 scoped_ptr<TouchEditableImplAura> touch_editable_; |
| 233 | 301 |
| 234 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 302 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
| 235 }; | 303 }; |
| 236 | 304 |
| 237 } // namespace content | 305 } // namespace content |
| 238 | 306 |
| 239 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 307 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
| OLD | NEW |