1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_COMMON_DATA_UTIL_H_ 6 #define UI_OZONE_PLATFORM_WAYLAND_COMMON_DATA_UTIL_H_ 7 8 #include <string> 9 10 #include "ui/ozone/public/platform_clipboard.h" 11 12 namespace ui { 13 class OSExchangeData; 14 } // namespace ui 15 16 namespace wl { 17 18 // Tells if |mime_type| is supported for Drag and Drop operations. 19 bool IsMimeTypeSupported(const std::string& mime_type); 20 21 // Tells if |exchange_data| contains |mime_type| content. 22 bool ContainsMimeType(const ui::OSExchangeData& exchange_data, 23 const std::string& mime_type); 24 25 // Add clipboard |data| content with |mime_type| format to the |exchange_data|. 26 // |mime_type| is assumed to be supported (See IsMimeTypeSupported for more). 27 void AddToOSExchangeData(ui::PlatformClipboard::Data data, 28 const std::string& mime_type, 29 ui::OSExchangeData* exchange_data); 30 31 // Extract |exchange_data| of type |mime_type| and put it into |buffer|. If such 32 // mime type is not present, false is returned and |buffer| keeps untouched. 33 // |mime_type| is assumed to be supported (See IsMimeTypeSupported for more). 34 bool ExtractOSExchangeData(const ui::OSExchangeData& exchange_data, 35 const std::string& mime_type, 36 std::string* buffer); 37 38 } // namespace wl 39 40 #endif // UI_OZONE_PLATFORM_WAYLAND_COMMON_DATA_UTIL_H_ 41