diff options
-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. |