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

Unified Diff: ui/base/x/selection_utils.h

Issue 14189002: linux_aura: Implement dropping in chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/x/selection_requestor.cc ('k') | ui/base/x/selection_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/selection_utils.h
diff --git a/ui/base/x/selection_utils.h b/ui/base/x/selection_utils.h
index eba259b37ddc48e5caf375490a4565d9a97f01aa..741fd819f9bc84f9bbb874a1570cddba871df6d9 100644
--- a/ui/base/x/selection_utils.h
+++ b/ui/base/x/selection_utils.h
@@ -15,13 +15,26 @@
#include "base/basictypes.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/ui_export.h"
+#include "ui/base/x/x11_atom_cache.h"
namespace ui {
class X11AtomCache;
+extern const char kMimeTypeMozillaURL[];
+extern const char kString[];
+extern const char kText[];
+extern const char kUtf8String[];
+
// Returns a list of all text atoms that we handle.
UI_EXPORT std::vector< ::Atom> GetTextAtomsFrom(const X11AtomCache* atom_cache);
+UI_EXPORT std::vector< ::Atom> GetURLAtomsFrom(const X11AtomCache* atom_cache);
+
+// Places the intersection of |one| and |two| into |output|.
+UI_EXPORT void GetAtomIntersection(const std::vector< ::Atom>& one,
+ const std::vector< ::Atom>& two,
+ std::vector< ::Atom>* output);
+
///////////////////////////////////////////////////////////////////////////////
// Represents the selection in different data formats. Binary data passed in is
@@ -52,6 +65,43 @@ class UI_EXPORT SelectionFormatMap {
DISALLOW_COPY_AND_ASSIGN(SelectionFormatMap);
};
+///////////////////////////////////////////////////////////////////////////////
+
+// A holder for data with optional X11 deletion semantics.
+class UI_EXPORT SelectionData {
+ public:
+ // |atom_cache| is still owned by caller.
+ explicit SelectionData(Display* x_display);
+ ~SelectionData();
+
+ ::Atom type() const { return type_; }
+ char* data() const { return data_; }
+ size_t size() const { return size_; }
+
+ void Set(::Atom type, char* data, size_t size, bool owned);
+
+ // If |type_| is a string type, convert the data to UTF8 and return it.
+ std::string GetText() const;
+
+ // If |type_| is the HTML type, returns the data as a string16. This detects
+ // guesses the character encoding of the source.
+ string16 GetHtml() const;
+
+ // Assigns the raw data to the string.
+ void AssignTo(std::string* result) const;
+ void AssignTo(string16* result) const;
+
+ private:
+ ::Atom type_;
+ char* data_;
+ size_t size_;
+ bool owned_;
+
+ X11AtomCache atom_cache_;
+
+ DISALLOW_COPY_AND_ASSIGN(SelectionData);
+};
+
} // namespace ui
#endif // UI_BASE_X_SELECTION_UTILS_H_
« no previous file with comments | « ui/base/x/selection_requestor.cc ('k') | ui/base/x/selection_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698