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

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

Issue 1703433002: Move DIP(WIndow) to Viewport conversion code for drag&drop from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 policy->GrantReadFileSystem(renderer_id, filesystem_id); 675 policy->GrantReadFileSystem(renderer_id, filesystem_id);
676 676
677 // Note: We are using the origin URL provided by the sender here. It may be 677 // Note: We are using the origin URL provided by the sender here. It may be
678 // different from the receiver's. 678 // different from the receiver's.
679 filtered_data.file_system_files[i].url = 679 filtered_data.file_system_files[i].url =
680 GURL(storage::GetIsolatedFileSystemRootURIString( 680 GURL(storage::GetIsolatedFileSystemRootURIString(
681 file_system_url.origin(), filesystem_id, std::string()) 681 file_system_url.origin(), filesystem_id, std::string())
682 .append(register_name)); 682 .append(register_name));
683 } 683 }
684 684
685 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 685 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt,
686 686 screen_pt, operations_allowed,
687 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, 687 key_modifiers));
688 client_pt_in_viewport, screen_pt,
689 operations_allowed, key_modifiers));
690 } 688 }
691 689
692 void RenderViewHostImpl::DragTargetDragOver( 690 void RenderViewHostImpl::DragTargetDragOver(
693 const gfx::Point& client_pt, 691 const gfx::Point& client_pt,
694 const gfx::Point& screen_pt, 692 const gfx::Point& screen_pt,
695 WebDragOperationsMask operations_allowed, 693 WebDragOperationsMask operations_allowed,
696 int key_modifiers) { 694 int key_modifiers) {
697 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 695 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt,
698 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport, 696 operations_allowed, key_modifiers));
699 screen_pt, operations_allowed,
700 key_modifiers));
701 } 697 }
702 698
703 void RenderViewHostImpl::DragTargetDragLeave() { 699 void RenderViewHostImpl::DragTargetDragLeave() {
704 Send(new DragMsg_TargetDragLeave(GetRoutingID())); 700 Send(new DragMsg_TargetDragLeave(GetRoutingID()));
705 } 701 }
706 702
707 void RenderViewHostImpl::DragTargetDrop( 703 void RenderViewHostImpl::DragTargetDrop(
708 const gfx::Point& client_pt, 704 const gfx::Point& client_pt,
709 const gfx::Point& screen_pt, 705 const gfx::Point& screen_pt,
710 int key_modifiers) { 706 int key_modifiers) {
711 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt); 707 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt,
712 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt,
713 key_modifiers)); 708 key_modifiers));
714 } 709 }
715 710
716 void RenderViewHostImpl::DragSourceEndedAt( 711 void RenderViewHostImpl::DragSourceEndedAt(
717 int client_x, int client_y, int screen_x, int screen_y, 712 int client_x, int client_y, int screen_x, int screen_y,
718 WebDragOperation operation) { 713 WebDragOperation operation) {
719 const gfx::Point client_pt_in_viewport = 714 Send(new DragMsg_SourceEnded(GetRoutingID(),
720 ConvertDIPToViewport(gfx::Point(client_x, client_y)); 715 gfx::Point(client_x, client_y),
721 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport, 716 gfx::Point(screen_x, screen_y),
722 gfx::Point(screen_x, screen_y), operation)); 717 operation));
723 } 718 }
724 719
725 void RenderViewHostImpl::DragSourceSystemDragEnded() { 720 void RenderViewHostImpl::DragSourceSystemDragEnded() {
726 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); 721 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID()));
727 } 722 }
728 723
729 bool RenderViewHostImpl::Send(IPC::Message* msg) { 724 bool RenderViewHostImpl::Send(IPC::Message* msg) {
730 return GetWidget()->Send(msg); 725 return GetWidget()->Send(msg);
731 } 726 }
732 727
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 weak_factory_.GetWeakPtr())); 1356 weak_factory_.GetWeakPtr()));
1362 } else { 1357 } else {
1363 render_view_ready_on_process_launch_ = true; 1358 render_view_ready_on_process_launch_ = true;
1364 } 1359 }
1365 } 1360 }
1366 1361
1367 void RenderViewHostImpl::RenderViewReady() { 1362 void RenderViewHostImpl::RenderViewReady() {
1368 delegate_->RenderViewReady(this); 1363 delegate_->RenderViewReady(this);
1369 } 1364 }
1370 1365
1371 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) {
1372 // The point in guest view is already converted.
1373 if (!render_widget_host_->scale_input_to_viewport())
1374 return point;
1375 float scale = GetWidget()->GetView()->current_device_scale_factor();
1376 return gfx::Point(point.x() * scale, point.y() * scale);
1377 }
1378
1379 } // namespace content 1366 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698