Chromium Code Reviews| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 #include "content/public/renderer/render_view_observer.h" | 61 #include "content/public/renderer/render_view_observer.h" |
| 62 #include "content/public/renderer/render_view_visitor.h" | 62 #include "content/public/renderer/render_view_visitor.h" |
| 63 #include "content/renderer/browser_plugin/browser_plugin.h" | 63 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 64 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 64 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 65 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" | 65 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" |
| 66 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 66 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
| 67 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 67 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
| 68 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" | 68 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" |
| 69 #include "content/renderer/device_orientation_dispatcher.h" | 69 #include "content/renderer/device_orientation_dispatcher.h" |
| 70 #include "content/renderer/devtools_agent.h" | 70 #include "content/renderer/devtools_agent.h" |
| 71 #include "content/renderer/disambiguation_popup_helper.h" | |
| 71 #include "content/renderer/dom_automation_controller.h" | 72 #include "content/renderer/dom_automation_controller.h" |
| 72 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 73 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 73 #include "content/renderer/do_not_track_bindings.h" | 74 #include "content/renderer/do_not_track_bindings.h" |
| 74 #include "content/renderer/external_popup_menu.h" | 75 #include "content/renderer/external_popup_menu.h" |
| 75 #include "content/renderer/geolocation_dispatcher.h" | 76 #include "content/renderer/geolocation_dispatcher.h" |
| 76 #include "content/renderer/gpu/compositor_thread.h" | 77 #include "content/renderer/gpu/compositor_thread.h" |
| 77 #include "content/renderer/gpu/compositor_output_surface.h" | 78 #include "content/renderer/gpu/compositor_output_surface.h" |
| 78 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" | 79 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" |
| 79 #include "content/renderer/idle_user_detector.h" | 80 #include "content/renderer/idle_user_detector.h" |
| 80 #include "content/renderer/input_tag_speech_dispatcher.h" | 81 #include "content/renderer/input_tag_speech_dispatcher.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 174 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
| 174 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError. h" | 175 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError. h" |
| 175 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" | 176 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" |
| 176 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon se.h" | 177 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon se.h" |
| 177 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 178 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 178 #include "third_party/skia/include/core/SkBitmap.h" | 179 #include "third_party/skia/include/core/SkBitmap.h" |
| 179 #include "ui/base/dialogs/selected_file_info.h" | 180 #include "ui/base/dialogs/selected_file_info.h" |
| 180 #include "ui/gfx/native_widget_types.h" | 181 #include "ui/gfx/native_widget_types.h" |
| 181 #include "ui/gfx/point.h" | 182 #include "ui/gfx/point.h" |
| 182 #include "ui/gfx/rect.h" | 183 #include "ui/gfx/rect.h" |
| 184 #include "ui/gfx/size_conversions.h" | |
| 183 #include "v8/include/v8.h" | 185 #include "v8/include/v8.h" |
| 184 #include "webkit/appcache/web_application_cache_host_impl.h" | 186 #include "webkit/appcache/web_application_cache_host_impl.h" |
| 185 #include "webkit/dom_storage/dom_storage_types.h" | 187 #include "webkit/dom_storage/dom_storage_types.h" |
| 186 #include "webkit/glue/alt_error_page_resource_fetcher.h" | 188 #include "webkit/glue/alt_error_page_resource_fetcher.h" |
| 187 #include "webkit/glue/dom_operations.h" | 189 #include "webkit/glue/dom_operations.h" |
| 188 #include "webkit/glue/glue_serialize.h" | 190 #include "webkit/glue/glue_serialize.h" |
| 189 #include "webkit/glue/web_intent_service_data.h" | 191 #include "webkit/glue/web_intent_service_data.h" |
| 190 #include "webkit/glue/webdropdata.h" | 192 #include "webkit/glue/webdropdata.h" |
| 191 #include "webkit/glue/webkit_constants.h" | 193 #include "webkit/glue/webkit_constants.h" |
| 192 #include "webkit/glue/webkit_glue.h" | 194 #include "webkit/glue/webkit_glue.h" |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1052 OnUndoScrollFocusedEditableNodeIntoRect) | 1054 OnUndoScrollFocusedEditableNodeIntoRect) |
| 1053 #elif defined(OS_MACOSX) | 1055 #elif defined(OS_MACOSX) |
| 1054 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) | 1056 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) |
| 1055 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1057 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
| 1056 OnPluginImeCompositionCompleted) | 1058 OnPluginImeCompositionCompleted) |
| 1057 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1059 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 1058 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1060 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
| 1059 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1061 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
| 1060 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1062 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
| 1061 #endif | 1063 #endif |
| 1064 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, | |
| 1065 OnReleaseDisambiguationPopupDIB) | |
| 1062 | 1066 |
| 1063 // Have the super handle all other messages. | 1067 // Have the super handle all other messages. |
| 1064 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1068 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
| 1065 IPC_END_MESSAGE_MAP() | 1069 IPC_END_MESSAGE_MAP() |
| 1066 | 1070 |
| 1067 if (!msg_is_ok) { | 1071 if (!msg_is_ok) { |
| 1068 // The message had a handler, but its deserialization failed. | 1072 // The message had a handler, but its deserialization failed. |
| 1069 // Kill the renderer to avoid potential spoofing attacks. | 1073 // Kill the renderer to avoid potential spoofing attacks. |
| 1070 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1074 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
| 1071 } | 1075 } |
| (...skipping 5262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6334 | 6338 |
| 6335 updating_frame_tree_ = true; | 6339 updating_frame_tree_ = true; |
| 6336 active_frame_id_map_.clear(); | 6340 active_frame_id_map_.clear(); |
| 6337 | 6341 |
| 6338 target_process_id_ = process_id; | 6342 target_process_id_ = process_id; |
| 6339 target_routing_id_ = route_id; | 6343 target_routing_id_ = route_id; |
| 6340 CreateFrameTree(webview()->mainFrame(), frames); | 6344 CreateFrameTree(webview()->mainFrame(), frames); |
| 6341 | 6345 |
| 6342 updating_frame_tree_ = false; | 6346 updating_frame_tree_ = false; |
| 6343 } | 6347 } |
| 6348 | |
| 6349 bool RenderViewImpl::didTapMultipleTargets( | |
| 6350 const WebKit::WebGestureEvent& event, | |
| 6351 const WebVector<WebRect>& target_rects) { | |
| 6352 using content::DisambiguationPopupHelper; | |
|
darin (slow to review)
2012/10/17 19:14:01
nit: RenderViewImpl is already in the content name
trchen
2012/10/17 22:25:08
Nope, only RenderView is in content namespace whil
| |
| 6353 gfx::Rect finger_rect( | |
| 6354 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, | |
| 6355 event.data.tap.width, event.data.tap.height); | |
| 6356 gfx::Rect zoom_rect; | |
| 6357 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( | |
| 6358 finger_rect, target_rects, GetSize(), &zoom_rect); | |
| 6359 if (!scale) | |
| 6360 return false; | |
| 6361 | |
| 6362 gfx::Size canvas_size = zoom_rect.size(); | |
| 6363 canvas_size = ToCeiledSize(canvas_size.Scale(scale)); | |
| 6364 TransportDIB* transport_dib = NULL; | |
| 6365 { | |
| 6366 scoped_ptr<skia::PlatformCanvas> canvas( | |
| 6367 RenderProcess::current()->GetDrawingCanvas(&transport_dib, | |
| 6368 gfx::Rect(canvas_size))); | |
| 6369 if (!canvas.get()) | |
| 6370 return false; | |
| 6371 | |
| 6372 canvas->scale(scale, scale); | |
| 6373 | |
| 6374 canvas->translate(-zoom_rect.x(), -zoom_rect.y()); | |
| 6375 webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect, | |
| 6376 WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent); | |
| 6377 } | |
| 6378 Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_, | |
| 6379 zoom_rect, | |
| 6380 canvas_size, | |
| 6381 transport_dib->id())); | |
| 6382 | |
| 6383 return true; | |
| 6384 } | |
| 6385 | |
| 6386 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | |
| 6387 TransportDIB::Handle dib_handle) { | |
| 6388 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | |
| 6389 RenderProcess::current()->ReleaseTransportDIB(dib); | |
| 6390 } | |
| OLD | NEW |