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

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

Issue 12086095: Fixed drag and drop into and out of Browser Plugin. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Splitting up patch Created 7 years, 7 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
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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/renderer_host/dip_util.h" 10 #include "content/browser/renderer_host/dip_util.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 case ui::ET_MOUSE_DRAGGED: 301 case ui::ET_MOUSE_DRAGGED:
302 rvh = contents_->GetRenderViewHost(); 302 rvh = contents_->GetRenderViewHost();
303 if (rvh) { 303 if (rvh) {
304 gfx::Point screen_loc_in_pixel = ui::EventLocationFromNative(event); 304 gfx::Point screen_loc_in_pixel = ui::EventLocationFromNative(event);
305 gfx::Point screen_loc = ConvertPointToDIP(rvh->GetView(), 305 gfx::Point screen_loc = ConvertPointToDIP(rvh->GetView(),
306 screen_loc_in_pixel); 306 screen_loc_in_pixel);
307 gfx::Point client_loc = screen_loc; 307 gfx::Point client_loc = screen_loc;
308 aura::Window* window = rvh->GetView()->GetNativeView(); 308 aura::Window* window = rvh->GetView()->GetNativeView();
309 aura::Window::ConvertPointToTarget(window->GetRootWindow(), 309 aura::Window::ConvertPointToTarget(window->GetRootWindow(),
310 window, &client_loc); 310 window, &client_loc);
311 rvh->DragSourceMovedTo(client_loc.x(), client_loc.y(), 311 contents_->DragSourceMovedTo(client_loc.x(), client_loc.y(),
312 screen_loc.x(), screen_loc.y()); 312 screen_loc.x(), screen_loc.y());
313 } 313 }
314 break; 314 break;
315 default: 315 default:
316 break; 316 break;
317 } 317 }
318 } 318 }
319 319
320 virtual void Observe(int type, 320 virtual void Observe(int type,
321 const NotificationSource& source, 321 const NotificationSource& source,
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 } 929 }
930 930
931 void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { 931 void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) {
932 aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); 932 aura::RootWindow* root_window = GetNativeView()->GetRootWindow();
933 gfx::Point screen_loc = 933 gfx::Point screen_loc =
934 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); 934 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
935 gfx::Point client_loc = screen_loc; 935 gfx::Point client_loc = screen_loc;
936 RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 936 RenderViewHost* rvh = web_contents_->GetRenderViewHost();
937 aura::Window* window = rvh->GetView()->GetNativeView(); 937 aura::Window* window = rvh->GetView()->GetNativeView();
938 aura::Window::ConvertPointToTarget(root_window, window, &client_loc); 938 aura::Window::ConvertPointToTarget(root_window, window, &client_loc);
939 rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), 939 if (!web_contents_)
940 screen_loc.y(), ops); 940 return;
941 web_contents_->DragSourceEndedAt(client_loc.x(), client_loc.y(),
942 screen_loc.x(), screen_loc.y(), ops);
941 } 943 }
942 944
943 void WebContentsViewAura::PrepareOverscrollWindow() { 945 void WebContentsViewAura::PrepareOverscrollWindow() {
944 // If there is an existing |overscroll_window_| which is in the middle of an 946 // If there is an existing |overscroll_window_| which is in the middle of an
945 // animation, then destroying the window here causes the animation to be 947 // animation, then destroying the window here causes the animation to be
946 // completed immidiately, which triggers |OnImplicitAnimationsCompleted()| 948 // completed immidiately, which triggers |OnImplicitAnimationsCompleted()|
947 // callback, and that tries to reset |overscroll_window_| again, causing a 949 // callback, and that tries to reset |overscroll_window_| again, causing a
948 // double-free. So use a temporary variable here. 950 // double-free. So use a temporary variable here.
949 if (overscroll_window_) { 951 if (overscroll_window_) {
950 base::AutoReset<OverscrollMode> reset_state(&current_overscroll_gesture_, 952 base::AutoReset<OverscrollMode> reset_state(&current_overscroll_gesture_,
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 event.location(), 1699 event.location(),
1698 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), 1700 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(),
1699 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 1701 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
1700 if (drag_dest_delegate_) 1702 if (drag_dest_delegate_)
1701 drag_dest_delegate_->OnDrop(); 1703 drag_dest_delegate_->OnDrop();
1702 current_drop_data_.reset(); 1704 current_drop_data_.reset();
1703 return current_drag_op_; 1705 return current_drag_op_;
1704 } 1706 }
1705 1707
1706 } // namespace content 1708 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/web_contents/web_contents_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698