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

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

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 9 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 GetWidget()->RendererExited(status, exit_code); 588 GetWidget()->RendererExited(status, exit_code);
589 delegate_->RenderViewTerminated(this, status, exit_code); 589 delegate_->RenderViewTerminated(this, status, exit_code);
590 } 590 }
591 591
592 void RenderViewHostImpl::DragTargetDragEnter( 592 void RenderViewHostImpl::DragTargetDragEnter(
593 const DropData& drop_data, 593 const DropData& drop_data,
594 const gfx::Point& client_pt, 594 const gfx::Point& client_pt,
595 const gfx::Point& screen_pt, 595 const gfx::Point& screen_pt,
596 WebDragOperationsMask operations_allowed, 596 WebDragOperationsMask operations_allowed,
597 int key_modifiers) { 597 int key_modifiers) {
598 DCHECK(drop_data.is_valid);
598 const int renderer_id = GetProcess()->GetID(); 599 const int renderer_id = GetProcess()->GetID();
599 ChildProcessSecurityPolicyImpl* policy = 600 ChildProcessSecurityPolicyImpl* policy =
600 ChildProcessSecurityPolicyImpl::GetInstance(); 601 ChildProcessSecurityPolicyImpl::GetInstance();
601 602
602 #if defined(OS_CHROMEOS) 603 #if defined(OS_CHROMEOS)
603 // The externalfile:// scheme is used in Chrome OS to open external files in a 604 // The externalfile:// scheme is used in Chrome OS to open external files in a
604 // browser tab. 605 // browser tab.
605 if (drop_data.url.SchemeIs(content::kExternalFileScheme)) 606 if (drop_data.url.SchemeIs(content::kExternalFileScheme))
606 policy->GrantRequestURL(renderer_id, drop_data.url); 607 policy->GrantRequestURL(renderer_id, drop_data.url);
607 #endif 608 #endif
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 698 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
698 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport, 699 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport,
699 screen_pt, operations_allowed, 700 screen_pt, operations_allowed,
700 key_modifiers)); 701 key_modifiers));
701 } 702 }
702 703
703 void RenderViewHostImpl::DragTargetDragLeave() { 704 void RenderViewHostImpl::DragTargetDragLeave() {
704 Send(new DragMsg_TargetDragLeave(GetRoutingID())); 705 Send(new DragMsg_TargetDragLeave(GetRoutingID()));
705 } 706 }
706 707
707 void RenderViewHostImpl::DragTargetDrop( 708 void RenderViewHostImpl::DragTargetDrop(const DropData& drop_data,
708 const gfx::Point& client_pt, 709 const gfx::Point& client_pt,
709 const gfx::Point& screen_pt, 710 const gfx::Point& screen_pt,
710 int key_modifiers) { 711 int key_modifiers) {
711 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 712 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
712 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt, 713 // TODO(hush): filter the drop_data if drop data is valid.
no sievers 2016/03/08 01:22:15 nit: This comment's meaning is not evident.
dcheng 2016/03/08 01:44:08 Can we just extract the logic from DragTargetEnter
hush (inactive) 2016/03/08 18:23:06 I've done it in a follow up CL that builds on top
713 key_modifiers)); 714 Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data, client_pt_in_viewport,
715 screen_pt, key_modifiers));
714 } 716 }
715 717
716 void RenderViewHostImpl::DragSourceEndedAt( 718 void RenderViewHostImpl::DragSourceEndedAt(
717 int client_x, int client_y, int screen_x, int screen_y, 719 int client_x, int client_y, int screen_x, int screen_y,
718 WebDragOperation operation) { 720 WebDragOperation operation) {
719 const gfx::Point client_pt_in_viewport = 721 const gfx::Point client_pt_in_viewport =
720 ConvertDIPToViewport(gfx::Point(client_x, client_y)); 722 ConvertDIPToViewport(gfx::Point(client_x, client_y));
721 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport, 723 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport,
722 gfx::Point(screen_x, screen_y), operation)); 724 gfx::Point(screen_x, screen_y), operation));
723 } 725 }
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1372
1371 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) { 1373 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) {
1372 // The point in guest view is already converted. 1374 // The point in guest view is already converted.
1373 if (!render_widget_host_->scale_input_to_viewport()) 1375 if (!render_widget_host_->scale_input_to_viewport())
1374 return point; 1376 return point;
1375 float scale = GetWidget()->GetView()->current_device_scale_factor(); 1377 float scale = GetWidget()->GetView()->current_device_scale_factor();
1376 return gfx::Point(point.x() * scale, point.y() * scale); 1378 return gfx::Point(point.x() * scale, point.y() * scale);
1377 } 1379 }
1378 1380
1379 } // namespace content 1381 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698