Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10885004: Implement disambiguation popup (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing visibility Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 5290 matching lines...) Expand 10 before | Expand all | Expand 10 after
6362 6366
6363 updating_frame_tree_ = true; 6367 updating_frame_tree_ = true;
6364 active_frame_id_map_.clear(); 6368 active_frame_id_map_.clear();
6365 6369
6366 target_process_id_ = process_id; 6370 target_process_id_ = process_id;
6367 target_routing_id_ = route_id; 6371 target_routing_id_ = route_id;
6368 CreateFrameTree(webview()->mainFrame(), frames); 6372 CreateFrameTree(webview()->mainFrame(), frames);
6369 6373
6370 updating_frame_tree_ = false; 6374 updating_frame_tree_ = false;
6371 } 6375 }
6376
6377 bool RenderViewImpl::didTapMultipleTargets(
6378 const WebKit::WebGestureEvent& event,
6379 const WebVector<WebRect>& target_rects) {
6380 using content::DisambiguationPopupHelper;
6381 gfx::Rect finger_rect(
6382 event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2,
6383 event.data.tap.width, event.data.tap.height);
6384 gfx::Rect zoom_rect;
6385 float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor(
6386 finger_rect, target_rects, GetSize(), &zoom_rect);
6387 if (!scale)
6388 return false;
6389
6390 gfx::Size canvas_size = zoom_rect.size();
6391 canvas_size = ToCeiledSize(canvas_size.Scale(scale));
6392 TransportDIB* transport_dib = NULL;
6393 {
6394 scoped_ptr<skia::PlatformCanvas> canvas(
6395 RenderProcess::current()->GetDrawingCanvas(&transport_dib,
6396 gfx::Rect(canvas_size)));
6397 if (!canvas.get())
6398 return false;
6399
6400 canvas->scale(scale, scale);
6401
6402 canvas->translate(-zoom_rect.x(), -zoom_rect.y());
6403 webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect,
6404 WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent);
6405 }
6406 Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_,
6407 zoom_rect,
6408 canvas_size,
6409 transport_dib->id()));
6410
6411 return true;
6412 }
6413
6414 void RenderViewImpl::OnReleaseDisambiguationPopupDIB(
6415 TransportDIB::Handle dib_handle) {
6416 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle);
6417 RenderProcess::current()->ReleaseTransportDIB(dib);
6418 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698