Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: content/browser/tab_contents/web_drag_source_gtk.h

Issue 10014024: TabContents -> WebContentsImpl, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_TAB_WEB_DRAG_SOURCE_GTK_H_
6 #define CONTENT_BROWSER_TAB_WEB_DRAG_SOURCE_GTK_H_
7 #pragma once
8
9 #include <gtk/gtk.h>
10
11 #include "base/basictypes.h"
12 #include "base/file_path.h"
13 #include "base/message_loop.h"
14 #include "base/string16.h"
15 #include "content/common/content_export.h"
16 #include "googleurl/src/gurl.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
18 #include "ui/base/gtk/gtk_signal.h"
19 #include "ui/base/gtk/gtk_signal_registrar.h"
20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gfx/point.h"
22
23 class SkBitmap;
24 struct WebDropData;
25
26 namespace content {
27
28 class RenderViewHostImpl;
29 class WebContents;
30
31 // WebDragSourceGtk takes care of managing the drag from a WebContents
32 // with Gtk.
33 class CONTENT_EXPORT WebDragSourceGtk : public MessageLoopForUI::Observer {
34 public:
35 explicit WebDragSourceGtk(WebContents* web_contents);
36 virtual ~WebDragSourceGtk();
37
38 // Starts a drag for the tab contents this WebDragSourceGtk was
39 // created for.
40 void StartDragging(const WebDropData& drop_data,
41 WebKit::WebDragOperationsMask allowed_ops,
42 GdkEventButton* last_mouse_down,
43 const SkBitmap& image,
44 const gfx::Point& image_offset);
45
46 // MessageLoop::Observer implementation:
47 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
48 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
49
50 private:
51 CHROMEGTK_CALLBACK_2(WebDragSourceGtk, gboolean, OnDragFailed,
52 GdkDragContext*, GtkDragResult);
53 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragBegin,
54 GdkDragContext*);
55 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragEnd,
56 GdkDragContext*);
57 CHROMEGTK_CALLBACK_4(WebDragSourceGtk, void, OnDragDataGet,
58 GdkDragContext*, GtkSelectionData*, guint, guint);
59 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, gboolean, OnDragIconExpose,
60 GdkEventExpose*);
61
62 content::RenderViewHostImpl* GetRenderViewHost() const;
63 gfx::NativeView GetContentNativeView() const;
64
65 // The tab we're manging the drag for.
66 content::WebContents* web_contents_;
67
68 // The drop data for the current drag (for drags that originate in the render
69 // view). Non-NULL iff there is a current drag.
70 scoped_ptr<WebDropData> drop_data_;
71
72 // The image used for depicting the drag, and the offset between the cursor
73 // and the top left pixel.
74 GdkPixbuf* drag_pixbuf_;
75 gfx::Point image_offset_;
76
77 // The mime type for the file contents of the current drag (if any).
78 GdkAtom drag_file_mime_type_;
79
80 // Whether the current drag has failed. Meaningless if we are not the source
81 // for a current drag.
82 bool drag_failed_;
83
84 // This is the widget we use to initiate drags. Since we don't use the
85 // renderer widget, we can persist drags even when our contents is switched
86 // out. We can't use an OwnedWidgetGtk because the GtkInvisible widget
87 // initialization code sinks the reference.
88 GtkWidget* drag_widget_;
89
90 // Context created once drag starts. A NULL value indicates that there is
91 // no drag currently in progress.
92 GdkDragContext* drag_context_;
93
94 // The file mime type for a drag-out download.
95 string16 wide_download_mime_type_;
96
97 // The file name to be saved to for a drag-out download.
98 FilePath download_file_name_;
99
100 // The URL to download from for a drag-out download.
101 GURL download_url_;
102
103 // The widget that provides visual feedback for the drag. We can't use
104 // an OwnedWidgetGtk because the GtkWindow initialization code sinks
105 // the reference.
106 GtkWidget* drag_icon_;
107
108 ui::GtkSignalRegistrar signals_;
109
110 DISALLOW_COPY_AND_ASSIGN(WebDragSourceGtk);
111 };
112
113 } // namespace content
114
115 #endif // CONTENT_BROWSER_TAB_WEB_DRAG_SOURCE_GTK_H_
OLDNEW
« no previous file with comments | « content/browser/tab_contents/web_drag_dest_win.cc ('k') | content/browser/tab_contents/web_drag_source_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698