From 23de301955be3b0cfe1b2015b37c64c80d9a992b Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Mon, 26 Nov 2018 16:51:26 -0800 Subject: [PATCH] chore: remove scoped_clipboard_writer.patch (#15843) replace with already-exposed APIs --- atom/common/api/atom_api_clipboard.cc | 5 +- patches/common/chromium/.patches | 1 - .../chromium/scoped_clipboard_writer.patch | 63 ------------------- 3 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 patches/common/chromium/scoped_clipboard_writer.patch diff --git a/atom/common/api/atom_api_clipboard.cc b/atom/common/api/atom_api_clipboard.cc index 7502b1cb3627..39889e77eef7 100644 --- a/atom/common/api/atom_api_clipboard.cc +++ b/atom/common/api/atom_api_clipboard.cc @@ -65,8 +65,9 @@ void Clipboard::WriteBuffer(const std::string& format, } ui::ScopedClipboardWriter writer(GetClipboardType(args)); - writer.WriteData(node::Buffer::Data(buffer), node::Buffer::Length(buffer), - ui::Clipboard::GetFormatType(format)); + writer.WriteData( + ui::Clipboard::GetFormatType(format).Serialize(), + std::string(node::Buffer::Data(buffer), node::Buffer::Length(buffer))); } void Clipboard::Write(const mate::Dictionary& data, mate::Arguments* args) { diff --git a/patches/common/chromium/.patches b/patches/common/chromium/.patches index eb46624cd18c..127f431162bc 100644 --- a/patches/common/chromium/.patches +++ b/patches/common/chromium/.patches @@ -17,7 +17,6 @@ net_url_request_job.patch out_of_process_instance.patch render_widget_host_view_base.patch render_widget_host_view_mac.patch -scoped_clipboard_writer.patch stream_resource_handler.patch thread_capabilities.patch web_contents.patch diff --git a/patches/common/chromium/scoped_clipboard_writer.patch b/patches/common/chromium/scoped_clipboard_writer.patch deleted file mode 100644 index eb16afdf92c5..000000000000 --- a/patches/common/chromium/scoped_clipboard_writer.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anonymous -Date: Thu, 20 Sep 2018 17:46:32 -0700 -Subject: scoped_clipboard_writer.patch - - -diff --git a/ui/base/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc -index 12680a66d17c56aa72edcd7cdf48eb68ff864cf3..6b95e46e35584843c75dae5d784cb606ed31754a 100644 ---- a/ui/base/clipboard/scoped_clipboard_writer.cc -+++ b/ui/base/clipboard/scoped_clipboard_writer.cc -@@ -103,17 +103,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(&data_parameter.front()), -- pickle.data(), pickle.size()); -+ data_parameter.resize(size); -+ memcpy(const_cast(&data_parameter.front()), data, size); - - Clipboard::ObjectMapParams parameters; - parameters.push_back(format_parameter); -@@ -131,6 +130,13 @@ void ScopedClipboardWriter::WriteData(const std::string& type, - objects_[Clipboard::CBF_DATA] = parameters; - } - -+void ScopedClipboardWriter::WritePickledData( -+ const base::Pickle& pickle, -+ const Clipboard::FormatType& format) { -+ WriteData(reinterpret_cast(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 -index 385900eb67dee499afc8591e6acf0c6b5957df7e..cf1f803ec1233c173d11295be05ba0859cae4844 100644 ---- a/ui/base/clipboard/scoped_clipboard_writer.h -+++ b/ui/base/clipboard/scoped_clipboard_writer.h -@@ -57,6 +57,11 @@ class UI_BASE_EXPORT ScopedClipboardWriter { - // 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);