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 #include "content/browser/web_contents/web_contents_view_guest.h" | 5 #include "content/browser/web_contents/web_contents_view_guest.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 8 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/browser/renderer_host/render_view_host_factory.h" | 10 #include "content/browser/renderer_host/render_view_host_factory.h" |
11 #include "content/browser/renderer_host/render_view_host_impl.h" | 11 #include "content/browser/renderer_host/render_view_host_impl.h" |
12 #include "content/browser/renderer_host/render_widget_host_view_guest.h" | 12 #include "content/browser/renderer_host/render_widget_host_view_guest.h" |
13 #include "content/browser/web_contents/interstitial_page_impl.h" | 13 #include "content/browser/web_contents/interstitial_page_impl.h" |
14 #include "content/browser/web_contents/web_contents_impl.h" | 14 #include "content/browser/web_contents/web_contents_impl.h" |
15 #include "content/common/drag_messages.h" | 15 #include "content/common/drag_messages.h" |
16 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
17 #include "content/public/common/context_menu_params.h" | 17 #include "content/public/common/context_menu_params.h" |
| 18 #include "content/public/common/drop_data.h" |
18 #include "ui/gfx/image/image_skia.h" | 19 #include "ui/gfx/image/image_skia.h" |
19 #include "ui/gfx/point.h" | 20 #include "ui/gfx/point.h" |
20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
21 #include "ui/gfx/size.h" | 22 #include "ui/gfx/size.h" |
22 #include "webkit/common/webdropdata.h" | |
23 | 23 |
24 using WebKit::WebDragOperation; | 24 using WebKit::WebDragOperation; |
25 using WebKit::WebDragOperationsMask; | 25 using WebKit::WebDragOperationsMask; |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 WebContentsViewGuest::WebContentsViewGuest( | 29 WebContentsViewGuest::WebContentsViewGuest( |
30 WebContentsImpl* web_contents, | 30 WebContentsImpl* web_contents, |
31 BrowserPluginGuest* guest, | 31 BrowserPluginGuest* guest, |
32 WebContentsViewPort* platform_view, | 32 WebContentsViewPort* platform_view, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 | 160 |
161 void WebContentsViewGuest::Focus() { | 161 void WebContentsViewGuest::Focus() { |
162 platform_view_->Focus(); | 162 platform_view_->Focus(); |
163 } | 163 } |
164 | 164 |
165 void WebContentsViewGuest::StoreFocus() { | 165 void WebContentsViewGuest::StoreFocus() { |
166 platform_view_->StoreFocus(); | 166 platform_view_->StoreFocus(); |
167 } | 167 } |
168 | 168 |
169 WebDropData* WebContentsViewGuest::GetDropData() const { | 169 DropData* WebContentsViewGuest::GetDropData() const { |
170 NOTIMPLEMENTED(); | 170 NOTIMPLEMENTED(); |
171 return NULL; | 171 return NULL; |
172 } | 172 } |
173 | 173 |
174 void WebContentsViewGuest::UpdateDragCursor(WebDragOperation operation) { | 174 void WebContentsViewGuest::UpdateDragCursor(WebDragOperation operation) { |
175 RenderViewHostImpl* embedder_render_view_host = | 175 RenderViewHostImpl* embedder_render_view_host = |
176 static_cast<RenderViewHostImpl*>( | 176 static_cast<RenderViewHostImpl*>( |
177 guest_->embedder_web_contents()->GetRenderViewHost()); | 177 guest_->embedder_web_contents()->GetRenderViewHost()); |
178 CHECK(embedder_render_view_host); | 178 CHECK(embedder_render_view_host); |
179 RenderViewHostDelegateView* view = | 179 RenderViewHostDelegateView* view = |
(...skipping 17 matching lines...) Expand all Loading... |
197 double item_font_size, | 197 double item_font_size, |
198 int selected_item, | 198 int selected_item, |
199 const std::vector<WebMenuItem>& items, | 199 const std::vector<WebMenuItem>& items, |
200 bool right_aligned, | 200 bool right_aligned, |
201 bool allow_multiple_selection) { | 201 bool allow_multiple_selection) { |
202 // External popup menus are only used on Mac and Android. | 202 // External popup menus are only used on Mac and Android. |
203 NOTIMPLEMENTED(); | 203 NOTIMPLEMENTED(); |
204 } | 204 } |
205 | 205 |
206 void WebContentsViewGuest::StartDragging( | 206 void WebContentsViewGuest::StartDragging( |
207 const WebDropData& drop_data, | 207 const DropData& drop_data, |
208 WebDragOperationsMask ops, | 208 WebDragOperationsMask ops, |
209 const gfx::ImageSkia& image, | 209 const gfx::ImageSkia& image, |
210 const gfx::Vector2d& image_offset, | 210 const gfx::Vector2d& image_offset, |
211 const DragEventSourceInfo& event_info) { | 211 const DragEventSourceInfo& event_info) { |
212 WebContentsImpl* embedder_web_contents = guest_->embedder_web_contents(); | 212 WebContentsImpl* embedder_web_contents = guest_->embedder_web_contents(); |
213 embedder_web_contents->GetBrowserPluginEmbedder()->StartDrag(guest_); | 213 embedder_web_contents->GetBrowserPluginEmbedder()->StartDrag(guest_); |
214 RenderViewHostImpl* embedder_render_view_host = | 214 RenderViewHostImpl* embedder_render_view_host = |
215 static_cast<RenderViewHostImpl*>( | 215 static_cast<RenderViewHostImpl*>( |
216 embedder_web_contents->GetRenderViewHost()); | 216 embedder_web_contents->GetRenderViewHost()); |
217 CHECK(embedder_render_view_host); | 217 CHECK(embedder_render_view_host); |
218 RenderViewHostDelegateView* view = | 218 RenderViewHostDelegateView* view = |
219 embedder_render_view_host->GetDelegate()->GetDelegateView(); | 219 embedder_render_view_host->GetDelegate()->GetDelegateView(); |
220 if (view) | 220 if (view) |
221 view->StartDragging(drop_data, ops, image, image_offset, event_info); | 221 view->StartDragging(drop_data, ops, image, image_offset, event_info); |
222 else | 222 else |
223 embedder_web_contents->SystemDragEnded(); | 223 embedder_web_contents->SystemDragEnded(); |
224 } | 224 } |
225 | 225 |
226 } // namespace content | 226 } // namespace content |
OLD | NEW |