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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "content/public/renderer/render_view_observer.h" | 59 #include "content/public/renderer/render_view_observer.h" |
60 #include "content/public/renderer/render_view_visitor.h" | 60 #include "content/public/renderer/render_view_visitor.h" |
61 #include "content/renderer/browser_plugin/browser_plugin.h" | 61 #include "content/renderer/browser_plugin/browser_plugin.h" |
62 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 62 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
63 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" | 63 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" |
64 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 64 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
65 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 65 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
66 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" | 66 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" |
67 #include "content/renderer/device_orientation_dispatcher.h" | 67 #include "content/renderer/device_orientation_dispatcher.h" |
68 #include "content/renderer/devtools_agent.h" | 68 #include "content/renderer/devtools_agent.h" |
| 69 #include "content/renderer/disambiguation_popup_helper.h" |
69 #include "content/renderer/dom_automation_controller.h" | 70 #include "content/renderer/dom_automation_controller.h" |
70 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 71 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
71 #include "content/renderer/external_popup_menu.h" | 72 #include "content/renderer/external_popup_menu.h" |
72 #include "content/renderer/geolocation_dispatcher.h" | 73 #include "content/renderer/geolocation_dispatcher.h" |
73 #include "content/renderer/gpu/compositor_thread.h" | 74 #include "content/renderer/gpu/compositor_thread.h" |
74 #include "content/renderer/gpu/compositor_output_surface.h" | 75 #include "content/renderer/gpu/compositor_output_surface.h" |
75 #include "content/renderer/idle_user_detector.h" | 76 #include "content/renderer/idle_user_detector.h" |
76 #include "content/renderer/input_tag_speech_dispatcher.h" | 77 #include "content/renderer/input_tag_speech_dispatcher.h" |
77 #include "content/renderer/java/java_bridge_dispatcher.h" | 78 #include "content/renderer/java/java_bridge_dispatcher.h" |
78 #include "content/renderer/load_progress_tracker.h" | 79 #include "content/renderer/load_progress_tracker.h" |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 // TODO(viettrungluu): Move to a separate message filter. | 1040 // TODO(viettrungluu): Move to a separate message filter. |
1040 #if defined(OS_MACOSX) | 1041 #if defined(OS_MACOSX) |
1041 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1042 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
1042 #endif | 1043 #endif |
1043 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, | 1044 IPC_MESSAGE_HANDLER(ViewMsg_SetHistoryLengthAndPrune, |
1044 OnSetHistoryLengthAndPrune) | 1045 OnSetHistoryLengthAndPrune) |
1045 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) | 1046 IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
1046 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) | 1047 IPC_MESSAGE_HANDLER(JavaBridgeMsg_Init, OnJavaBridgeInit) |
1047 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) | 1048 IPC_MESSAGE_HANDLER(ViewMsg_SetAccessibilityMode, OnSetAccessibilityMode) |
1048 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) | 1049 IPC_MESSAGE_HANDLER(ViewMsg_UpdateFrameTree, OnUpdatedFrameTree) |
| 1050 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, |
| 1051 OnReleaseDisambiguationPopupDIB) |
1049 | 1052 |
1050 // Have the super handle all other messages. | 1053 // Have the super handle all other messages. |
1051 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1054 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
1052 IPC_END_MESSAGE_MAP() | 1055 IPC_END_MESSAGE_MAP() |
1053 | 1056 |
1054 if (!msg_is_ok) { | 1057 if (!msg_is_ok) { |
1055 // The message had a handler, but its deserialization failed. | 1058 // The message had a handler, but its deserialization failed. |
1056 // Kill the renderer to avoid potential spoofing attacks. | 1059 // Kill the renderer to avoid potential spoofing attacks. |
1057 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1060 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
1058 } | 1061 } |
(...skipping 4986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6045 | 6048 |
6046 updating_frame_tree_ = true; | 6049 updating_frame_tree_ = true; |
6047 active_frame_id_map_.clear(); | 6050 active_frame_id_map_.clear(); |
6048 | 6051 |
6049 target_process_id_ = process_id; | 6052 target_process_id_ = process_id; |
6050 target_routing_id_ = route_id; | 6053 target_routing_id_ = route_id; |
6051 CreateFrameTree(webview()->mainFrame(), frames); | 6054 CreateFrameTree(webview()->mainFrame(), frames); |
6052 | 6055 |
6053 updating_frame_tree_ = false; | 6056 updating_frame_tree_ = false; |
6054 } | 6057 } |
| 6058 |
| 6059 bool RenderViewImpl::multipleTargetsTapped( |
| 6060 const WebKit::WebGestureEvent& event, |
| 6061 const WebVector<WebRect>& target_rects) { |
| 6062 gfx::Rect zoom_rect; |
| 6063 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( |
| 6064 zoom_rect, event.boundingBox, target_rects, GetSize()); |
| 6065 if (!scale) |
| 6066 return false; |
| 6067 |
| 6068 gfx::Size canvas_size = zoom_rect.size(); |
| 6069 canvas_size = canvas_size.Scale(scale); |
| 6070 TransportDIB* transport_dib = NULL; |
| 6071 { |
| 6072 scoped_ptr<skia::PlatformCanvas> canvas( |
| 6073 RenderProcess::current()->GetDrawingCanvas(&transport_dib, |
| 6074 gfx::Rect(canvas_size))); |
| 6075 if (!canvas.get()) |
| 6076 return false; |
| 6077 |
| 6078 canvas->scale(scale, scale); |
| 6079 |
| 6080 canvas->translate(-zoom_rect.x(), -zoom_rect.y()); |
| 6081 webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect, |
| 6082 WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent); |
| 6083 } |
| 6084 Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_, |
| 6085 zoom_rect, |
| 6086 canvas_size, |
| 6087 transport_dib->id())); |
| 6088 |
| 6089 return true; |
| 6090 } |
| 6091 |
| 6092 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6093 TransportDIB::Handle dib_handle) { |
| 6094 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6095 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6096 } |
OLD | NEW |