Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / custom_drag.h
blob06a91d42d3d1ffe7f3daefc3880b6e88ed12ca59
1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
6 #define CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_
8 #include <gtk/gtk.h>
10 #include "base/basictypes.h"
11 #include "ui/base/gtk/gtk_signal.h"
13 namespace gfx {
14 class Image;
17 // Base class for programatically generated drags.
18 class CustomDrag {
19 protected:
20 CustomDrag(gfx::Image* icon, int code_mask, GdkDragAction action);
21 virtual ~CustomDrag();
23 virtual void OnDragDataGet(GtkWidget* widget,
24 GdkDragContext* context,
25 GtkSelectionData* selection_data,
26 guint target_type,
27 guint time) = 0;
29 private:
30 CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragBegin, GdkDragContext*);
31 CHROMEGTK_CALLBACK_1(CustomDrag, void, OnDragEnd, GdkDragContext*);
33 // Since this uses a virtual function, we can't use a macro.
34 static void OnDragDataGetThunk(GtkWidget* widget, GdkDragContext* context,
35 GtkSelectionData* selection_data,
36 guint target_type, guint time,
37 CustomDrag* custom_drag) {
38 return custom_drag->OnDragDataGet(widget, context, selection_data,
39 target_type, time);
42 // Can't use a OwnedWidgetGtk because the initialization of GtkInvisible
43 // sinks the reference.
44 GtkWidget* drag_widget_;
46 // The image for the drag. The lifetime of the image should be managed outside
47 // this object. Most icons are owned by the IconManager.
48 gfx::Image* image_;
50 DISALLOW_COPY_AND_ASSIGN(CustomDrag);
53 #endif // CHROME_BROWSER_UI_GTK_CUSTOM_DRAG_H_