OLD | NEW |
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_ |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/strings/nullable_string16.h" | 16 #include "base/strings/nullable_string16.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 18 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 19 #include "ui/base/dragdrop/file_info.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 struct CONTENT_EXPORT DropData { | 24 struct CONTENT_EXPORT DropData { |
24 // The struct is used to represent a file in the drop data. | |
25 struct CONTENT_EXPORT FileInfo { | |
26 FileInfo(); | |
27 FileInfo(const base::string16& path, const base::string16& display_name); | |
28 | |
29 // The path of the file. | |
30 base::string16 path; | |
31 // The display name of the file. This field is optional. | |
32 base::string16 display_name; | |
33 }; | |
34 | |
35 DropData(); | 25 DropData(); |
36 ~DropData(); | 26 ~DropData(); |
37 | 27 |
38 // Whether this drag originated from a renderer. | 28 // Whether this drag originated from a renderer. |
39 bool did_originate_from_renderer; | 29 bool did_originate_from_renderer; |
40 | 30 |
41 // User is dragging a link into the webview. | 31 // User is dragging a link into the webview. |
42 GURL url; | 32 GURL url; |
43 base::string16 url_title; // The title associated with |url|. | 33 base::string16 url_title; // The title associated with |url|. |
44 | 34 |
45 // User is dragging a link out-of the webview. | 35 // User is dragging a link out-of the webview. |
46 base::string16 download_metadata; | 36 base::string16 download_metadata; |
47 | 37 |
48 // Referrer policy to use when dragging a link out of the webview results in | 38 // Referrer policy to use when dragging a link out of the webview results in |
49 // a download. | 39 // a download. |
50 blink::WebReferrerPolicy referrer_policy; | 40 blink::WebReferrerPolicy referrer_policy; |
51 | 41 |
52 // User is dropping one or more files on the webview. This field is only | 42 // User is dropping one or more files on the webview. This field is only |
53 // populated if the drag is not renderer tainted, as this allows File access | 43 // populated if the drag is not renderer tainted, as this allows File access |
54 // from web content. | 44 // from web content. |
55 std::vector<FileInfo> filenames; | 45 std::vector<ui::FileInfo> filenames; |
56 | 46 |
57 // Isolated filesystem ID for the files being dragged on the webview. | 47 // Isolated filesystem ID for the files being dragged on the webview. |
58 base::string16 filesystem_id; | 48 base::string16 filesystem_id; |
59 | 49 |
60 // User is dragging plain text into the webview. | 50 // User is dragging plain text into the webview. |
61 base::NullableString16 text; | 51 base::NullableString16 text; |
62 | 52 |
63 // User is dragging text/html into the webview (e.g., out of Firefox). | 53 // User is dragging text/html into the webview (e.g., out of Firefox). |
64 // |html_base_url| is the URL that the html fragment is taken from (used to | 54 // |html_base_url| is the URL that the html fragment is taken from (used to |
65 // resolve relative links). It's ok for |html_base_url| to be empty. | 55 // resolve relative links). It's ok for |html_base_url| to be empty. |
66 base::NullableString16 html; | 56 base::NullableString16 html; |
67 GURL html_base_url; | 57 GURL html_base_url; |
68 | 58 |
69 // User is dragging data from the webview (e.g., an image). | 59 // User is dragging data from the webview (e.g., an image). |
70 base::string16 file_description_filename; | 60 base::string16 file_description_filename; |
71 std::string file_contents; | 61 std::string file_contents; |
72 | 62 |
73 std::map<base::string16, base::string16> custom_data; | 63 std::map<base::string16, base::string16> custom_data; |
74 }; | 64 }; |
75 | 65 |
76 } // namespace content | 66 } // namespace content |
77 | 67 |
78 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ | 68 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ |
OLD | NEW |