15c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// Copyright 2014 The Chromium Authors. All rights reserved.
25c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// Use of this source code is governed by a BSD-style license that can be
35c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// found in the LICENSE file.
45c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
55c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "ui/views/drag_utils.h"
65c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
75c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "ui/aura/window.h"
85c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "ui/aura/window_event_dispatcher.h"
95c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu#include "ui/wm/public/drag_drop_client.h"
105c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
115c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liunamespace views {
125c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
135c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liuvoid RunShellDrag(gfx::NativeView view,
145c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                  const ui::OSExchangeData& data,
155c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                  const gfx::Point& location,
165c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                  int operation,
175c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                  ui::DragDropTypes::DragEventSource source) {
185c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  gfx::Point root_location(location);
195c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  aura::Window* root_window = view->GetRootWindow();
205c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  aura::Window::ConvertPointToTarget(view, root_window, &root_location);
215c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  if (aura::client::GetDragDropClient(root_window)) {
225c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu    aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
235c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu        data, root_window, view, root_location, operation, source);
245c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  }
255c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu}
265c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
275c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu}  // namespace views
28