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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_
8 #if defined(TOOLKIT_GTK)
12 #include "base/strings/string16.h"
15 #include "ui/base/dragdrop/drop_target_win.h"
28 // An optional delegate that listens for drags of bookmark data.
29 class WebDragDestDelegate {
31 // Announces that a drag has started. It's valid that a drag starts, along
32 // with over/enter/leave/drop notifications without receiving any bookmark
34 virtual void DragInitialize(WebContents* contents) = 0;
36 // Notifications of drag progression.
37 #if defined(OS_WIN) && !defined(USE_AURA)
38 virtual void OnDragOver(IDataObject* data_object) = 0;
39 virtual void OnDragEnter(IDataObject* data_object) = 0;
40 virtual void OnDrop(IDataObject* data_object) = 0;
41 virtual void OnDragLeave(IDataObject* data_object) = 0;
43 virtual void OnDragOver() = 0;
44 virtual void OnDragEnter() = 0;
45 virtual void OnDrop() = 0;
46 // This should also clear any state kept about this drag.
47 virtual void OnDragLeave() = 0;
50 #if defined(TOOLKIT_GTK)
51 // Returns the bookmark atom type. GTK and Views return different values here.
52 virtual GdkAtom GetBookmarkTargetAtom() const = 0;
54 // Called when WebDragDestkGtk detects that there's bookmark data in a
55 // drag. Not every drag will trigger these.
56 virtual void OnReceiveDataFromGtk(GtkSelectionData* data) = 0;
57 virtual void OnReceiveProcessedData(const GURL& url,
58 const string16& title) = 0;
59 #elif defined(USE_AURA)
60 // Called at the start of every drag to supply the data associated with the
62 virtual void OnReceiveDragData(const ui::OSExchangeData& data) = 0;
64 // Allows the delegate to set data on the drag. If it doesn't want to set
65 // data, it should return false.
66 virtual bool AddDragData(const DropData& drop_data,
67 ui::OSExchangeData* data) = 0;
70 virtual ~WebDragDestDelegate() {}
73 } // namespace content
75 #endif // CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_