| OLD | NEW |
| 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 #ifndef CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ |
| 7 | 7 |
| 8 #if defined(TOOLKIT_GTK) | 8 #if defined(TOOLKIT_GTK) |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 #endif // TOOLKIT_GTK | 10 #endif // TOOLKIT_GTK |
| 11 | 11 |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | |
| 15 #include "ui/base/dragdrop/drop_target_win.h" | |
| 16 #endif | |
| 17 | |
| 18 class GURL; | 14 class GURL; |
| 19 | 15 |
| 20 namespace ui { | 16 namespace ui { |
| 21 class OSExchangeData; | 17 class OSExchangeData; |
| 22 } | 18 } |
| 23 | 19 |
| 24 namespace content { | 20 namespace content { |
| 25 class WebContents; | 21 class WebContents; |
| 26 struct DropData; | 22 struct DropData; |
| 27 | 23 |
| 28 // An optional delegate that listens for drags of bookmark data. | 24 // An optional delegate that listens for drags of bookmark data. |
| 29 class WebDragDestDelegate { | 25 class WebDragDestDelegate { |
| 30 public: | 26 public: |
| 31 // Announces that a drag has started. It's valid that a drag starts, along | 27 // 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 | 28 // with over/enter/leave/drop notifications without receiving any bookmark |
| 33 // data. | 29 // data. |
| 34 virtual void DragInitialize(WebContents* contents) = 0; | 30 virtual void DragInitialize(WebContents* contents) = 0; |
| 35 | 31 |
| 36 // Notifications of drag progression. | 32 // 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; | |
| 42 #else | |
| 43 virtual void OnDragOver() = 0; | 33 virtual void OnDragOver() = 0; |
| 44 virtual void OnDragEnter() = 0; | 34 virtual void OnDragEnter() = 0; |
| 45 virtual void OnDrop() = 0; | 35 virtual void OnDrop() = 0; |
| 46 // This should also clear any state kept about this drag. | 36 // This should also clear any state kept about this drag. |
| 47 virtual void OnDragLeave() = 0; | 37 virtual void OnDragLeave() = 0; |
| 48 #endif | |
| 49 | 38 |
| 50 #if defined(TOOLKIT_GTK) | 39 #if defined(TOOLKIT_GTK) |
| 51 // Returns the bookmark atom type. GTK and Views return different values here. | 40 // Returns the bookmark atom type. GTK and Views return different values here. |
| 52 virtual GdkAtom GetBookmarkTargetAtom() const = 0; | 41 virtual GdkAtom GetBookmarkTargetAtom() const = 0; |
| 53 | 42 |
| 54 // Called when WebDragDestkGtk detects that there's bookmark data in a | 43 // Called when WebDragDestkGtk detects that there's bookmark data in a |
| 55 // drag. Not every drag will trigger these. | 44 // drag. Not every drag will trigger these. |
| 56 virtual void OnReceiveDataFromGtk(GtkSelectionData* data) = 0; | 45 virtual void OnReceiveDataFromGtk(GtkSelectionData* data) = 0; |
| 57 virtual void OnReceiveProcessedData(const GURL& url, | 46 virtual void OnReceiveProcessedData(const GURL& url, |
| 58 const base::string16& title) = 0; | 47 const base::string16& title) = 0; |
| 59 #elif defined(USE_AURA) | 48 #elif defined(USE_AURA) |
| 60 // Called at the start of every drag to supply the data associated with the | 49 // Called at the start of every drag to supply the data associated with the |
| 61 // drag. | 50 // drag. |
| 62 virtual void OnReceiveDragData(const ui::OSExchangeData& data) = 0; | 51 virtual void OnReceiveDragData(const ui::OSExchangeData& data) = 0; |
| 63 #elif defined(OS_WIN) | |
| 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; | |
| 68 #endif // TOOLKIT_GTK | 52 #endif // TOOLKIT_GTK |
| 69 | 53 |
| 70 virtual ~WebDragDestDelegate() {} | 54 virtual ~WebDragDestDelegate() {} |
| 71 }; | 55 }; |
| 72 | 56 |
| 73 } // namespace content | 57 } // namespace content |
| 74 | 58 |
| 75 #endif // CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ | 59 #endif // CONTENT_PUBLIC_BROWSER_WEB_DRAG_DEST_DELEGATE_H_ |
| OLD | NEW |