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/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/port/browser/render_view_host_delegate_view.h" | 13 #include "content/port/browser/render_view_host_delegate_view.h" |
14 #include "content/public/browser/web_contents_view.h" | 14 #include "content/public/browser/web_contents_view.h" |
15 #include "ui/aura/client/drag_drop_delegate.h" | 15 #include "ui/aura/client/drag_drop_delegate.h" |
16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
17 | 17 |
18 class WebContentsImpl; | |
19 | |
20 namespace aura { | 18 namespace aura { |
21 class Window; | 19 class Window; |
22 } | 20 } |
23 | 21 |
24 namespace content { | |
25 class WebContentsViewDelegate; | |
26 class WebDragDestDelegate; | |
27 } | |
28 | |
29 namespace ui { | 22 namespace ui { |
30 class DropTargetEvent; | 23 class DropTargetEvent; |
31 } | 24 } |
32 | 25 |
| 26 namespace content { |
| 27 class WebContentsViewDelegate; |
| 28 class WebContentsImpl; |
| 29 class WebDragDestDelegate; |
| 30 |
33 class CONTENT_EXPORT WebContentsViewAura | 31 class CONTENT_EXPORT WebContentsViewAura |
34 : public content::WebContentsView, | 32 : public WebContentsView, |
35 public content::RenderViewHostDelegateView, | 33 public RenderViewHostDelegateView, |
36 public aura::WindowDelegate, | 34 public aura::WindowDelegate, |
37 public aura::client::DragDropDelegate { | 35 public aura::client::DragDropDelegate { |
38 public: | 36 public: |
39 WebContentsViewAura(WebContentsImpl* web_contents, | 37 WebContentsViewAura(WebContentsImpl* web_contents, |
40 content::WebContentsViewDelegate* delegate); | 38 WebContentsViewDelegate* delegate); |
41 | 39 |
42 private: | 40 private: |
43 virtual ~WebContentsViewAura(); | 41 virtual ~WebContentsViewAura(); |
44 | 42 |
45 void SizeChangedCommon(const gfx::Size& size); | 43 void SizeChangedCommon(const gfx::Size& size); |
46 | 44 |
47 void EndDrag(WebKit::WebDragOperationsMask ops); | 45 void EndDrag(WebKit::WebDragOperationsMask ops); |
48 | 46 |
49 // Overridden from WebContentsView: | 47 // Overridden from WebContentsView: |
50 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; | 48 virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; |
51 virtual content::RenderWidgetHostView* CreateViewForWidget( | 49 virtual RenderWidgetHostView* CreateViewForWidget( |
52 content::RenderWidgetHost* render_widget_host) OVERRIDE; | 50 RenderWidgetHost* render_widget_host) OVERRIDE; |
53 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 51 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
54 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; | 52 virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
55 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; | 53 virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; |
56 virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE; | 54 virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE; |
57 virtual void SetPageTitle(const string16& title) OVERRIDE; | 55 virtual void SetPageTitle(const string16& title) OVERRIDE; |
58 virtual void OnTabCrashed(base::TerminationStatus status, | 56 virtual void OnTabCrashed(base::TerminationStatus status, |
59 int error_code) OVERRIDE; | 57 int error_code) OVERRIDE; |
60 virtual void SizeContents(const gfx::Size& size) OVERRIDE; | 58 virtual void SizeContents(const gfx::Size& size) OVERRIDE; |
61 virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; | 59 virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; |
62 virtual void Focus() OVERRIDE; | 60 virtual void Focus() OVERRIDE; |
63 virtual void SetInitialFocus() OVERRIDE; | 61 virtual void SetInitialFocus() OVERRIDE; |
64 virtual void StoreFocus() OVERRIDE; | 62 virtual void StoreFocus() OVERRIDE; |
65 virtual void RestoreFocus() OVERRIDE; | 63 virtual void RestoreFocus() OVERRIDE; |
66 virtual WebDropData* GetDropData() const OVERRIDE; | 64 virtual WebDropData* GetDropData() const OVERRIDE; |
67 virtual bool IsEventTracking() const OVERRIDE; | 65 virtual bool IsEventTracking() const OVERRIDE; |
68 virtual void CloseTabAfterEventTracking() OVERRIDE; | 66 virtual void CloseTabAfterEventTracking() OVERRIDE; |
69 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 67 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
70 | 68 |
71 // Overridden from RenderViewHostDelegateView: | 69 // Overridden from RenderViewHostDelegateView: |
72 virtual void ShowContextMenu( | 70 virtual void ShowContextMenu( |
73 const content::ContextMenuParams& params, | 71 const ContextMenuParams& params, |
74 content::ContextMenuSourceType type) OVERRIDE; | 72 ContextMenuSourceType type) OVERRIDE; |
75 virtual void ShowPopupMenu(const gfx::Rect& bounds, | 73 virtual void ShowPopupMenu(const gfx::Rect& bounds, |
76 int item_height, | 74 int item_height, |
77 double item_font_size, | 75 double item_font_size, |
78 int selected_item, | 76 int selected_item, |
79 const std::vector<WebMenuItem>& items, | 77 const std::vector<WebMenuItem>& items, |
80 bool right_aligned, | 78 bool right_aligned, |
81 bool allow_multiple_selection) OVERRIDE; | 79 bool allow_multiple_selection) OVERRIDE; |
82 virtual void StartDragging(const WebDropData& drop_data, | 80 virtual void StartDragging(const WebDropData& drop_data, |
83 WebKit::WebDragOperationsMask operations, | 81 WebKit::WebDragOperationsMask operations, |
84 const gfx::ImageSkia& image, | 82 const gfx::ImageSkia& image, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 117 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
120 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 118 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
121 virtual void OnDragExited() OVERRIDE; | 119 virtual void OnDragExited() OVERRIDE; |
122 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 120 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
123 | 121 |
124 scoped_ptr<aura::Window> window_; | 122 scoped_ptr<aura::Window> window_; |
125 | 123 |
126 // The WebContentsImpl whose contents we display. | 124 // The WebContentsImpl whose contents we display. |
127 WebContentsImpl* web_contents_; | 125 WebContentsImpl* web_contents_; |
128 | 126 |
129 content::RenderWidgetHostView* view_; | 127 RenderWidgetHostView* view_; |
130 | 128 |
131 scoped_ptr<content::WebContentsViewDelegate> delegate_; | 129 scoped_ptr<WebContentsViewDelegate> delegate_; |
132 | 130 |
133 WebKit::WebDragOperationsMask current_drag_op_; | 131 WebKit::WebDragOperationsMask current_drag_op_; |
134 | 132 |
135 content::WebDragDestDelegate* drag_dest_delegate_; | 133 WebDragDestDelegate* drag_dest_delegate_; |
136 | 134 |
137 // We keep track of the render view host we're dragging over. If it changes | 135 // We keep track of the render view host we're dragging over. If it changes |
138 // during a drag, we need to re-send the DragEnter message. WARNING: | 136 // during a drag, we need to re-send the DragEnter message. WARNING: |
139 // this pointer should never be dereferenced. We only use it for comparing | 137 // this pointer should never be dereferenced. We only use it for comparing |
140 // pointers. | 138 // pointers. |
141 void* current_rvh_for_drag_; | 139 void* current_rvh_for_drag_; |
142 | 140 |
143 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); | 141 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); |
144 }; | 142 }; |
145 | 143 |
| 144 } // namespace content |
| 145 |
146 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ | 146 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ |
OLD | NEW |