diff options
author | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 19:37:11 +0000 |
---|---|---|
committer | zmo@chromium.org <zmo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-14 19:37:11 +0000 |
commit | e82a750a739a620495eaee902dd7759cdb1e20a1 (patch) | |
tree | ea2d002d629c88a4f3ffdb562d65487bdc737bce | |
parent | c0e895e2961bd05570b0d7660016914601bf8c7d (diff) | |
download | chromium_src-e82a750a739a620495eaee902dd7759cdb1e20a1.zip chromium_src-e82a750a739a620495eaee902dd7759cdb1e20a1.tar.gz chromium_src-e82a750a739a620495eaee902dd7759cdb1e20a1.tar.bz2 |
Revert 257164 "Refactor ui::Clipboard::ObjectMap sanitization in..."
Compile failure on several webkit bots:
One example: http://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac%20Builder/builds/78865
> Refactor ui::Clipboard::ObjectMap sanitization in ClipboardMsgFilter.
>
> BUG=352395
> R=tony@chromium.org
> TBR=creis@chromium.org
>
> Review URL: https://codereview.chromium.org/200523004
TBR=dcheng@chromium.org
Review URL: https://codereview.chromium.org/200813002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257180 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/clipboard_message_filter.cc | 30 | ||||
-rw-r--r-- | ui/base/clipboard/clipboard.h | 4 |
2 files changed, 3 insertions, 31 deletions
diff --git a/content/browser/renderer_host/clipboard_message_filter.cc b/content/browser/renderer_host/clipboard_message_filter.cc index e06852a..df6d5c3 100644 --- a/content/browser/renderer_host/clipboard_message_filter.cc +++ b/content/browser/renderer_host/clipboard_message_filter.cc @@ -31,33 +31,6 @@ void WriteObjectsOnUIThread(ui::Clipboard::ObjectMap* objects) { clipboard->WriteObjects(ui::CLIPBOARD_TYPE_COPY_PASTE, *objects); } -enum BitmapPolicy { - kFilterBitmap, - kAllowBitmap, -}; -void SanitizeObjectMap(ui::Clipboard::ObjectMap* objects, - BitmapPolicy bitmap_policy) { - if (bitmap_policy != kAllowBitmap) - objects->erase(ui::Clipboard::CBF_SMBITMAP); - - ui::Clipboard::ObjectMap::iterator data_it = - objects->find(ui::Clipboard::CBF_DATA); - if (data_it != objects->end()) { - const ui::Clipboard::FormatType& web_custom_format = - ui::Clipboard::GetWebCustomDataFormatType(); - if (data_it->second.size() != 2 || - !web_custom_format.Equals( - ui::Clipboard::FormatType::Deserialize(std::string( - &data_it->second[0].front(), - data_it->second[0].size())))) { - // CBF_DATA should always have two parameters associated with it, and the - // associated FormatType should always be web custom data. If not, then - // data is malformed and we'll ignore it. - objects->erase(ui::Clipboard::CBF_DATA); - } - } -} - } // namespace @@ -129,7 +102,6 @@ void ClipboardMessageFilter::OnWriteObjectsSync( // to the clipboard later. scoped_ptr<ui::Clipboard::ObjectMap> long_living_objects( new ui::Clipboard::ObjectMap(objects)); - SanitizeObjectMap(long_living_objects.get(), kAllowBitmap); // Splice the shared memory handle into the data. |long_living_objects| now // contains a heap-allocated SharedMemory object that references // |bitmap_handle|. This reference will keep the shared memory section alive @@ -152,7 +124,7 @@ void ClipboardMessageFilter::OnWriteObjectsAsync( // be removed otherwise we might dereference a rubbish pointer. scoped_ptr<ui::Clipboard::ObjectMap> sanitized_objects( new ui::Clipboard::ObjectMap(objects)); - SanitizeObjectMap(sanitized_objects.get(), kFilterBitmap); + sanitized_objects->erase(ui::Clipboard::CBF_SMBITMAP); #if defined(OS_WIN) // We cannot write directly from the IO thread, and cannot service the IPC diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index 9f49230..09a4584 100644 --- a/ui/base/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h @@ -95,11 +95,11 @@ class UI_BASE_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) { FormatType& operator=(const FormatType& other); #endif - bool Equals(const FormatType& other) const; - private: friend class Clipboard; + bool Equals(const FormatType& other) const; + // Platform-specific glue used internally by the Clipboard class. Each // plaform should define,at least one of each of the following: // 1. A constructor that wraps that native clipboard format descriptor. |