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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 1728193002: Support dragging texts into Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp and gn Created 4 years, 10 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
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/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 #if defined(OS_CHROMEOS) 602 #if defined(OS_CHROMEOS)
603 // The externalfile:// scheme is used in Chrome OS to open external files in a 603 // The externalfile:// scheme is used in Chrome OS to open external files in a
604 // browser tab. 604 // browser tab.
605 if (drop_data.url.SchemeIs(content::kExternalFileScheme)) 605 if (drop_data.url.SchemeIs(content::kExternalFileScheme))
606 policy->GrantRequestURL(renderer_id, drop_data.url); 606 policy->GrantRequestURL(renderer_id, drop_data.url);
607 #endif 607 #endif
608 608
609 // The URL could have been cobbled together from any highlighted text string, 609 // The URL could have been cobbled together from any highlighted text string,
610 // and can't be interpreted as a capability. 610 // and can't be interpreted as a capability.
611 DropData filtered_data(drop_data); 611 DropData filtered_data(drop_data);
aelias_OOO_until_Jul13 2016/03/01 19:57:32 There's a lot of code here to filter the DropData
hush (inactive) 2016/03/01 23:54:19 Yes. I just did it with the latest patch.
612 GetProcess()->FilterURL(true, &filtered_data.url); 612 GetProcess()->FilterURL(true, &filtered_data.url);
613 if (drop_data.did_originate_from_renderer) { 613 if (drop_data.did_originate_from_renderer) {
614 filtered_data.filenames.clear(); 614 filtered_data.filenames.clear();
615 } 615 }
616 616
617 // The filenames vector, on the other hand, does represent a capability to 617 // The filenames vector, on the other hand, does represent a capability to
618 // access the given files. 618 // access the given files.
619 storage::IsolatedContext::FileInfoSet files; 619 storage::IsolatedContext::FileInfoSet files;
620 for (std::vector<ui::FileInfo>::iterator iter( 620 for (std::vector<ui::FileInfo>::iterator iter(
621 filtered_data.filenames.begin()); 621 filtered_data.filenames.begin());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 702
703 void RenderViewHostImpl::DragTargetDragLeave() { 703 void RenderViewHostImpl::DragTargetDragLeave() {
704 Send(new DragMsg_TargetDragLeave(GetRoutingID())); 704 Send(new DragMsg_TargetDragLeave(GetRoutingID()));
705 } 705 }
706 706
707 void RenderViewHostImpl::DragTargetDrop( 707 void RenderViewHostImpl::DragTargetDrop(
708 const gfx::Point& client_pt, 708 const gfx::Point& client_pt,
709 const gfx::Point& screen_pt, 709 const gfx::Point& screen_pt,
710 int key_modifiers) { 710 int key_modifiers) {
711 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 711 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
712 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt, 712 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt,
aelias_OOO_until_Jul13 2016/03/01 19:57:32 I'd propose modifying this existing message to tak
hush (inactive) 2016/03/01 23:54:19 I updated the other CL to change the existing Drag
713 key_modifiers)); 713 key_modifiers));
714 } 714 }
715 715
716 #if defined(OS_ANDROID)
aelias_OOO_until_Jul13 2016/03/01 19:57:32 Could you remove all "#if defined(OS_ANDROID)" fro
hush (inactive) 2016/03/01 23:54:19 I merged the new IPC into the existing IPC
717 void RenderViewHostImpl::DragTargetDropWithData(const DropData& drop_data,
718 const gfx::Point& client_pt,
719 const gfx::Point& screen_pt,
720 int key_modifiers) {
721 // TODO(hush): filter the drop_data when we start to support dragging files.
722 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
723 Send(new DragMsg_TargetDropWithData(GetRoutingID(), drop_data,
724 client_pt_in_viewport, screen_pt,
725 key_modifiers));
726 }
727 #endif
728
716 void RenderViewHostImpl::DragSourceEndedAt( 729 void RenderViewHostImpl::DragSourceEndedAt(
717 int client_x, int client_y, int screen_x, int screen_y, 730 int client_x, int client_y, int screen_x, int screen_y,
718 WebDragOperation operation) { 731 WebDragOperation operation) {
719 const gfx::Point client_pt_in_viewport = 732 const gfx::Point client_pt_in_viewport =
720 ConvertDIPToViewport(gfx::Point(client_x, client_y)); 733 ConvertDIPToViewport(gfx::Point(client_x, client_y));
721 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport, 734 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport,
722 gfx::Point(screen_x, screen_y), operation)); 735 gfx::Point(screen_x, screen_y), operation));
723 } 736 }
724 737
725 void RenderViewHostImpl::DragSourceSystemDragEnded() { 738 void RenderViewHostImpl::DragSourceSystemDragEnded() {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1383
1371 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) { 1384 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) {
1372 // The point in guest view is already converted. 1385 // The point in guest view is already converted.
1373 if (!render_widget_host_->scale_input_to_viewport()) 1386 if (!render_widget_host_->scale_input_to_viewport())
1374 return point; 1387 return point;
1375 float scale = GetWidget()->GetView()->current_device_scale_factor(); 1388 float scale = GetWidget()->GetView()->current_device_scale_factor();
1376 return gfx::Point(point.x() * scale, point.y() * scale); 1389 return gfx::Point(point.x() * scale, point.y() * scale);
1377 } 1390 }
1378 1391
1379 } // namespace content 1392 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/web_contents/web_contents_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698