2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Anonymous <anonymous@electronjs.org>
|
|
|
|
Date: Thu, 20 Sep 2018 17:46:32 -0700
|
|
|
|
Subject: scoped_clipboard_writer.patch
|
|
|
|
|
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc
|
2018-10-24 18:24:11 +00:00
|
|
|
index 12680a66d17c56aa72edcd7cdf48eb68ff864cf3..6b95e46e35584843c75dae5d784cb606ed31754a 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/ui/base/clipboard/scoped_clipboard_writer.cc
|
|
|
|
+++ b/ui/base/clipboard/scoped_clipboard_writer.cc
|
2018-09-14 18:03:43 +00:00
|
|
|
@@ -103,17 +103,16 @@ void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) {
|
2018-09-14 05:02:16 +00:00
|
|
|
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);
|
2018-09-21 00:30:26 +00:00
|
|
|
@@ -131,6 +130,13 @@ void ScopedClipboardWriter::WriteData(const std::string& type,
|
2018-09-14 05:02:16 +00:00
|
|
|
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() {
|
|
|
|
objects_.clear();
|
|
|
|
bitmap_.reset();
|
|
|
|
diff --git a/ui/base/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h
|
2018-10-24 18:24:11 +00:00
|
|
|
index 385900eb67dee499afc8591e6acf0c6b5957df7e..cf1f803ec1233c173d11295be05ba0859cae4844 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/ui/base/clipboard/scoped_clipboard_writer.h
|
|
|
|
+++ b/ui/base/clipboard/scoped_clipboard_writer.h
|
2018-09-14 18:03:43 +00:00
|
|
|
@@ -57,6 +57,11 @@ class UI_BASE_EXPORT ScopedClipboardWriter {
|
2018-09-14 05:02:16 +00:00
|
|
|
// Used by WebKit to determine whether WebKit wrote the clipboard last
|
|
|
|
void WriteWebSmartPaste();
|
|
|
|
|
|
|
|
+ // Adds arbitrary data to clipboard.
|
|
|
|
+ void WriteData(const char* data,
|
|
|
|
+ int size,
|
|
|
|
+ const Clipboard::FormatType& format);
|
|
|
|
+
|
|
|
|
// Adds arbitrary pickled data to clipboard.
|
|
|
|
void WritePickledData(const base::Pickle& pickle,
|
|
|
|
const Clipboard::FormatType& format);
|