Chromium Code Reviews| 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 item_list.push_back(item); | |
| 438 continue; | |
| 439 } | |
| 440 | |
| 441 if (pair.second == base::ASCIIToUTF16("filename")) { | |
| 442 WebDragData::Item item; | |
| 443 item.storageType = WebDragData::Item::StorageTypeFilename; | |
| 444 item_list.push_back(item); | |
| 445 continue; | |
| 446 } | |
| 447 | |
| 448 if (pair.second == base::ASCIIToUTF16("filesystemfile")) { | |
|
Avi (use Gerrit)
2016/04/08 21:24:08
I very much dislike the idea of matching up string
hush (inactive)
2016/04/12 00:07:49
I will use an enum type, defined in drop_data.h, w
| |
| 449 WebDragData::Item item; | |
| 450 item.storageType = WebDragData::Item::StorageTypeFileSystemFile; | |
| 451 item_list.push_back(item); | |
| 452 continue; | |
| 453 } | |
| 454 } | |
| 455 | |
| 456 WebDragData result; | |
| 457 result.initialize(); | |
| 458 result.setItems(item_list); | |
| 459 return result; | |
| 460 } | |
| 461 | |
| 429 WebDragData DropDataToWebDragData(const DropData& drop_data) { | 462 WebDragData DropDataToWebDragData(const DropData& drop_data) { |
| 430 std::vector<WebDragData::Item> item_list; | 463 std::vector<WebDragData::Item> item_list; |
| 431 | 464 |
| 432 // These fields are currently unused when dragging into WebKit. | 465 // These fields are currently unused when dragging into WebKit. |
| 433 DCHECK(drop_data.download_metadata.empty()); | 466 DCHECK(drop_data.download_metadata.empty()); |
| 434 DCHECK(drop_data.file_contents.empty()); | 467 DCHECK(drop_data.file_contents.empty()); |
| 435 DCHECK(drop_data.file_description_filename.empty()); | 468 DCHECK(drop_data.file_description_filename.empty()); |
| 436 | 469 |
| 437 if (!drop_data.text.is_null()) { | 470 if (!drop_data.text.is_null()) { |
| 438 WebDragData::Item item; | 471 WebDragData::Item item; |
| (...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2329 | 2362 |
| 2330 enabled_bindings_ |= enabled_bindings_flags; | 2363 enabled_bindings_ |= enabled_bindings_flags; |
| 2331 | 2364 |
| 2332 // Keep track of the total bindings accumulated in this process. | 2365 // Keep track of the total bindings accumulated in this process. |
| 2333 RenderProcess::current()->AddBindings(enabled_bindings_flags); | 2366 RenderProcess::current()->AddBindings(enabled_bindings_flags); |
| 2334 | 2367 |
| 2335 if (main_render_frame_) | 2368 if (main_render_frame_) |
| 2336 main_render_frame_->MaybeEnableMojoBindings(); | 2369 main_render_frame_->MaybeEnableMojoBindings(); |
| 2337 } | 2370 } |
| 2338 | 2371 |
| 2339 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, | 2372 void RenderViewImpl::OnDragTargetDragEnter( |
| 2340 const gfx::Point& client_point, | 2373 const std::vector<MimeTypeKindPair> drop_meta_data, |
| 2341 const gfx::Point& screen_point, | 2374 const gfx::Point& client_point, |
| 2342 WebDragOperationsMask ops, | 2375 const gfx::Point& screen_point, |
| 2343 int key_modifiers) { | 2376 WebDragOperationsMask ops, |
| 2377 int key_modifiers) { | |
| 2344 WebDragOperation operation = webview()->dragTargetDragEnter( | 2378 WebDragOperation operation = webview()->dragTargetDragEnter( |
| 2345 DropDataToWebDragData(drop_data), | 2379 DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point, |
| 2346 ConvertWindowPointToViewport(client_point), | 2380 ops, key_modifiers); |
| 2347 screen_point, | |
| 2348 ops, | |
| 2349 key_modifiers); | |
| 2350 | 2381 |
| 2351 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2382 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
| 2352 } | 2383 } |
| 2353 | 2384 |
| 2354 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, | 2385 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, |
| 2355 const gfx::Point& screen_point, | 2386 const gfx::Point& screen_point, |
| 2356 WebDragOperationsMask ops, | 2387 WebDragOperationsMask ops, |
| 2357 int key_modifiers) { | 2388 int key_modifiers) { |
| 2358 WebDragOperation operation = webview()->dragTargetDragOver( | 2389 WebDragOperation operation = webview()->dragTargetDragOver( |
| 2359 ConvertWindowPointToViewport(client_point), | 2390 ConvertWindowPointToViewport(client_point), |
| 2360 screen_point, | 2391 screen_point, |
| 2361 ops, | 2392 ops, |
| 2362 key_modifiers); | 2393 key_modifiers); |
| 2363 | 2394 |
| 2364 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2395 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
| 2365 } | 2396 } |
| 2366 | 2397 |
| 2367 void RenderViewImpl::OnDragTargetDragLeave() { | 2398 void RenderViewImpl::OnDragTargetDragLeave() { |
| 2368 webview()->dragTargetDragLeave(); | 2399 webview()->dragTargetDragLeave(); |
| 2369 } | 2400 } |
| 2370 | 2401 |
| 2371 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, | 2402 void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data, |
| 2403 const gfx::Point& client_point, | |
| 2372 const gfx::Point& screen_point, | 2404 const gfx::Point& screen_point, |
| 2373 int key_modifiers) { | 2405 int key_modifiers) { |
| 2374 webview()->dragTargetDrop( | 2406 webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point, |
| 2375 ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); | 2407 screen_point, key_modifiers); |
| 2376 } | 2408 } |
| 2377 | 2409 |
| 2378 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, | 2410 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |
| 2379 const gfx::Point& screen_point, | 2411 const gfx::Point& screen_point, |
| 2380 WebDragOperation op) { | 2412 WebDragOperation op) { |
| 2381 webview()->dragSourceEndedAt( | 2413 webview()->dragSourceEndedAt( |
| 2382 ConvertWindowPointToViewport(client_point), screen_point, op); | 2414 ConvertWindowPointToViewport(client_point), screen_point, op); |
| 2383 } | 2415 } |
| 2384 | 2416 |
| 2385 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2417 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3323 if (IsUseZoomForDSFEnabled()) { | 3355 if (IsUseZoomForDSFEnabled()) { |
| 3324 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3356 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3325 } else { | 3357 } else { |
| 3326 webview()->setDeviceScaleFactor(device_scale_factor_); | 3358 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3327 } | 3359 } |
| 3328 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3360 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3329 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3361 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3330 } | 3362 } |
| 3331 | 3363 |
| 3332 } // namespace content | 3364 } // namespace content |
| OLD | NEW |