• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public
8  *  License as published by the Free Software Foundation; either
9  *  version 2 of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #include "config.h"
22 #include "PasteboardHelperGtk.h"
23 
24 #include "DataObjectGtk.h"
25 #include "FocusController.h"
26 #include "Frame.h"
27 #include "webkitwebframe.h"
28 #include "webkitwebview.h"
29 #include "webkitwebviewprivate.h"
30 #include <gtk/gtk.h>
31 
32 using namespace WebCore;
33 
34 namespace WebKit {
35 
PasteboardHelperGtk()36 PasteboardHelperGtk::PasteboardHelperGtk()
37 {
38     initializeTargetList();
39 }
40 
~PasteboardHelperGtk()41 PasteboardHelperGtk::~PasteboardHelperGtk()
42 {
43 }
44 
getIdForTargetType(PasteboardTargetType type)45 guint PasteboardHelperGtk::getIdForTargetType(PasteboardTargetType type)
46 {
47     if (type == TargetTypeMarkup)
48         return WEBKIT_WEB_VIEW_TARGET_INFO_HTML;
49     if (type == TargetTypeImage)
50         return WEBKIT_WEB_VIEW_TARGET_INFO_IMAGE;
51     if (type == TargetTypeURIList)
52         return WEBKIT_WEB_VIEW_TARGET_INFO_URI_LIST;
53     if (type == TargetTypeNetscapeURL)
54         return WEBKIT_WEB_VIEW_TARGET_INFO_NETSCAPE_URL;
55 
56     return WEBKIT_WEB_VIEW_TARGET_INFO_TEXT;
57 }
58 
usePrimarySelectionClipboard(GtkWidget * widget)59 bool PasteboardHelperGtk::usePrimarySelectionClipboard(GtkWidget* widget)
60 {
61     return webkit_web_view_use_primary_for_paste(WEBKIT_WEB_VIEW((widget)));
62 }
63 
64 }
65