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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 420 |
421 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { | 421 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { |
422 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). | 422 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). |
423 return false; | 423 return false; |
424 } | 424 } |
425 | 425 |
426 private: | 426 private: |
427 blink::WebWidget* webwidget_; | 427 blink::WebWidget* webwidget_; |
428 }; | 428 }; |
429 | 429 |
| 430 WebDragData DropMetaDataToWebDragData( |
| 431 const std::vector<MimeTypeKindPair>& drop_meta_data) { |
| 432 std::vector<WebDragData::Item> item_list; |
| 433 for (const auto& pair : drop_meta_data) { |
| 434 if (pair.second == STRING_KIND) { |
| 435 WebDragData::Item item; |
| 436 item.storageType = WebDragData::Item::StorageTypeString; |
| 437 item.stringType = pair.first; |
| 438 item_list.push_back(item); |
| 439 continue; |
| 440 } |
| 441 |
| 442 if (pair.second == FILENAME_KIND) { |
| 443 WebDragData::Item item; |
| 444 item.storageType = WebDragData::Item::StorageTypeFilename; |
| 445 item_list.push_back(item); |
| 446 continue; |
| 447 } |
| 448 |
| 449 if (pair.second == FILESYSTEMFILE_KIND) { |
| 450 WebDragData::Item item; |
| 451 item.storageType = WebDragData::Item::StorageTypeFileSystemFile; |
| 452 item_list.push_back(item); |
| 453 continue; |
| 454 } |
| 455 } |
| 456 |
| 457 WebDragData result; |
| 458 result.initialize(); |
| 459 result.setItems(item_list); |
| 460 return result; |
| 461 } |
| 462 |
430 WebDragData DropDataToWebDragData(const DropData& drop_data) { | 463 WebDragData DropDataToWebDragData(const DropData& drop_data) { |
431 std::vector<WebDragData::Item> item_list; | 464 std::vector<WebDragData::Item> item_list; |
432 | 465 |
433 // These fields are currently unused when dragging into WebKit. | 466 // These fields are currently unused when dragging into WebKit. |
434 DCHECK(drop_data.download_metadata.empty()); | 467 DCHECK(drop_data.download_metadata.empty()); |
435 DCHECK(drop_data.file_contents.empty()); | 468 DCHECK(drop_data.file_contents.empty()); |
436 DCHECK(drop_data.file_description_filename.empty()); | 469 DCHECK(drop_data.file_description_filename.empty()); |
437 | 470 |
438 if (!drop_data.text.is_null()) { | 471 if (!drop_data.text.is_null()) { |
439 WebDragData::Item item; | 472 WebDragData::Item item; |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 | 2477 |
2445 enabled_bindings_ |= enabled_bindings_flags; | 2478 enabled_bindings_ |= enabled_bindings_flags; |
2446 | 2479 |
2447 // Keep track of the total bindings accumulated in this process. | 2480 // Keep track of the total bindings accumulated in this process. |
2448 RenderProcess::current()->AddBindings(enabled_bindings_flags); | 2481 RenderProcess::current()->AddBindings(enabled_bindings_flags); |
2449 | 2482 |
2450 if (main_render_frame_) | 2483 if (main_render_frame_) |
2451 main_render_frame_->MaybeEnableMojoBindings(); | 2484 main_render_frame_->MaybeEnableMojoBindings(); |
2452 } | 2485 } |
2453 | 2486 |
2454 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, | 2487 void RenderViewImpl::OnDragTargetDragEnter( |
2455 const gfx::Point& client_point, | 2488 const std::vector<MimeTypeKindPair>& drop_meta_data, |
2456 const gfx::Point& screen_point, | 2489 const gfx::Point& client_point, |
2457 WebDragOperationsMask ops, | 2490 const gfx::Point& screen_point, |
2458 int key_modifiers) { | 2491 WebDragOperationsMask ops, |
| 2492 int key_modifiers) { |
2459 WebDragOperation operation = webview()->dragTargetDragEnter( | 2493 WebDragOperation operation = webview()->dragTargetDragEnter( |
2460 DropDataToWebDragData(drop_data), | 2494 DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point, |
2461 ConvertWindowPointToViewport(client_point), | 2495 ops, key_modifiers); |
2462 screen_point, | |
2463 ops, | |
2464 key_modifiers); | |
2465 | 2496 |
2466 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2497 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2467 } | 2498 } |
2468 | 2499 |
2469 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, | 2500 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, |
2470 const gfx::Point& screen_point, | 2501 const gfx::Point& screen_point, |
2471 WebDragOperationsMask ops, | 2502 WebDragOperationsMask ops, |
2472 int key_modifiers) { | 2503 int key_modifiers) { |
2473 WebDragOperation operation = webview()->dragTargetDragOver( | 2504 WebDragOperation operation = webview()->dragTargetDragOver( |
2474 ConvertWindowPointToViewport(client_point), | 2505 ConvertWindowPointToViewport(client_point), |
2475 screen_point, | 2506 screen_point, |
2476 ops, | 2507 ops, |
2477 key_modifiers); | 2508 key_modifiers); |
2478 | 2509 |
2479 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2510 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2480 } | 2511 } |
2481 | 2512 |
2482 void RenderViewImpl::OnDragTargetDragLeave() { | 2513 void RenderViewImpl::OnDragTargetDragLeave() { |
2483 webview()->dragTargetDragLeave(); | 2514 webview()->dragTargetDragLeave(); |
2484 } | 2515 } |
2485 | 2516 |
2486 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, | 2517 void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data, |
| 2518 const gfx::Point& client_point, |
2487 const gfx::Point& screen_point, | 2519 const gfx::Point& screen_point, |
2488 int key_modifiers) { | 2520 int key_modifiers) { |
2489 webview()->dragTargetDrop( | 2521 webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point, |
2490 ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); | 2522 screen_point, key_modifiers); |
2491 } | 2523 } |
2492 | 2524 |
2493 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, | 2525 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |
2494 const gfx::Point& screen_point, | 2526 const gfx::Point& screen_point, |
2495 WebDragOperation op) { | 2527 WebDragOperation op) { |
2496 webview()->dragSourceEndedAt( | 2528 webview()->dragSourceEndedAt( |
2497 ConvertWindowPointToViewport(client_point), screen_point, op); | 2529 ConvertWindowPointToViewport(client_point), screen_point, op); |
2498 } | 2530 } |
2499 | 2531 |
2500 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2532 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 if (IsUseZoomForDSFEnabled()) { | 3460 if (IsUseZoomForDSFEnabled()) { |
3429 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3461 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3430 } else { | 3462 } else { |
3431 webview()->setDeviceScaleFactor(device_scale_factor_); | 3463 webview()->setDeviceScaleFactor(device_scale_factor_); |
3432 } | 3464 } |
3433 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3465 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3434 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3466 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3435 } | 3467 } |
3436 | 3468 |
3437 } // namespace content | 3469 } // namespace content |
OLD | NEW |