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 3 // found in the LICENSE file. 4 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 7 // way. 8 9 #ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 10 #define CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 11 12 #include <map> 13 #include <string> 14 #include <vector> 15 16 #include "base/strings/nullable_string16.h" 17 #include "content/common/content_export.h" 18 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 19 #include "url/gurl.h" 20 21 namespace content { 22 23 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(); 36 ~DropData(); 37 38 // User is dragging a link into the webview. 39 GURL url; 40 base::string16 url_title; // The title associated with |url|. 41 42 // User is dragging a link out-of the webview. 43 base::string16 download_metadata; 44 45 // Referrer policy to use when dragging a link out of the webview results in 46 // a download. 47 blink::WebReferrerPolicy referrer_policy; 48 49 // User is dropping one or more files on the webview. 50 std::vector<FileInfo> filenames; 51 52 // Isolated filesystem ID for the files being dragged on the webview. 53 base::string16 filesystem_id; 54 55 // User is dragging plain text into the webview. 56 base::NullableString16 text; 57 58 // User is dragging text/html into the webview (e.g., out of Firefox). 59 // |html_base_url| is the URL that the html fragment is taken from (used to 60 // resolve relative links). It's ok for |html_base_url| to be empty. 61 base::NullableString16 html; 62 GURL html_base_url; 63 64 // User is dragging data from the webview (e.g., an image). 65 base::string16 file_description_filename; 66 std::string file_contents; 67 68 std::map<base::string16, base::string16> custom_data; 69 }; 70 71 } // namespace content 72 73 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 74