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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 419 |
420 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { | 420 bool HandleMouseLockedInputEvent(const blink::WebMouseEvent& event) override { |
421 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). | 421 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). |
422 return false; | 422 return false; |
423 } | 423 } |
424 | 424 |
425 private: | 425 private: |
426 blink::WebWidget* webwidget_; | 426 blink::WebWidget* webwidget_; |
427 }; | 427 }; |
428 | 428 |
| 429 WebDragData DropMetaDataToWebDragData( |
| 430 const std::vector<MimeTypeKindPair> drop_meta_data) { |
| 431 std::vector<WebDragData::Item> item_list; |
| 432 for (MimeTypeKindPair pair : drop_meta_data) { |
| 433 if (pair.second == base::ASCIIToUTF16("string")) { |
| 434 WebDragData::Item item; |
| 435 item.storageType = WebDragData::Item::StorageTypeString; |
| 436 item.stringType = pair.first; |
| 437 continue; |
| 438 } |
| 439 |
| 440 if (pair.second == base::ASCIIToUTF16("filename")) { |
| 441 WebDragData::Item item; |
| 442 item.storageType = WebDragData::Item::StorageTypeFilename; |
| 443 continue; |
| 444 } |
| 445 |
| 446 if (pair.second == base::ASCIIToUTF16("filesystemfile")) { |
| 447 WebDragData::Item item; |
| 448 item.storageType = WebDragData::Item::StorageTypeFileSystemFile; |
| 449 |
| 450 continue; |
| 451 } |
| 452 } |
| 453 |
| 454 WebDragData result; |
| 455 result.initialize(); |
| 456 result.setItems(item_list); |
| 457 return result; |
| 458 } |
| 459 |
429 WebDragData DropDataToWebDragData(const DropData& drop_data) { | 460 WebDragData DropDataToWebDragData(const DropData& drop_data) { |
430 std::vector<WebDragData::Item> item_list; | 461 std::vector<WebDragData::Item> item_list; |
431 | 462 |
432 // These fields are currently unused when dragging into WebKit. | 463 // These fields are currently unused when dragging into WebKit. |
433 DCHECK(drop_data.download_metadata.empty()); | 464 DCHECK(drop_data.download_metadata.empty()); |
434 DCHECK(drop_data.file_contents.empty()); | 465 DCHECK(drop_data.file_contents.empty()); |
435 DCHECK(drop_data.file_description_filename.empty()); | 466 DCHECK(drop_data.file_description_filename.empty()); |
436 | 467 |
437 if (!drop_data.text.is_null()) { | 468 if (!drop_data.text.is_null()) { |
438 WebDragData::Item item; | 469 WebDragData::Item item; |
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 | 2360 |
2330 enabled_bindings_ |= enabled_bindings_flags; | 2361 enabled_bindings_ |= enabled_bindings_flags; |
2331 | 2362 |
2332 // Keep track of the total bindings accumulated in this process. | 2363 // Keep track of the total bindings accumulated in this process. |
2333 RenderProcess::current()->AddBindings(enabled_bindings_flags); | 2364 RenderProcess::current()->AddBindings(enabled_bindings_flags); |
2334 | 2365 |
2335 if (main_render_frame_) | 2366 if (main_render_frame_) |
2336 main_render_frame_->MaybeEnableMojoBindings(); | 2367 main_render_frame_->MaybeEnableMojoBindings(); |
2337 } | 2368 } |
2338 | 2369 |
2339 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, | 2370 void RenderViewImpl::OnDragTargetDragEnter( |
2340 const gfx::Point& client_point, | 2371 const std::vector<MimeTypeKindPair> drop_meta_data, |
2341 const gfx::Point& screen_point, | 2372 const gfx::Point& client_point, |
2342 WebDragOperationsMask ops, | 2373 const gfx::Point& screen_point, |
2343 int key_modifiers) { | 2374 WebDragOperationsMask ops, |
| 2375 int key_modifiers) { |
2344 WebDragOperation operation = webview()->dragTargetDragEnter( | 2376 WebDragOperation operation = webview()->dragTargetDragEnter( |
2345 DropDataToWebDragData(drop_data), | 2377 DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point, |
2346 ConvertWindowPointToViewport(client_point), | 2378 ops, key_modifiers); |
2347 screen_point, | |
2348 ops, | |
2349 key_modifiers); | |
2350 | 2379 |
2351 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2380 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2352 } | 2381 } |
2353 | 2382 |
2354 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, | 2383 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, |
2355 const gfx::Point& screen_point, | 2384 const gfx::Point& screen_point, |
2356 WebDragOperationsMask ops, | 2385 WebDragOperationsMask ops, |
2357 int key_modifiers) { | 2386 int key_modifiers) { |
2358 WebDragOperation operation = webview()->dragTargetDragOver( | 2387 WebDragOperation operation = webview()->dragTargetDragOver( |
2359 ConvertWindowPointToViewport(client_point), | 2388 ConvertWindowPointToViewport(client_point), |
2360 screen_point, | 2389 screen_point, |
2361 ops, | 2390 ops, |
2362 key_modifiers); | 2391 key_modifiers); |
2363 | 2392 |
2364 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2393 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2365 } | 2394 } |
2366 | 2395 |
2367 void RenderViewImpl::OnDragTargetDragLeave() { | 2396 void RenderViewImpl::OnDragTargetDragLeave() { |
2368 webview()->dragTargetDragLeave(); | 2397 webview()->dragTargetDragLeave(); |
2369 } | 2398 } |
2370 | 2399 |
2371 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, | 2400 void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data, |
| 2401 const gfx::Point& client_point, |
2372 const gfx::Point& screen_point, | 2402 const gfx::Point& screen_point, |
2373 int key_modifiers) { | 2403 int key_modifiers) { |
2374 webview()->dragTargetDrop( | 2404 webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point, |
2375 ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); | 2405 screen_point, key_modifiers); |
2376 } | 2406 } |
2377 | 2407 |
2378 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, | 2408 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |
2379 const gfx::Point& screen_point, | 2409 const gfx::Point& screen_point, |
2380 WebDragOperation op) { | 2410 WebDragOperation op) { |
2381 webview()->dragSourceEndedAt( | 2411 webview()->dragSourceEndedAt( |
2382 ConvertWindowPointToViewport(client_point), screen_point, op); | 2412 ConvertWindowPointToViewport(client_point), screen_point, op); |
2383 } | 2413 } |
2384 | 2414 |
2385 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2415 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 if (IsUseZoomForDSFEnabled()) { | 3353 if (IsUseZoomForDSFEnabled()) { |
3324 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3354 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3325 } else { | 3355 } else { |
3326 webview()->setDeviceScaleFactor(device_scale_factor_); | 3356 webview()->setDeviceScaleFactor(device_scale_factor_); |
3327 } | 3357 } |
3328 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3358 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3329 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3359 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3330 } | 3360 } |
3331 | 3361 |
3332 } // namespace content | 3362 } // namespace content |
OLD | NEW |