OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_DRAG_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_DRAG_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/ui/gtk/custom_drag.h" |
| 12 |
| 13 namespace content { |
| 14 class DownloadItem; |
| 15 } |
| 16 |
| 17 // Encapsulates functionality for drags of download items. |
| 18 class DownloadItemDrag : public CustomDrag { |
| 19 public: |
| 20 // Sets |widget| as a source for drags pertaining to |item|. No |
| 21 // DownloadItemDrag object is created. |
| 22 // It is safe to call this multiple times with different values of |icon|. |
| 23 static void SetSource(GtkWidget* widget, |
| 24 const content::DownloadItem* item, |
| 25 gfx::Image* icon); |
| 26 |
| 27 // Creates a new DownloadItemDrag, the lifetime of which is tied to the |
| 28 // system drag. |
| 29 static void BeginDrag(const content::DownloadItem* item, gfx::Image* icon); |
| 30 |
| 31 private: |
| 32 class DragData; |
| 33 |
| 34 DownloadItemDrag(const content::DownloadItem* item, gfx::Image* icon); |
| 35 virtual ~DownloadItemDrag(); |
| 36 |
| 37 virtual void OnDragDataGet(GtkWidget* widget, |
| 38 GdkDragContext* context, |
| 39 GtkSelectionData* selection_data, |
| 40 guint target_type, |
| 41 guint time) OVERRIDE; |
| 42 |
| 43 scoped_ptr<DragData> drag_data_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(DownloadItemDrag); |
| 46 }; |
| 47 |
| 48 |
| 49 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_DRAG_H_ |
OLD | NEW |