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