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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_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 UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_ 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_ 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/pickle.h" 15 #include "base/pickle.h"
16 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "ui/base/dragdrop/os_exchange_data.h" 18 #include "ui/base/dragdrop/os_exchange_data.h"
19 #include "ui/gfx/point.h" 19 #include "ui/gfx/vector2d.h"
20 20
21 namespace ui { 21 namespace ui {
22 22
23 // OSExchangeData::Provider implementation for Gtk. OSExchangeDataProviderGtk 23 // OSExchangeData::Provider implementation for Gtk. OSExchangeDataProviderGtk
24 // is created with a set of known data types. In addition specific data 24 // is created with a set of known data types. In addition specific data
25 // types can be set on OSExchangeDataProviderGtk by way of the various setters. 25 // types can be set on OSExchangeDataProviderGtk by way of the various setters.
26 // The various has methods return true if the format was supplied to the 26 // The various has methods return true if the format was supplied to the
27 // constructor, or explicitly set. 27 // constructor, or explicitly set.
28 class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider { 28 class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider {
29 public: 29 public:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 virtual bool GetPickledData(OSExchangeData::CustomFormat format, 78 virtual bool GetPickledData(OSExchangeData::CustomFormat format,
79 Pickle* data) const OVERRIDE; 79 Pickle* data) const OVERRIDE;
80 virtual bool HasString() const OVERRIDE; 80 virtual bool HasString() const OVERRIDE;
81 virtual bool HasURL() const OVERRIDE; 81 virtual bool HasURL() const OVERRIDE;
82 virtual bool HasFile() const OVERRIDE; 82 virtual bool HasFile() const OVERRIDE;
83 virtual bool HasCustomFormat( 83 virtual bool HasCustomFormat(
84 OSExchangeData::CustomFormat format) const OVERRIDE; 84 OSExchangeData::CustomFormat format) const OVERRIDE;
85 85
86 // Set the image and cursor offset data for this drag. Will 86 // Set the image and cursor offset data for this drag. Will
87 // increment the ref count of pixbuf. 87 // increment the ref count of pixbuf.
88 void SetDragImage(GdkPixbuf* pixbuf, const gfx::Point& cursor_offset); 88 void SetDragImage(GdkPixbuf* pixbuf, const gfx::Vector2d& cursor_offset);
89 GdkPixbuf* drag_image() const { return drag_image_; } 89 GdkPixbuf* drag_image() const { return drag_image_; }
90 gfx::Point cursor_offset() const { return cursor_offset_; } 90 gfx::Vector2d cursor_offset() const { return cursor_offset_; }
91 91
92 private: 92 private:
93 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData; 93 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData;
94 94
95 // Returns true if |formats_| contains a string format and the string can be 95 // Returns true if |formats_| contains a string format and the string can be
96 // parsed as a URL. 96 // parsed as a URL.
97 bool GetPlainTextURL(GURL* url) const; 97 bool GetPlainTextURL(GURL* url) const;
98 98
99 // These are the possible formats the OSExchangeData may contain. Don't 99 // These are the possible formats the OSExchangeData may contain. Don't
100 // confuse this with the actual formats that have been set, which are 100 // confuse this with the actual formats that have been set, which are
(...skipping 13 matching lines...) Expand all
114 string16 title_; 114 string16 title_;
115 115
116 // File name. 116 // File name.
117 FilePath filename_; 117 FilePath filename_;
118 118
119 // PICKLED_DATA contents. 119 // PICKLED_DATA contents.
120 PickleData pickle_data_; 120 PickleData pickle_data_;
121 121
122 // Drag image and offset data. 122 // Drag image and offset data.
123 GdkPixbuf* drag_image_; 123 GdkPixbuf* drag_image_;
124 gfx::Point cursor_offset_; 124 gfx::Vector2d cursor_offset_;
125 125
126 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderGtk); 126 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderGtk);
127 }; 127 };
128 128
129 } // namespace ui 129 } // namespace ui
130 130
131 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_ 131 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698