| 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_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 const gfx::Point& client_pt, | 1372 const gfx::Point& client_pt, |
| 1373 const gfx::Point& screen_pt, | 1373 const gfx::Point& screen_pt, |
| 1374 int key_modifiers) { | 1374 int key_modifiers) { |
| 1375 DropData drop_data_with_permissions(drop_data); | 1375 DropData drop_data_with_permissions(drop_data); |
| 1376 GrantFileAccessFromDropData(&drop_data_with_permissions); | 1376 GrantFileAccessFromDropData(&drop_data_with_permissions); |
| 1377 Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data_with_permissions, | 1377 Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data_with_permissions, |
| 1378 client_pt, screen_pt, key_modifiers)); | 1378 client_pt, screen_pt, key_modifiers)); |
| 1379 } | 1379 } |
| 1380 | 1380 |
| 1381 void RenderWidgetHostImpl::DragSourceEndedAt( | 1381 void RenderWidgetHostImpl::DragSourceEndedAt( |
| 1382 int client_x, int client_y, int screen_x, int screen_y, | 1382 const gfx::Point& client_pt, |
| 1383 const gfx::Point& screen_pt, |
| 1383 blink::WebDragOperation operation) { | 1384 blink::WebDragOperation operation) { |
| 1384 Send(new DragMsg_SourceEnded(GetRoutingID(), | 1385 Send(new DragMsg_SourceEnded(GetRoutingID(), |
| 1385 gfx::Point(client_x, client_y), | 1386 client_pt, |
| 1386 gfx::Point(screen_x, screen_y), | 1387 screen_pt, |
| 1387 operation)); | 1388 operation)); |
| 1388 } | 1389 } |
| 1389 | 1390 |
| 1390 void RenderWidgetHostImpl::DragSourceSystemDragEnded() { | 1391 void RenderWidgetHostImpl::DragSourceSystemDragEnded() { |
| 1391 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); | 1392 Send(new DragMsg_SourceSystemDragEnded(GetRoutingID())); |
| 1392 } | 1393 } |
| 1393 | 1394 |
| 1394 void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { | 1395 void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { |
| 1395 #if DCHECK_IS_ON() | 1396 #if DCHECK_IS_ON() |
| 1396 drop_data->view_id = GetRoutingID(); | 1397 drop_data->view_id = GetRoutingID(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 if (view_) | 1470 if (view_) |
| 1470 view_->SetNeedsBeginFrames(needs_begin_frames); | 1471 view_->SetNeedsBeginFrames(needs_begin_frames); |
| 1471 } | 1472 } |
| 1472 | 1473 |
| 1473 void RenderWidgetHostImpl::OnStartDragging( | 1474 void RenderWidgetHostImpl::OnStartDragging( |
| 1474 const DropData& drop_data, | 1475 const DropData& drop_data, |
| 1475 blink::WebDragOperationsMask drag_operations_mask, | 1476 blink::WebDragOperationsMask drag_operations_mask, |
| 1476 const SkBitmap& bitmap, | 1477 const SkBitmap& bitmap, |
| 1477 const gfx::Vector2d& bitmap_offset_in_dip, | 1478 const gfx::Vector2d& bitmap_offset_in_dip, |
| 1478 const DragEventSourceInfo& event_info) { | 1479 const DragEventSourceInfo& event_info) { |
| 1479 // TODO(paulmeyer): Stop relying on RenderViewHost once | |
| 1480 // DragSourceSystemDragEnded is moved into RenderWidgetHost. See | |
| 1481 // crbug.com/647249. | |
| 1482 RenderViewHost* rvh = RenderViewHost::From(this); | |
| 1483 if (!rvh) | |
| 1484 return; | |
| 1485 | |
| 1486 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1480 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
| 1487 if (!view) { | 1481 if (!view) { |
| 1488 // Need to clear drag and drop state in blink. | 1482 // Need to clear drag and drop state in blink. |
| 1489 DragSourceSystemDragEnded(); | 1483 DragSourceSystemDragEnded(); |
| 1490 return; | 1484 return; |
| 1491 } | 1485 } |
| 1492 | 1486 |
| 1493 DropData filtered_data(drop_data); | 1487 DropData filtered_data(drop_data); |
| 1494 RenderProcessHost* process = GetProcess(); | 1488 RenderProcessHost* process = GetProcess(); |
| 1495 ChildProcessSecurityPolicyImpl* policy = | 1489 ChildProcessSecurityPolicyImpl* policy = |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1519 for (size_t i = 0; i < drop_data.file_system_files.size(); ++i) { | 1513 for (size_t i = 0; i < drop_data.file_system_files.size(); ++i) { |
| 1520 storage::FileSystemURL file_system_url = | 1514 storage::FileSystemURL file_system_url = |
| 1521 file_system_context->CrackURL(drop_data.file_system_files[i].url); | 1515 file_system_context->CrackURL(drop_data.file_system_files[i].url); |
| 1522 if (policy->CanReadFileSystemFile(GetProcess()->GetID(), file_system_url)) | 1516 if (policy->CanReadFileSystemFile(GetProcess()->GetID(), file_system_url)) |
| 1523 filtered_data.file_system_files.push_back(drop_data.file_system_files[i]); | 1517 filtered_data.file_system_files.push_back(drop_data.file_system_files[i]); |
| 1524 } | 1518 } |
| 1525 | 1519 |
| 1526 float scale = GetScaleFactorForView(GetView()); | 1520 float scale = GetScaleFactorForView(GetView()); |
| 1527 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, scale)); | 1521 gfx::ImageSkia image(gfx::ImageSkiaRep(bitmap, scale)); |
| 1528 view->StartDragging(filtered_data, drag_operations_mask, image, | 1522 view->StartDragging(filtered_data, drag_operations_mask, image, |
| 1529 bitmap_offset_in_dip, event_info); | 1523 bitmap_offset_in_dip, event_info, this); |
| 1530 } | 1524 } |
| 1531 | 1525 |
| 1532 void RenderWidgetHostImpl::OnUpdateDragCursor(WebDragOperation current_op) { | 1526 void RenderWidgetHostImpl::OnUpdateDragCursor(WebDragOperation current_op) { |
| 1533 if (delegate_ && delegate_->OnUpdateDragCursor()) | 1527 if (delegate_ && delegate_->OnUpdateDragCursor()) |
| 1534 return; | 1528 return; |
| 1535 | 1529 |
| 1536 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); | 1530 RenderViewHostDelegateView* view = delegate_->GetDelegateView(); |
| 1537 if (view) | 1531 if (view) |
| 1538 view->UpdateDragCursor(current_op); | 1532 view->UpdateDragCursor(current_op); |
| 1539 } | 1533 } |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 // Note: We are using the origin URL provided by the sender here. It may be | 2483 // Note: We are using the origin URL provided by the sender here. It may be |
| 2490 // different from the receiver's. | 2484 // different from the receiver's. |
| 2491 file_system_file.url = | 2485 file_system_file.url = |
| 2492 GURL(storage::GetIsolatedFileSystemRootURIString( | 2486 GURL(storage::GetIsolatedFileSystemRootURIString( |
| 2493 file_system_url.origin(), filesystem_id, std::string()) | 2487 file_system_url.origin(), filesystem_id, std::string()) |
| 2494 .append(register_name)); | 2488 .append(register_name)); |
| 2495 } | 2489 } |
| 2496 } | 2490 } |
| 2497 | 2491 |
| 2498 } // namespace content | 2492 } // namespace content |
| OLD | NEW |