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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 12 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 13 #include "content/browser/web_contents/aura/constrained_windows_observer.h" |
| 14 #include "content/browser/web_contents/aura/native_view_screen_bounds_observer.h
" |
13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
14 #include "content/port/browser/render_view_host_delegate_view.h" | 16 #include "content/port/browser/render_view_host_delegate_view.h" |
15 #include "content/port/browser/web_contents_view_port.h" | 17 #include "content/port/browser/web_contents_view_port.h" |
16 #include "ui/aura/client/drag_drop_delegate.h" | 18 #include "ui/aura/client/drag_drop_delegate.h" |
17 #include "ui/aura/window_delegate.h" | 19 #include "ui/aura/window_delegate.h" |
18 #include "ui/compositor/layer_animation_observer.h" | 20 #include "ui/compositor/layer_animation_observer.h" |
19 | 21 |
20 namespace aura { | 22 namespace aura { |
21 class Window; | 23 class Window; |
22 } | 24 } |
23 | 25 |
24 namespace ui { | 26 namespace ui { |
25 class DropTargetEvent; | 27 class DropTargetEvent; |
26 } | 28 } |
27 | 29 |
28 namespace content { | 30 namespace content { |
29 class OverscrollNavigationOverlay; | 31 class OverscrollNavigationOverlay; |
30 class ShadowLayerDelegate; | 32 class ShadowLayerDelegate; |
31 class TouchEditableImplAura; | 33 class TouchEditableImplAura; |
32 class WebContentsViewDelegate; | 34 class WebContentsViewDelegate; |
33 class WebContentsImpl; | 35 class WebContentsImpl; |
34 class WebDragDestDelegate; | 36 class WebDragDestDelegate; |
35 | 37 |
36 class CONTENT_EXPORT WebContentsViewAura | 38 class CONTENT_EXPORT WebContentsViewAura |
37 : public WebContentsViewPort, | 39 : public WebContentsViewPort, |
38 public RenderViewHostDelegateView, | 40 public RenderViewHostDelegateView, |
39 NON_EXPORTED_BASE(public OverscrollControllerDelegate), | 41 NON_EXPORTED_BASE(public OverscrollControllerDelegate), |
40 public ui::ImplicitAnimationObserver, | 42 public ui::ImplicitAnimationObserver, |
41 public aura::WindowDelegate, | 43 public aura::WindowDelegate, |
42 public aura::client::DragDropDelegate { | 44 public aura::client::DragDropDelegate, |
| 45 public NativeViewScreenBoundsObserverDelegate { |
43 public: | 46 public: |
44 WebContentsViewAura(WebContentsImpl* web_contents, | 47 WebContentsViewAura(WebContentsImpl* web_contents, |
45 WebContentsViewDelegate* delegate); | 48 WebContentsViewDelegate* delegate); |
46 | 49 |
47 void SetupOverlayWindowForTesting(); | 50 void SetupOverlayWindowForTesting(); |
48 | 51 |
49 void SetTouchEditableForTest(TouchEditableImplAura* touch_editable); | 52 void SetTouchEditableForTest(TouchEditableImplAura* touch_editable); |
50 | 53 |
51 private: | 54 private: |
52 class WindowObserver; | 55 #if defined(OS_WIN) |
53 | 56 friend ConstrainedWindowsObserver; |
| 57 #endif |
54 virtual ~WebContentsViewAura(); | 58 virtual ~WebContentsViewAura(); |
55 | 59 |
56 void SizeChangedCommon(const gfx::Size& size); | 60 void SizeChangedCommon(const gfx::Size& size); |
57 | 61 |
58 void EndDrag(blink::WebDragOperationsMask ops); | 62 void EndDrag(blink::WebDragOperationsMask ops); |
59 | 63 |
60 // Creates and sets up the overlay window that will be displayed during the | 64 // Creates and sets up the overlay window that will be displayed during the |
61 // overscroll gesture. | 65 // overscroll gesture. |
62 void PrepareOverscrollWindow(); | 66 void PrepareOverscrollWindow(); |
63 | 67 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Overridden from ui::EventHandler: | 180 // Overridden from ui::EventHandler: |
177 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 181 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
178 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 182 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
179 | 183 |
180 // Overridden from aura::client::DragDropDelegate: | 184 // Overridden from aura::client::DragDropDelegate: |
181 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 185 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
182 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 186 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
183 virtual void OnDragExited() OVERRIDE; | 187 virtual void OnDragExited() OVERRIDE; |
184 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 188 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
185 | 189 |
| 190 // Overriden from NativeViewScreenBoundsObserverDelegate |
| 191 virtual void OnScreenPositionChanged() OVERRIDE; |
| 192 virtual void OnScreenBoundsChanged() OVERRIDE; |
| 193 |
186 scoped_ptr<aura::Window> window_; | 194 scoped_ptr<aura::Window> window_; |
187 | 195 |
188 // The window that shows the screenshot of the history page during an | 196 // The window that shows the screenshot of the history page during an |
189 // overscroll navigation gesture. | 197 // overscroll navigation gesture. |
190 scoped_ptr<aura::Window> overscroll_window_; | 198 scoped_ptr<aura::Window> overscroll_window_; |
191 | 199 |
192 scoped_ptr<WindowObserver> window_observer_; | 200 // Observes the window associated with the view and its ancestors to track if |
| 201 // the visible bounds of the window have changed. If so it sends an update of |
| 202 // the associated screen rect to the renderer. |
| 203 scoped_ptr<NativeViewScreenBoundsObserver> bounds_observer_; |
| 204 |
| 205 #if defined(OS_WIN) |
| 206 // Tracks the set of constrained windows for NPAPI plugins and sends bounds |
| 207 // updates when appropriate. |
| 208 scoped_ptr<ConstrainedWindowsObserver> constrained_observer_; |
| 209 #endif |
193 | 210 |
194 // The WebContentsImpl whose contents we display. | 211 // The WebContentsImpl whose contents we display. |
195 WebContentsImpl* web_contents_; | 212 WebContentsImpl* web_contents_; |
196 | 213 |
197 scoped_ptr<WebContentsViewDelegate> delegate_; | 214 scoped_ptr<WebContentsViewDelegate> delegate_; |
198 | 215 |
199 blink::WebDragOperationsMask current_drag_op_; | 216 blink::WebDragOperationsMask current_drag_op_; |
200 | 217 |
201 scoped_ptr<DropData> current_drop_data_; | 218 scoped_ptr<DropData> current_drop_data_; |
202 | 219 |
(...skipping 21 matching lines...) Expand all Loading... |
224 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; | 241 scoped_ptr<ShadowLayerDelegate> overscroll_shadow_; |
225 | 242 |
226 scoped_ptr<TouchEditableImplAura> touch_editable_; | 243 scoped_ptr<TouchEditableImplAura> touch_editable_; |
227 | 244 |
228 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 245 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
229 }; | 246 }; |
230 | 247 |
231 } // namespace content | 248 } // namespace content |
232 | 249 |
233 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 250 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |