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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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
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_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
17 #include "ui/base/gtk/gtk_signal.h" 17 #include "ui/base/gtk/gtk_signal.h"
18 #include "ui/base/gtk/gtk_signal_registrar.h" 18 #include "ui/base/gtk/gtk_signal_registrar.h"
19 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
20 #include "ui/gfx/point.h" 20 #include "ui/gfx/vector2d.h"
21 21
22 class SkBitmap; 22 class SkBitmap;
23 struct WebDropData; 23 struct WebDropData;
24 24
25 namespace content { 25 namespace content {
26 26
27 class RenderViewHostImpl; 27 class RenderViewHostImpl;
28 class WebContents; 28 class WebContents;
29 29
30 // WebDragSourceGtk takes care of managing the drag from a WebContents 30 // WebDragSourceGtk takes care of managing the drag from a WebContents
31 // with Gtk. 31 // with Gtk.
32 class CONTENT_EXPORT WebDragSourceGtk : public MessageLoopForUI::Observer { 32 class CONTENT_EXPORT WebDragSourceGtk : public MessageLoopForUI::Observer {
33 public: 33 public:
34 explicit WebDragSourceGtk(WebContents* web_contents); 34 explicit WebDragSourceGtk(WebContents* web_contents);
35 virtual ~WebDragSourceGtk(); 35 virtual ~WebDragSourceGtk();
36 36
37 // Starts a drag for the WebContents this WebDragSourceGtk was created for. 37 // Starts a drag for the WebContents this WebDragSourceGtk was created for.
38 void StartDragging(const WebDropData& drop_data, 38 void StartDragging(const WebDropData& drop_data,
39 WebKit::WebDragOperationsMask allowed_ops, 39 WebKit::WebDragOperationsMask allowed_ops,
40 GdkEventButton* last_mouse_down, 40 GdkEventButton* last_mouse_down,
41 const SkBitmap& image, 41 const SkBitmap& image,
42 const gfx::Point& image_offset); 42 const gfx::Vector2d& image_offset);
43 43
44 // MessageLoop::Observer implementation: 44 // MessageLoop::Observer implementation:
45 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE; 45 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE;
46 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE; 46 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE;
47 47
48 private: 48 private:
49 CHROMEGTK_CALLBACK_2(WebDragSourceGtk, gboolean, OnDragFailed, 49 CHROMEGTK_CALLBACK_2(WebDragSourceGtk, gboolean, OnDragFailed,
50 GdkDragContext*, GtkDragResult); 50 GdkDragContext*, GtkDragResult);
51 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragBegin, 51 CHROMEGTK_CALLBACK_1(WebDragSourceGtk, void, OnDragBegin,
52 GdkDragContext*); 52 GdkDragContext*);
(...skipping 10 matching lines...) Expand all
63 // The tab we're manging the drag for. 63 // The tab we're manging the drag for.
64 WebContents* web_contents_; 64 WebContents* web_contents_;
65 65
66 // The drop data for the current drag (for drags that originate in the render 66 // The drop data for the current drag (for drags that originate in the render
67 // view). Non-NULL iff there is a current drag. 67 // view). Non-NULL iff there is a current drag.
68 scoped_ptr<WebDropData> drop_data_; 68 scoped_ptr<WebDropData> drop_data_;
69 69
70 // The image used for depicting the drag, and the offset between the cursor 70 // The image used for depicting the drag, and the offset between the cursor
71 // and the top left pixel. 71 // and the top left pixel.
72 GdkPixbuf* drag_pixbuf_; 72 GdkPixbuf* drag_pixbuf_;
73 gfx::Point image_offset_; 73 gfx::Vector2d image_offset_;
74 74
75 // The mime type for the file contents of the current drag (if any). 75 // The mime type for the file contents of the current drag (if any).
76 GdkAtom drag_file_mime_type_; 76 GdkAtom drag_file_mime_type_;
77 77
78 // Whether the current drag has failed. Meaningless if we are not the source 78 // Whether the current drag has failed. Meaningless if we are not the source
79 // for a current drag. 79 // for a current drag.
80 bool drag_failed_; 80 bool drag_failed_;
81 81
82 // This is the widget we use to initiate drags. Since we don't use the 82 // This is the widget we use to initiate drags. Since we don't use the
83 // renderer widget, we can persist drags even when our contents is switched 83 // renderer widget, we can persist drags even when our contents is switched
(...skipping 20 matching lines...) Expand all
104 GtkWidget* drag_icon_; 104 GtkWidget* drag_icon_;
105 105
106 ui::GtkSignalRegistrar signals_; 106 ui::GtkSignalRegistrar signals_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(WebDragSourceGtk); 108 DISALLOW_COPY_AND_ASSIGN(WebDragSourceGtk);
109 }; 109 };
110 110
111 } // namespace content 111 } // namespace content
112 112
113 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_ 113 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698