| 1 | /* | 
| 2 |  * Copyright (C) 2007 Luca Bruno <lethalman88@gmail.com> | 
| 3 |  * Copyright (C) 2009 Holger Hans Peter Freyther | 
| 4 |  * Copyright (C) 2010 Martin Robinson <mrobinson@webkit.org> | 
| 5 |  * Copyright (C) 2010 Igalia S.L. | 
| 6 |  * All rights reserved. | 
| 7 |  * | 
| 8 |  * This library is free software; you can redistribute it and/or | 
| 9 |  * modify it under the terms of the GNU Library General Public | 
| 10 |  * License as published by the Free Software Foundation; either | 
| 11 |  * version 2 of the License, or (at your option) any later version. | 
| 12 |  * | 
| 13 |  * This library is distributed in the hope that it will be useful, | 
| 14 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 15 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
| 16 |  * Library General Public License for more details. | 
| 17 |  * | 
| 18 |  * You should have received a copy of the GNU Library General Public License | 
| 19 |  * along with this library; see the file COPYING.LIB.  If not, write to | 
| 20 |  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 
| 21 |  * Boston, MA 02110-1301, USA. | 
| 22 |  * | 
| 23 |  */ | 
| 24 |  | 
| 25 | #ifndef PasteboardHelper_h | 
| 26 | #define PasteboardHelper_h | 
| 27 |  | 
| 28 | #include "GRefPtrGtk.h" | 
| 29 | #include <wtf/Function.h> | 
| 30 | #include <wtf/Noncopyable.h> | 
| 31 | #include <wtf/Vector.h> | 
| 32 |  | 
| 33 | namespace WebCore { | 
| 34 |  | 
| 35 | class SelectionData; | 
| 36 |  | 
| 37 | class PasteboardHelper { | 
| 38 |     WTF_MAKE_NONCOPYABLE(PasteboardHelper); | 
| 39 | public: | 
| 40 |     static PasteboardHelper& singleton(); | 
| 41 |  | 
| 42 |     enum SmartPasteInclusion { IncludeSmartPaste, DoNotIncludeSmartPaste }; | 
| 43 |  | 
| 44 |     GtkTargetList* targetList() const; | 
| 45 |     GRefPtr<GtkTargetList> targetListForSelectionData(const SelectionData&); | 
| 46 |     void fillSelectionData(const SelectionData&, unsigned, GtkSelectionData*); | 
| 47 |     void fillSelectionData(GtkSelectionData*, unsigned, SelectionData&); | 
| 48 |     Vector<GdkAtom> dropAtomsForContext(GtkWidget*, GdkDragContext*); | 
| 49 |     void writeClipboardContents(GtkClipboard*, const SelectionData&, WTF::Function<void()>&& primarySelectionCleared = nullptr); | 
| 50 |     void getClipboardContents(GtkClipboard*, SelectionData&); | 
| 51 |  | 
| 52 |     enum PasteboardTargetType { TargetTypeMarkup, TargetTypeText, TargetTypeImage, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeSmartPaste, TargetTypeUnknown }; | 
| 53 |  | 
| 54 | private: | 
| 55 |     PasteboardHelper(); | 
| 56 |     ~PasteboardHelper(); | 
| 57 |  | 
| 58 |     GRefPtr<GtkTargetList> m_targetList; | 
| 59 | }; | 
| 60 |  | 
| 61 | } | 
| 62 |  | 
| 63 | #endif // PasteboardHelper_h | 
| 64 |  |