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.
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
9 #ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_
10 #define CONTENT_PUBLIC_COMMON_DROP_DATA_H_
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 "ui/base/dragdrop/file_info.h"
24 struct CONTENT_EXPORT DropData
{
25 struct FileSystemFileInfo
{
26 FileSystemFileInfo() : size(0) {}
27 ~FileSystemFileInfo() {}
36 // Whether this drag originated from a renderer.
37 bool did_originate_from_renderer
;
39 // User is dragging a link into the webview.
41 base::string16 url_title
; // The title associated with |url|.
43 // User is dragging a link out-of the webview.
44 base::string16 download_metadata
;
46 // Referrer policy to use when dragging a link out of the webview results in
48 blink::WebReferrerPolicy referrer_policy
;
50 // User is dropping one or more files on the webview. This field is only
51 // populated if the drag is not renderer tainted, as this allows File access
53 std::vector
<ui::FileInfo
> filenames
;
55 // Isolated filesystem ID for the files being dragged on the webview.
56 base::string16 filesystem_id
;
58 // User is dragging files specified with filesystem: URLs.
59 std::vector
<FileSystemFileInfo
> file_system_files
;
61 // User is dragging plain text into the webview.
62 base::NullableString16 text
;
64 // User is dragging text/html into the webview (e.g., out of Firefox).
65 // |html_base_url| is the URL that the html fragment is taken from (used to
66 // resolve relative links). It's ok for |html_base_url| to be empty.
67 base::NullableString16 html
;
70 // User is dragging data from the webview (e.g., an image).
71 base::string16 file_description_filename
;
72 std::string file_contents
;
74 std::map
<base::string16
, base::string16
> custom_data
;
77 } // namespace content
79 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_