- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / download / download_item_drag.h
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   DownloadItemDrag(const content::DownloadItem* item, gfx::Image* icon);
21
22   // Sets |widget| as a source for drags pertaining to |item|. No
23   // DownloadItemDrag object is created.
24   // It is safe to call this multiple times with different values of |icon|.
25   static void SetSource(GtkWidget* widget,
26                         const content::DownloadItem* item,
27                         gfx::Image* icon);
28
29  private:
30   class DragData;
31
32   virtual ~DownloadItemDrag();
33
34   virtual void OnDragDataGet(GtkWidget* widget,
35                              GdkDragContext* context,
36                              GtkSelectionData* selection_data,
37                              guint target_type,
38                              guint time) OVERRIDE;
39
40   scoped_ptr<DragData> drag_data_;
41
42   DISALLOW_COPY_AND_ASSIGN(DownloadItemDrag);
43 };
44
45
46 #endif  // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_DRAG_H_