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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #include "content/public/renderer/render_view_observer.h" | 60 #include "content/public/renderer/render_view_observer.h" |
61 #include "content/public/renderer/render_view_visitor.h" | 61 #include "content/public/renderer/render_view_visitor.h" |
62 #include "content/renderer/browser_plugin/browser_plugin.h" | 62 #include "content/renderer/browser_plugin/browser_plugin.h" |
63 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 63 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
64 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" | 64 #include "content/renderer/browser_plugin/old/old_browser_plugin.h" |
65 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" | 65 #include "content/renderer/browser_plugin/old/browser_plugin_channel_manager.h" |
66 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" | 66 #include "content/renderer/browser_plugin/old/browser_plugin_constants.h" |
67 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" | 67 #include "content/renderer/browser_plugin/old/guest_to_embedder_channel.h" |
68 #include "content/renderer/device_orientation_dispatcher.h" | 68 #include "content/renderer/device_orientation_dispatcher.h" |
69 #include "content/renderer/devtools_agent.h" | 69 #include "content/renderer/devtools_agent.h" |
70 #include "content/renderer/disambiguation_popup_helper.h" | |
70 #include "content/renderer/dom_automation_controller.h" | 71 #include "content/renderer/dom_automation_controller.h" |
71 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 72 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
72 #include "content/renderer/do_not_track_bindings.h" | 73 #include "content/renderer/do_not_track_bindings.h" |
73 #include "content/renderer/external_popup_menu.h" | 74 #include "content/renderer/external_popup_menu.h" |
74 #include "content/renderer/geolocation_dispatcher.h" | 75 #include "content/renderer/geolocation_dispatcher.h" |
75 #include "content/renderer/gpu/compositor_thread.h" | 76 #include "content/renderer/gpu/compositor_thread.h" |
76 #include "content/renderer/gpu/compositor_output_surface.h" | 77 #include "content/renderer/gpu/compositor_output_surface.h" |
77 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" | 78 #include "content/renderer/gpu/compositor_software_output_device_gl_adapter.h" |
78 #include "content/renderer/idle_user_detector.h" | 79 #include "content/renderer/idle_user_detector.h" |
79 #include "content/renderer/input_tag_speech_dispatcher.h" | 80 #include "content/renderer/input_tag_speech_dispatcher.h" |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewMsg_SynchronousFind, OnSynchronousFind) | 1051 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewMsg_SynchronousFind, OnSynchronousFind) |
1051 #elif defined(OS_MACOSX) | 1052 #elif defined(OS_MACOSX) |
1052 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) | 1053 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) |
1053 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, | 1054 IPC_MESSAGE_HANDLER(ViewMsg_PluginImeCompositionCompleted, |
1054 OnPluginImeCompositionCompleted) | 1055 OnPluginImeCompositionCompleted) |
1055 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1056 IPC_MESSAGE_HANDLER(ViewMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
1056 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) | 1057 IPC_MESSAGE_HANDLER(ViewMsg_SetInLiveResize, OnSetInLiveResize) |
1057 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) | 1058 IPC_MESSAGE_HANDLER(ViewMsg_SetWindowVisibility, OnSetWindowVisibility) |
1058 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) | 1059 IPC_MESSAGE_HANDLER(ViewMsg_WindowFrameChanged, OnWindowFrameChanged) |
1059 #endif | 1060 #endif |
1061 IPC_MESSAGE_HANDLER(ViewMsg_ReleaseDisambiguationPopupDIB, | |
1062 OnReleaseDisambiguationPopupDIB) | |
1060 | 1063 |
1061 // Have the super handle all other messages. | 1064 // Have the super handle all other messages. |
1062 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) | 1065 IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) |
1063 IPC_END_MESSAGE_MAP() | 1066 IPC_END_MESSAGE_MAP() |
1064 | 1067 |
1065 if (!msg_is_ok) { | 1068 if (!msg_is_ok) { |
1066 // The message had a handler, but its deserialization failed. | 1069 // The message had a handler, but its deserialization failed. |
1067 // Kill the renderer to avoid potential spoofing attacks. | 1070 // Kill the renderer to avoid potential spoofing attacks. |
1068 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 1071 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
1069 } | 1072 } |
(...skipping 5208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6278 | 6281 |
6279 updating_frame_tree_ = true; | 6282 updating_frame_tree_ = true; |
6280 active_frame_id_map_.clear(); | 6283 active_frame_id_map_.clear(); |
6281 | 6284 |
6282 target_process_id_ = process_id; | 6285 target_process_id_ = process_id; |
6283 target_routing_id_ = route_id; | 6286 target_routing_id_ = route_id; |
6284 CreateFrameTree(webview()->mainFrame(), frames); | 6287 CreateFrameTree(webview()->mainFrame(), frames); |
6285 | 6288 |
6286 updating_frame_tree_ = false; | 6289 updating_frame_tree_ = false; |
6287 } | 6290 } |
6291 | |
6292 bool RenderViewImpl::didTapMultipleTargets( | |
6293 const WebKit::WebGestureEvent& event, | |
6294 const WebVector<WebRect>& target_rects) { | |
6295 gfx::Rect finger_rect = gfx::Rect( | |
darin (slow to review)
2012/10/08 21:03:46
no need to call the constructor and the copy const
trchen
2012/10/11 23:54:05
Done.
| |
6296 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, | |
6297 event.data.tap.width, event.data.tap.height); | |
6298 gfx::Rect zoom_rect; | |
6299 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( | |
6300 finger_rect, target_rects, GetSize(), &zoom_rect); | |
6301 if (!scale) | |
6302 return false; | |
6303 | |
6304 gfx::Size canvas_size = zoom_rect.size(); | |
6305 canvas_size = canvas_size.Scale(scale); | |
6306 TransportDIB* transport_dib = NULL; | |
6307 { | |
6308 scoped_ptr<skia::PlatformCanvas> canvas( | |
6309 RenderProcess::current()->GetDrawingCanvas(&transport_dib, | |
6310 gfx::Rect(canvas_size))); | |
6311 if (!canvas.get()) | |
6312 return false; | |
6313 | |
6314 canvas->scale(scale, scale); | |
6315 | |
6316 canvas->translate(-zoom_rect.x(), -zoom_rect.y()); | |
6317 webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect, | |
6318 WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent); | |
6319 } | |
6320 Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_, | |
6321 zoom_rect, | |
6322 canvas_size, | |
6323 transport_dib->id())); | |
6324 | |
6325 return true; | |
6326 } | |
6327 | |
6328 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | |
6329 TransportDIB::Handle dib_handle) { | |
6330 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | |
6331 RenderProcess::current()->ReleaseTransportDIB(dib); | |
6332 } | |
OLD | NEW |