Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 10174009: Plumb drag image offset WebContentsViewAura. This was somehow left out in the TabContentsViewAura r… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/renderer_host/render_view_host_factory.h" 8 #include "content/browser/renderer_host/render_view_host_factory.h"
9 #include "content/browser/web_contents/interstitial_page_impl.h" 9 #include "content/browser/web_contents/interstitial_page_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 const WebDropData& drop_data, 419 const WebDropData& drop_data,
420 WebKit::WebDragOperationsMask operations, 420 WebKit::WebDragOperationsMask operations,
421 const SkBitmap& image, 421 const SkBitmap& image,
422 const gfx::Point& image_offset) { 422 const gfx::Point& image_offset) {
423 aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); 423 aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
424 if (!aura::client::GetDragDropClient(root_window)) 424 if (!aura::client::GetDragDropClient(root_window))
425 return; 425 return;
426 426
427 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura; 427 ui::OSExchangeDataProviderAura* provider = new ui::OSExchangeDataProviderAura;
428 PrepareDragData(drop_data, provider); 428 PrepareDragData(drop_data, provider);
429 if (!image.isNull()) 429 if (!image.isNull()) {
430 provider->set_drag_image(image); 430 provider->set_drag_image(image);
431 provider->set_drag_image_offset(image_offset);
432 }
431 ui::OSExchangeData data(provider); // takes ownership of |provider|. 433 ui::OSExchangeData data(provider); // takes ownership of |provider|.
432 434
433 scoped_ptr<WebDragSourceAura> drag_source( 435 scoped_ptr<WebDragSourceAura> drag_source(
434 new WebDragSourceAura(web_contents_)); 436 new WebDragSourceAura(web_contents_));
435 437
436 // We need to enable recursive tasks on the message loop so we can get 438 // We need to enable recursive tasks on the message loop so we can get
437 // updates while in the system DoDragDrop loop. 439 // updates while in the system DoDragDrop loop.
438 int result_op = 0; 440 int result_op = 0;
439 { 441 {
440 // TODO(sad): Avoid using last_mouse_location here, since the drag may not 442 // TODO(sad): Avoid using last_mouse_location here, since the drag may not
441 // always start from a mouse-event (e.g. a touch or gesture event could 443 // always start from a mouse-event (e.g. a touch or gesture event could
442 // initiate the drag). The location information should be carried over from 444 // initiate the drag). The location information should be carried over from
443 // webkit. http://crbug.com/114754 445 // webkit. http://crbug.com/114754
444 gfx::Point location(root_window->last_mouse_location()); 446 gfx::Point location(root_window->last_mouse_location());
445 location.Offset(-image_offset.x(), -image_offset.y());
446 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 447 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
447 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( 448 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
448 data, location, ConvertFromWeb(operations)); 449 data, location, ConvertFromWeb(operations));
449 } 450 }
450 451
451 EndDrag(ConvertToWeb(result_op)); 452 EndDrag(ConvertToWeb(result_op));
452 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();} 453 web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();}
453 454
454 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) { 455 void WebContentsViewAura::UpdateDragCursor(WebKit::WebDragOperation operation) {
455 current_drag_op_ = operation; 456 current_drag_op_ = operation;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 592 }
592 593
593 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) { 594 int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) {
594 web_contents_->GetRenderViewHost()->DragTargetDrop( 595 web_contents_->GetRenderViewHost()->DragTargetDrop(
595 event.location(), 596 event.location(),
596 GetNativeView()->GetRootWindow()->last_mouse_location()); 597 GetNativeView()->GetRootWindow()->last_mouse_location());
597 if (GetDragDestDelegate()) 598 if (GetDragDestDelegate())
598 GetDragDestDelegate()->OnDrop(); 599 GetDragDestDelegate()->OnDrop();
599 return current_drag_op_; 600 return current_drag_op_;
600 } 601 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698