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

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: review Created 4 years, 6 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
« no previous file with comments | « content/public/browser/render_view_host.h ('k') | content/public/common/drop_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/strings/nullable_string16.h" 18 #include "base/strings/nullable_string16.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "ipc/ipc_message.h"
20 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 21 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
21 #include "ui/base/dragdrop/file_info.h" 22 #include "ui/base/dragdrop/file_info.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 namespace content { 25 namespace content {
25 26
26 struct CONTENT_EXPORT DropData { 27 struct CONTENT_EXPORT DropData {
27 struct FileSystemFileInfo { 28 struct FileSystemFileInfo {
28 FileSystemFileInfo() : size(0) {} 29 FileSystemFileInfo() : size(0) {}
29 ~FileSystemFileInfo() {} 30 ~FileSystemFileInfo() {}
30 31
31 GURL url; 32 GURL url;
32 int64_t size; 33 int64_t size;
33 }; 34 };
34 35
36 enum class Kind {
37 STRING = 0,
38 FILENAME,
39 FILESYSTEMFILE,
40 LAST = FILESYSTEMFILE
41 };
42
43 struct Metadata {
44 Metadata();
45 static Metadata CreateForMimeType(const Kind& kind,
46 const base::string16& mime_type);
47 static Metadata CreateForFilePath(const base::FilePath& filename);
48 static Metadata CreateForFileSystemUrl(const GURL& file_system_url);
49 Metadata(const Metadata& other);
50 ~Metadata();
51
52 Kind kind;
53 base::string16 mime_type;
54 base::FilePath filename;
55 GURL file_system_url;
56 };
57
35 DropData(); 58 DropData();
36 DropData(const DropData& other); 59 DropData(const DropData& other);
37 ~DropData(); 60 ~DropData();
38 61
62 int view_id = MSG_ROUTING_NONE;
63
39 // Whether this drag originated from a renderer. 64 // Whether this drag originated from a renderer.
40 bool did_originate_from_renderer; 65 bool did_originate_from_renderer;
41 66
42 // User is dragging a link into the webview. 67 // User is dragging a link into the webview.
43 GURL url; 68 GURL url;
44 base::string16 url_title; // The title associated with |url|. 69 base::string16 url_title; // The title associated with |url|.
45 70
46 // User is dragging a link out-of the webview. 71 // User is dragging a link out-of the webview.
47 base::string16 download_metadata; 72 base::string16 download_metadata;
48 73
49 // Referrer policy to use when dragging a link out of the webview results in 74 // Referrer policy to use when dragging a link out of the webview results in
50 // a download. 75 // a download.
51 blink::WebReferrerPolicy referrer_policy; 76 blink::WebReferrerPolicy referrer_policy;
52 77
53 // User is dropping one or more files on the webview. This field is only 78 // 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 79 // populated if the drag is not renderer tainted, as this allows File access
55 // from web content. 80 // from web content.
56 std::vector<ui::FileInfo> filenames; 81 std::vector<ui::FileInfo> filenames;
82 // The mime types of dragged files.
83 std::vector<base::string16> file_mime_types;
57 84
58 // Isolated filesystem ID for the files being dragged on the webview. 85 // Isolated filesystem ID for the files being dragged on the webview.
59 base::string16 filesystem_id; 86 base::string16 filesystem_id;
60 87
61 // User is dragging files specified with filesystem: URLs. 88 // User is dragging files specified with filesystem: URLs.
62 std::vector<FileSystemFileInfo> file_system_files; 89 std::vector<FileSystemFileInfo> file_system_files;
63 90
64 // User is dragging plain text into the webview. 91 // User is dragging plain text into the webview.
65 base::NullableString16 text; 92 base::NullableString16 text;
66 93
(...skipping 12 matching lines...) Expand all
79 // The key-modifiers present for this update, included here so BrowserPlugin 106 // The key-modifiers present for this update, included here so BrowserPlugin
80 // can forward them to the guest renderer. 107 // can forward them to the guest renderer.
81 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes 108 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes
82 // away, https://crbug.com/533069. 109 // away, https://crbug.com/533069.
83 int key_modifiers; 110 int key_modifiers;
84 }; 111 };
85 112
86 } // namespace content 113 } // namespace content
87 114
88 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 115 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_
OLDNEW
« no previous file with comments | « content/public/browser/render_view_host.h ('k') | content/public/common/drop_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698