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