blob: 768d9e34286968e657e52eec15723b7db16e83e2 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "ui/gfx/native_widget_types.h"
#include "ui/platform_window/platform_window_handler/wm_platform_export.h"
namespace gfx {
class PointF;
namespace ui {
class OSExchangeData;
class PlatformWindow;
class WM_PLATFORM_EXPORT WmDropHandler {
// Notifies that dragging is entered to the window. |point| is in the
// coordinate space of the PlatformWindow.
virtual void OnDragEnter(const gfx::PointF& point,
std::unique_ptr<OSExchangeData> data,
int operation) = 0;
// Notifies that dragging is moved. |widget_out| will be set with the
// widget located at |point|. |point| is in the coordinate space of the
// PlatformWindow. It returns the operation selected by client and the
// returned value should be from ui::DragDropTypes.
virtual int OnDragMotion(const gfx::PointF& point, int operation) = 0;
// Notifies that dragged data is dropped. When it doesn't deliver
// the dragged data on OnDragEnter, it should put it to |data|. The location
// of the drop is the location of the latest DragEnter/DragMotion. If
// OSExchangeData is provided on OnDragEnter, the |data| should be same as it.
virtual void OnDragDrop(std::unique_ptr<ui::OSExchangeData> data) = 0;
// Notifies that dragging is left.
virtual void OnDragLeave() = 0;
virtual ~WmDropHandler() {}
WM_PLATFORM_EXPORT void SetWmDropHandler(PlatformWindow* platform_window,
WmDropHandler* drop_handler);
WM_PLATFORM_EXPORT WmDropHandler* GetWmDropHandler(
const PlatformWindow& platform_window);
} // namespace ui