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

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

Issue 1605143003: [UseZoomForDSF] Support drag&drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added comment Created 4 years, 11 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 policy->GrantReadFileSystem(renderer_id, filesystem_id); 672 policy->GrantReadFileSystem(renderer_id, filesystem_id);
673 673
674 // Note: We are using the origin URL provided by the sender here. It may be 674 // Note: We are using the origin URL provided by the sender here. It may be
675 // different from the receiver's. 675 // different from the receiver's.
676 filtered_data.file_system_files[i].url = 676 filtered_data.file_system_files[i].url =
677 GURL(storage::GetIsolatedFileSystemRootURIString( 677 GURL(storage::GetIsolatedFileSystemRootURIString(
678 file_system_url.origin(), filesystem_id, std::string()) 678 file_system_url.origin(), filesystem_id, std::string())
679 .append(register_name)); 679 .append(register_name));
680 } 680 }
681 681
682 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data, client_pt, 682 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
683 screen_pt, operations_allowed, 683
684 key_modifiers)); 684 Send(new DragMsg_TargetDragEnter(GetRoutingID(), filtered_data,
685 client_pt_in_viewport, screen_pt,
686 operations_allowed, key_modifiers));
685 } 687 }
686 688
687 void RenderViewHostImpl::DragTargetDragOver( 689 void RenderViewHostImpl::DragTargetDragOver(
688 const gfx::Point& client_pt, 690 const gfx::Point& client_pt,
689 const gfx::Point& screen_pt, 691 const gfx::Point& screen_pt,
690 WebDragOperationsMask operations_allowed, 692 WebDragOperationsMask operations_allowed,
691 int key_modifiers) { 693 int key_modifiers) {
692 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt, screen_pt, 694 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
693 operations_allowed, key_modifiers)); 695 Send(new DragMsg_TargetDragOver(GetRoutingID(), client_pt_in_viewport,
696 screen_pt, operations_allowed,
697 key_modifiers));
694 } 698 }
695 699
696 void RenderViewHostImpl::DragTargetDragLeave() { 700 void RenderViewHostImpl::DragTargetDragLeave() {
697 Send(new DragMsg_TargetDragLeave(GetRoutingID())); 701 Send(new DragMsg_TargetDragLeave(GetRoutingID()));
698 } 702 }
699 703
700 void RenderViewHostImpl::DragTargetDrop( 704 void RenderViewHostImpl::DragTargetDrop(
701 const gfx::Point& client_pt, 705 const gfx::Point& client_pt,
702 const gfx::Point& screen_pt, 706 const gfx::Point& screen_pt,
703 int key_modifiers) { 707 int key_modifiers) {
704 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt, screen_pt, 708 const gfx::Point client_pt_in_viewport = ConvertDIPToViewport(client_pt);
709 Send(new DragMsg_TargetDrop(GetRoutingID(), client_pt_in_viewport, screen_pt,
705 key_modifiers)); 710 key_modifiers));
706 } 711 }
707 712
708 void RenderViewHostImpl::DragSourceEndedAt( 713 void RenderViewHostImpl::DragSourceEndedAt(
709 int client_x, int client_y, int screen_x, int screen_y, 714 int client_x, int client_y, int screen_x, int screen_y,
710 WebDragOperation operation) { 715 WebDragOperation operation) {
711 Send(new DragMsg_SourceEnded(GetRoutingID(), 716 const gfx::Point client_pt_in_viewport =
712 gfx::Point(client_x, client_y), 717 ConvertDIPToViewport(gfx::Point(client_x, client_y));
713 gfx::Point(screen_x, screen_y), 718 Send(new DragMsg_SourceEnded(GetRoutingID(), client_pt_in_viewport,
714 operation)); 719 gfx::Point(screen_x, screen_y), operation));
715 } 720 }
716 721
717 void RenderViewHostImpl::DragSourceSystemDragEnded() { 722 void RenderViewHostImpl::DragSourceSystemDragEnded() {
718 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); 723 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID()));
719 } 724 }
720 725
721 bool RenderViewHostImpl::Send(IPC::Message* msg) { 726 bool RenderViewHostImpl::Send(IPC::Message* msg) {
722 return GetWidget()->Send(msg); 727 return GetWidget()->Send(msg);
723 } 728 }
724 729
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 weak_factory_.GetWeakPtr())); 1378 weak_factory_.GetWeakPtr()));
1374 } else { 1379 } else {
1375 render_view_ready_on_process_launch_ = true; 1380 render_view_ready_on_process_launch_ = true;
1376 } 1381 }
1377 } 1382 }
1378 1383
1379 void RenderViewHostImpl::RenderViewReady() { 1384 void RenderViewHostImpl::RenderViewReady() {
1380 delegate_->RenderViewReady(this); 1385 delegate_->RenderViewReady(this);
1381 } 1386 }
1382 1387
1388 gfx::Point RenderViewHostImpl::ConvertDIPToViewport(const gfx::Point& point) {
1389 float scale = GetWidget()->GetView()->current_device_scale_factor();
1390 return gfx::Point(point.x() * scale, point.y() * scale);
1391 }
1392
1383 } // namespace content 1393 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698