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

Side by Side Diff: content/public/common/drop_data.h

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A struct for managing data being dropped on a WebContents. This represents 5 // A struct for managing data being dropped on a WebContents. This represents
6 // a union of all the types of data that can be dropped in a platform neutral 6 // a union of all the types of data that can be dropped in a platform neutral
7 // way. 7 // way.
8 8
9 #ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 9 #ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_
10 #define CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 10 #define CONTENT_PUBLIC_COMMON_DROP_DATA_H_
(...skipping 14 matching lines...) Expand all
25 25
26 struct CONTENT_EXPORT DropData { 26 struct CONTENT_EXPORT DropData {
27 struct FileSystemFileInfo { 27 struct FileSystemFileInfo {
28 FileSystemFileInfo() : size(0) {} 28 FileSystemFileInfo() : size(0) {}
29 ~FileSystemFileInfo() {} 29 ~FileSystemFileInfo() {}
30 30
31 GURL url; 31 GURL url;
32 int64_t size; 32 int64_t size;
33 }; 33 };
34 34
35 enum class Kind {
36 STRING = 0,
37 FILENAME,
38 FILESYSTEMFILE,
39 LAST = FILESYSTEMFILE
40 };
41
42 struct MetaData {
43 MetaData();
44 MetaData(const DropData::Kind& kind, const base::string16& mime_type);
45 MetaData(const DropData::Kind& kind, const base::FilePath& filename);
46 MetaData(const DropData::Kind& kind, const GURL& file_system_url);
47 MetaData(const MetaData& other);
48 ~MetaData();
49
50 DropData::Kind kind;
51 base::string16 mime_type;
52 base::FilePath filename;
53 GURL file_system_url;
54 };
55
35 DropData(); 56 DropData();
36 DropData(const DropData& other); 57 DropData(const DropData& other);
37 ~DropData(); 58 ~DropData();
38 59
39 // Whether this drag originated from a renderer. 60 // Whether this drag originated from a renderer.
40 bool did_originate_from_renderer; 61 bool did_originate_from_renderer;
41 62
42 // User is dragging a link into the webview. 63 // User is dragging a link into the webview.
43 GURL url; 64 GURL url;
44 base::string16 url_title; // The title associated with |url|. 65 base::string16 url_title; // The title associated with |url|.
45 66
46 // User is dragging a link out-of the webview. 67 // User is dragging a link out-of the webview.
47 base::string16 download_metadata; 68 base::string16 download_metadata;
48 69
49 // Referrer policy to use when dragging a link out of the webview results in 70 // Referrer policy to use when dragging a link out of the webview results in
50 // a download. 71 // a download.
51 blink::WebReferrerPolicy referrer_policy; 72 blink::WebReferrerPolicy referrer_policy;
52 73
53 // User is dropping one or more files on the webview. This field is only 74 // User is dropping one or more files on the webview. This field is only
54 // populated if the drag is not renderer tainted, as this allows File access 75 // populated if the drag is not renderer tainted, as this allows File access
55 // from web content. 76 // from web content.
56 std::vector<ui::FileInfo> filenames; 77 std::vector<ui::FileInfo> filenames;
78 // The mime types of dragged files.
79 std::vector<base::string16> file_mime_types;
57 80
58 // Isolated filesystem ID for the files being dragged on the webview. 81 // Isolated filesystem ID for the files being dragged on the webview.
59 base::string16 filesystem_id; 82 base::string16 filesystem_id;
60 83
61 // User is dragging files specified with filesystem: URLs. 84 // User is dragging files specified with filesystem: URLs.
62 std::vector<FileSystemFileInfo> file_system_files; 85 std::vector<FileSystemFileInfo> file_system_files;
63 86
64 // User is dragging plain text into the webview. 87 // User is dragging plain text into the webview.
65 base::NullableString16 text; 88 base::NullableString16 text;
66 89
67 // User is dragging text/html into the webview (e.g., out of Firefox). 90 // User is dragging text/html into the webview (e.g., out of Firefox).
68 // |html_base_url| is the URL that the html fragment is taken from (used to 91 // |html_base_url| is the URL that the html fragment is taken from (used to
69 // resolve relative links). It's ok for |html_base_url| to be empty. 92 // resolve relative links). It's ok for |html_base_url| to be empty.
70 base::NullableString16 html; 93 base::NullableString16 html;
71 GURL html_base_url; 94 GURL html_base_url;
72 95
73 // User is dragging data from the webview (e.g., an image). 96 // User is dragging data from the webview (e.g., an image).
74 base::string16 file_description_filename; 97 base::string16 file_description_filename;
75 std::string file_contents; 98 std::string file_contents;
76 99
77 std::map<base::string16, base::string16> custom_data; 100 std::map<base::string16, base::string16> custom_data;
78 }; 101 };
79 102
80 } // namespace content 103 } // namespace content
81 104
82 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 105 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698