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

Unified Diff: base/clipboard.h

Issue 159815: Refactor bookmark clipboard code to be cross platform. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix UMR Created 11 years, 4 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 | « no previous file | base/clipboard.cc » ('j') | base/clipboard_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/clipboard.h
===================================================================
--- base/clipboard.h (revision 22359)
+++ base/clipboard.h (working copy)
@@ -40,7 +40,8 @@
CBF_FILES,
CBF_WEBKIT,
CBF_BITMAP,
- CBF_SMBITMAP // bitmap from shared memory
+ CBF_SMBITMAP, // Bitmap from shared memory.
+ CBF_DATA, // Arbitrary block of bytes.
};
// ObjectMap is a map from ObjectType to associated data.
@@ -67,6 +68,8 @@
// size gfx::Size struct
// CBF_SMBITMAP shared_mem shared memory handle
// size gfx::Size struct
+ // CBF_DATA format char array
+ // data byte array
typedef std::vector<char> ObjectMapParam;
typedef std::vector<ObjectMapParam> ObjectMapParams;
typedef std::map<int /* ObjectType */, ObjectMapParams> ObjectMap;
@@ -89,6 +92,10 @@
// Tests whether the clipboard contains a certain format
bool IsFormatAvailable(const FormatType& format) const;
+ // As above, but instead of interpreting |format| by some platform-specific
+ // definition, interpret it as a literal MIME type.
+ bool IsFormatAvailableByString(const std::string& format) const;
+
// Reads UNICODE text from the clipboard, if available.
void ReadText(string16* result) const;
@@ -106,6 +113,10 @@
void ReadFile(FilePath* file) const;
void ReadFiles(std::vector<FilePath>* files) const;
+ // Reads raw data from the clipboard with the given format type. Stores result
+ // as a byte vector.
+ void ReadData(const std::string& format, std::string* result);
+
// Get format Identifiers for various types.
static FormatType GetUrlFormatType();
static FormatType GetUrlWFormatType();
@@ -132,6 +143,8 @@
#endif
private:
+ void DispatchObject(ObjectType type, const ObjectMapParams& params);
+
void WriteText(const char* text_data, size_t text_len);
void WriteHTML(const char* markup_data,
@@ -153,9 +166,13 @@
void WriteFiles(const char* file_data, size_t file_len);
- void DispatchObject(ObjectType type, const ObjectMapParams& params);
-
void WriteBitmap(const char* pixel_data, const char* size_data);
+#if defined(OS_WIN) || defined(OS_LINUX)
+ // |format_name| is an ASCII string and should be NULL-terminated.
+ // TODO(estade): port to mac.
+ void WriteData(const char* format_name, size_t format_len,
+ const char* data_data, size_t data_len);
+#endif
#if defined(OS_WIN)
void WriteBitmapFromSharedMemory(const char* bitmap_data,
const char* size_data,
@@ -200,7 +217,7 @@
GtkClipboard* clipboard_;
#endif
- DISALLOW_EVIL_CONSTRUCTORS(Clipboard);
+ DISALLOW_COPY_AND_ASSIGN(Clipboard);
};
#endif // BASE_CLIPBOARD_H_
« no previous file with comments | « no previous file | base/clipboard.cc » ('j') | base/clipboard_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698