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/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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 685 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
686 | 686 |
687 // Note: We are using the origin URL provided by the sender here. It may be | 687 // Note: We are using the origin URL provided by the sender here. It may be |
688 // different from the receiver's. | 688 // different from the receiver's. |
689 filtered_data.file_system_files[i].url = | 689 filtered_data.file_system_files[i].url = |
690 GURL(storage::GetIsolatedFileSystemRootURIString( | 690 GURL(storage::GetIsolatedFileSystemRootURIString( |
691 file_system_url.origin(), filesystem_id, std::string()) | 691 file_system_url.origin(), filesystem_id, std::string()) |
692 .append(register_name)); | 692 .append(register_name)); |
693 } | 693 } |
694 | 694 |
695 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt, | 695 const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt); |
696 screen_pt, operations_allowed, | 696 |
697 key_modifiers)); | 697 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, |
| 698 client_pt_in_viewport, screen_pt, |
| 699 operations_allowed, key_modifiers)); |
698 } | 700 } |
699 | 701 |
700 void RenderViewHostImpl::DragTargetDragOver( | 702 void RenderViewHostImpl::DragTargetDragOver( |
701 const gfx::Point& client_pt, | 703 const gfx::Point& client_pt, |
702 const gfx::Point& screen_pt, | 704 const gfx::Point& screen_pt, |
703 WebDragOperationsMask operations_allowed, | 705 WebDragOperationsMask operations_allowed, |
704 int key_modifiers) { | 706 int key_modifiers) { |
705 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt, | 707 const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt); |
706 operations_allowed, key_modifiers)); | 708 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport, |
| 709 screen_pt, operations_allowed, |
| 710 key_modifiers)); |
707 } | 711 } |
708 | 712 |
709 void RenderViewHostImpl::DragTargetDragLeave() { | 713 void RenderViewHostImpl::DragTargetDragLeave() { |
710 Send(new DragMsg_TargetDragLeave(GetRoutingID())); | 714 Send(new DragMsg_TargetDragLeave(GetRoutingID())); |
711 } | 715 } |
712 | 716 |
713 void RenderViewHostImpl::DragTargetDrop( | 717 void RenderViewHostImpl::DragTargetDrop( |
714 const gfx::Point& client_pt, | 718 const gfx::Point& client_pt, |
715 const gfx::Point& screen_pt, | 719 const gfx::Point& screen_pt, |
716 int key_modifiers) { | 720 int key_modifiers) { |
717 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt, | 721 const gfx::Point client_pt_in_viewport = convertDipToViewport(client_pt); |
| 722 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt, |
718 key_modifiers)); | 723 key_modifiers)); |
719 } | 724 } |
720 | 725 |
721 void RenderViewHostImpl::DragSourceEndedAt( | 726 void RenderViewHostImpl::DragSourceEndedAt( |
722 int client_x, int client_y, int screen_x, int screen_y, | 727 int client_x, int client_y, int screen_x, int screen_y, |
723 WebDragOperation operation) { | 728 WebDragOperation operation) { |
724 Send(new DragMsg_SourceEnded(GetRoutingID(), | 729 const gfx::Point client_pt_in_viewport = |
725 gfx::Point(client_x, client_y), | 730 convertDipToViewport(gfx::Point(client_x, client_y)); |
726 gfx::Point(screen_x, screen_y), | 731 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport, |
727 operation)); | 732 gfx::Point(screen_x, screen_y), operation)); |
728 } | 733 } |
729 | 734 |
730 void RenderViewHostImpl::DragSourceSystemDragEnded() { | 735 void RenderViewHostImpl::DragSourceSystemDragEnded() { |
731 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); | 736 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); |
732 } | 737 } |
733 | 738 |
734 bool RenderViewHostImpl::Send(IPC::Message* msg) { | 739 bool RenderViewHostImpl::Send(IPC::Message* msg) { |
735 return GetWidget()->Send(msg); | 740 return GetWidget()->Send(msg); |
736 } | 741 } |
737 | 742 |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 weak_factory_.GetWeakPtr())); | 1391 weak_factory_.GetWeakPtr())); |
1387 } else { | 1392 } else { |
1388 render_view_ready_on_process_launch_ = true; | 1393 render_view_ready_on_process_launch_ = true; |
1389 } | 1394 } |
1390 } | 1395 } |
1391 | 1396 |
1392 void RenderViewHostImpl::RenderViewReady() { | 1397 void RenderViewHostImpl::RenderViewReady() { |
1393 delegate_->RenderViewReady(this); | 1398 delegate_->RenderViewReady(this); |
1394 } | 1399 } |
1395 | 1400 |
| 1401 gfx::Point RenderViewHostImpl::convertDipToViewport(const gfx::Point& point) { |
| 1402 float scale = GetWidget()->GetView()->current_device_scale_factor(); |
| 1403 return gfx::Point(point.x() * scale, point.y() * scale); |
| 1404 } |
| 1405 |
1396 } // namespace content | 1406 } // namespace content |
OLD | NEW |