Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: app/gtk_dnd_util.h

Issue 6250014: Move more dnd related files to ui/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/drag_drop_types_win.cc ('k') | app/gtk_dnd_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 APP_GTK_DND_UTIL_H_
6 #define APP_GTK_DND_UTIL_H_
7 #pragma once
8
9 #include <gtk/gtk.h>
10
11 #include <vector>
12
13 #include "base/string16.h"
14
15 class GURL;
16
17 namespace gtk_dnd_util {
18
19 // Registry of all internal int codes for drag and drop.
20 enum {
21 // Intra-application types.
22 CHROME_TAB = 1 << 0,
23 CHROME_BOOKMARK_ITEM = 1 << 1,
24 CHROME_WEBDROP_FILE_CONTENTS = 1 << 2,
25 CHROME_NAMED_URL = 1 << 3,
26
27 // Standard types.
28 TEXT_PLAIN = 1 << 4,
29 TEXT_URI_LIST = 1 << 5,
30 TEXT_HTML = 1 << 6,
31
32 // Other types. NETSCAPE_URL is provided for compatibility with other
33 // apps.
34 NETSCAPE_URL = 1 << 7,
35
36 // Used for drag-out download.
37 TEXT_PLAIN_NO_CHARSET = 1 << 8,
38 DIRECT_SAVE_FILE = 1 << 9,
39
40 INVALID_TARGET = 1 << 10,
41 };
42
43 // Get the atom for a given target (of the above enum type). Will return NULL
44 // for non-custom targets, such as CHROME_TEXT_PLAIN.
45 GdkAtom GetAtomForTarget(int target);
46
47 // Creates a target list from the given mask. The mask should be an OR of
48 // CHROME_* values. The target list is returned with ref count 1; the caller
49 // is responsible for calling gtk_target_list_unref() when it is no longer
50 // needed.
51 // Since the MIME type for WEBDROP_FILE_CONTENTS depends on the file's
52 // contents, that flag is ignored by this function. It is the responsibility
53 // of the client code to do the right thing.
54 GtkTargetList* GetTargetListFromCodeMask(int code_mask);
55
56 // Set the drag target list for |source| with the target list that
57 // corresponds to |code_mask|.
58 void SetSourceTargetListFromCodeMask(GtkWidget* source, int code_mask);
59
60 // Set the accepted targets list for |dest|. The |target_codes| array should
61 // be sorted in preference order and should be terminated with -1.
62 void SetDestTargetList(GtkWidget* dest, const int* target_codes);
63
64 // Write a URL to the selection in the given type.
65 void WriteURLWithName(GtkSelectionData* selection_data,
66 const GURL& url,
67 string16 title,
68 int type);
69
70 // Extracts data of type CHROME_NAMED_URL from |selection_data| into
71 // |url| and |title|. Returns true if the url/title were safely extracted
72 // and the url is valid.
73 bool ExtractNamedURL(GtkSelectionData* selection_data,
74 GURL* url,
75 string16* title);
76
77 // Extracts data of type TEXT_URI_LIST from |selection_data| into |urls|.
78 bool ExtractURIList(GtkSelectionData* selection_data,
79 std::vector<GURL>* urls);
80
81 // Extracts a Netscape URL (url\ntitle) from |selection_data|.
82 bool ExtractNetscapeURL(GtkSelectionData* selection_data,
83 GURL* url,
84 string16* title);
85
86 } // namespace gtk_dnd_util
87
88 #endif // APP_GTK_DND_UTIL_H_
OLDNEW
« no previous file with comments | « app/drag_drop_types_win.cc ('k') | app/gtk_dnd_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698