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

Unified Diff: ui/base/clipboard/scoped_clipboard_writer.cc

Issue 2777723002: Add ScopedClipboardWriter::WriteData
Patch Set: Add ScopedClipboardWriter::WriteData Created 3 years, 9 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
Index: ui/base/clipboard/scoped_clipboard_writer.cc
diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc
index 6850cd460b1d4ac94996a7012848ea3f6d2da878..6d652cca59b49548d9e5d096f140db862fdf4ff4 100644
--- a/ui/base/clipboard/scoped_clipboard_writer.cc
+++ b/ui/base/clipboard/scoped_clipboard_writer.cc
@@ -102,17 +102,16 @@ void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) {
objects_[Clipboard::CBF_SMBITMAP] = parameters;
}
-void ScopedClipboardWriter::WritePickledData(
- const base::Pickle& pickle,
- const Clipboard::FormatType& format) {
+void ScopedClipboardWriter::WriteData(const char* data,
+ int size,
+ const Clipboard::FormatType& format) {
std::string format_string = format.Serialize();
Clipboard::ObjectMapParam format_parameter(format_string.begin(),
format_string.end());
Clipboard::ObjectMapParam data_parameter;
- data_parameter.resize(pickle.size());
- memcpy(const_cast<char*>(&data_parameter.front()),
- pickle.data(), pickle.size());
+ data_parameter.resize(size);
+ memcpy(const_cast<char*>(&data_parameter.front()), data, size);
Clipboard::ObjectMapParams parameters;
parameters.push_back(format_parameter);
@@ -120,6 +119,13 @@ void ScopedClipboardWriter::WritePickledData(
objects_[Clipboard::CBF_DATA] = parameters;
}
+void ScopedClipboardWriter::WritePickledData(
+ const base::Pickle& pickle,
+ const Clipboard::FormatType& format) {
+ WriteData(reinterpret_cast<const char*>(pickle.data()), pickle.size(),
+ format);
+}
+
void ScopedClipboardWriter::Reset() {
url_text_.clear();
objects_.clear();
« ui/base/clipboard/scoped_clipboard_writer.h ('K') | « ui/base/clipboard/scoped_clipboard_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698