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) { | |
Avi (use Gerrit)
2016/04/12 02:51:51
const vector?
Did you mean const vector&?
hush (inactive)
2016/04/12 20:36:57
Yes, done
| |
432 std::vector<WebDragData::Item> item_list; | |
433 for (MimeTypeKindPair 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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2310 | 2343 |
2311 enabled_bindings_ |= enabled_bindings_flags; | 2344 enabled_bindings_ |= enabled_bindings_flags; |
2312 | 2345 |
2313 // Keep track of the total bindings accumulated in this process. | 2346 // Keep track of the total bindings accumulated in this process. |
2314 RenderProcess::current()->AddBindings(enabled_bindings_flags); | 2347 RenderProcess::current()->AddBindings(enabled_bindings_flags); |
2315 | 2348 |
2316 if (main_render_frame_) | 2349 if (main_render_frame_) |
2317 main_render_frame_->MaybeEnableMojoBindings(); | 2350 main_render_frame_->MaybeEnableMojoBindings(); |
2318 } | 2351 } |
2319 | 2352 |
2320 void RenderViewImpl::OnDragTargetDragEnter(const DropData& drop_data, | 2353 void RenderViewImpl::OnDragTargetDragEnter( |
2321 const gfx::Point& client_point, | 2354 const std::vector<MimeTypeKindPair> drop_meta_data, |
Avi (use Gerrit)
2016/04/12 02:51:51
const vector&?
hush (inactive)
2016/04/12 20:36:57
Done.
| |
2322 const gfx::Point& screen_point, | 2355 const gfx::Point& client_point, |
2323 WebDragOperationsMask ops, | 2356 const gfx::Point& screen_point, |
2324 int key_modifiers) { | 2357 WebDragOperationsMask ops, |
2358 int key_modifiers) { | |
2325 WebDragOperation operation = webview()->dragTargetDragEnter( | 2359 WebDragOperation operation = webview()->dragTargetDragEnter( |
2326 DropDataToWebDragData(drop_data), | 2360 DropMetaDataToWebDragData(drop_meta_data), client_point, screen_point, |
2327 ConvertWindowPointToViewport(client_point), | 2361 ops, key_modifiers); |
2328 screen_point, | |
2329 ops, | |
2330 key_modifiers); | |
2331 | 2362 |
2332 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2363 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2333 } | 2364 } |
2334 | 2365 |
2335 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, | 2366 void RenderViewImpl::OnDragTargetDragOver(const gfx::Point& client_point, |
2336 const gfx::Point& screen_point, | 2367 const gfx::Point& screen_point, |
2337 WebDragOperationsMask ops, | 2368 WebDragOperationsMask ops, |
2338 int key_modifiers) { | 2369 int key_modifiers) { |
2339 WebDragOperation operation = webview()->dragTargetDragOver( | 2370 WebDragOperation operation = webview()->dragTargetDragOver( |
2340 ConvertWindowPointToViewport(client_point), | 2371 ConvertWindowPointToViewport(client_point), |
2341 screen_point, | 2372 screen_point, |
2342 ops, | 2373 ops, |
2343 key_modifiers); | 2374 key_modifiers); |
2344 | 2375 |
2345 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); | 2376 Send(new DragHostMsg_UpdateDragCursor(GetRoutingID(), operation)); |
2346 } | 2377 } |
2347 | 2378 |
2348 void RenderViewImpl::OnDragTargetDragLeave() { | 2379 void RenderViewImpl::OnDragTargetDragLeave() { |
2349 webview()->dragTargetDragLeave(); | 2380 webview()->dragTargetDragLeave(); |
2350 } | 2381 } |
2351 | 2382 |
2352 void RenderViewImpl::OnDragTargetDrop(const gfx::Point& client_point, | 2383 void RenderViewImpl::OnDragTargetDrop(const DropData& drop_data, |
2384 const gfx::Point& client_point, | |
2353 const gfx::Point& screen_point, | 2385 const gfx::Point& screen_point, |
2354 int key_modifiers) { | 2386 int key_modifiers) { |
2355 webview()->dragTargetDrop( | 2387 webview()->dragTargetDrop(DropDataToWebDragData(drop_data), client_point, |
2356 ConvertWindowPointToViewport(client_point), screen_point, key_modifiers); | 2388 screen_point, key_modifiers); |
2357 } | 2389 } |
2358 | 2390 |
2359 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, | 2391 void RenderViewImpl::OnDragSourceEnded(const gfx::Point& client_point, |
2360 const gfx::Point& screen_point, | 2392 const gfx::Point& screen_point, |
2361 WebDragOperation op) { | 2393 WebDragOperation op) { |
2362 webview()->dragSourceEndedAt( | 2394 webview()->dragSourceEndedAt( |
2363 ConvertWindowPointToViewport(client_point), screen_point, op); | 2395 ConvertWindowPointToViewport(client_point), screen_point, op); |
2364 } | 2396 } |
2365 | 2397 |
2366 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2398 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3299 if (IsUseZoomForDSFEnabled()) { | 3331 if (IsUseZoomForDSFEnabled()) { |
3300 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3332 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
3301 } else { | 3333 } else { |
3302 webview()->setDeviceScaleFactor(device_scale_factor_); | 3334 webview()->setDeviceScaleFactor(device_scale_factor_); |
3303 } | 3335 } |
3304 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3336 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3305 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3337 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
3306 } | 3338 } |
3307 | 3339 |
3308 } // namespace content | 3340 } // namespace content |
OLD | NEW |