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

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: use static factory methods 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_
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 "third_party/WebKit/public/platform/WebReferrerPolicy.h" 20 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
21 #include "ui/base/dragdrop/file_info.h" 21 #include "ui/base/dragdrop/file_info.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 #if DCHECK_IS_ON()
25 #include "ipc/ipc_message.h"
26 #endif // DCHECK_IS_ON()
27
24 namespace content { 28 namespace content {
25 29
26 struct CONTENT_EXPORT DropData { 30 struct CONTENT_EXPORT DropData {
27 struct FileSystemFileInfo { 31 struct FileSystemFileInfo {
28 FileSystemFileInfo() : size(0) {} 32 FileSystemFileInfo() : size(0) {}
29 ~FileSystemFileInfo() {} 33 ~FileSystemFileInfo() {}
30 34
31 GURL url; 35 GURL url;
32 int64_t size; 36 int64_t size;
33 }; 37 };
34 38
39 enum class Kind {
40 STRING = 0,
41 FILENAME,
42 FILESYSTEMFILE,
43 LAST = FILESYSTEMFILE
44 };
45
46 struct Metadata {
47 Metadata();
48 static Metadata createForMimeType(const DropData::Kind& kind,
dcheng 2016/05/25 03:25:37 Nit: these should be capitalized. Also, DropData::
hush (inactive) 2016/05/25 17:17:15 Done.
49 const base::string16& mime_type);
50 static Metadata createForFilePath(const base::FilePath& filename);
51 static Metadata createForFileSystemUrl(const GURL& file_system_url);
52 Metadata(const Metadata& other);
53 ~Metadata();
54
55 DropData::Kind kind;
56 base::string16 mime_type;
57 base::FilePath filename;
58 GURL file_system_url;
59 };
60
35 DropData(); 61 DropData();
36 DropData(const DropData& other); 62 DropData(const DropData& other);
37 ~DropData(); 63 ~DropData();
38 64
65 #if DCHECK_IS_ON()
66 int view_id = MSG_ROUTING_NONE;
67 #endif // DCHECK_IS_ON()
68
39 // Whether this drag originated from a renderer. 69 // Whether this drag originated from a renderer.
40 bool did_originate_from_renderer; 70 bool did_originate_from_renderer;
41 71
42 // User is dragging a link into the webview. 72 // User is dragging a link into the webview.
43 GURL url; 73 GURL url;
44 base::string16 url_title; // The title associated with |url|. 74 base::string16 url_title; // The title associated with |url|.
45 75
46 // User is dragging a link out-of the webview. 76 // User is dragging a link out-of the webview.
47 base::string16 download_metadata; 77 base::string16 download_metadata;
48 78
49 // Referrer policy to use when dragging a link out of the webview results in 79 // Referrer policy to use when dragging a link out of the webview results in
50 // a download. 80 // a download.
51 blink::WebReferrerPolicy referrer_policy; 81 blink::WebReferrerPolicy referrer_policy;
52 82
53 // User is dropping one or more files on the webview. This field is only 83 // 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 84 // populated if the drag is not renderer tainted, as this allows File access
55 // from web content. 85 // from web content.
56 std::vector<ui::FileInfo> filenames; 86 std::vector<ui::FileInfo> filenames;
87 // The mime types of dragged files.
88 std::vector<base::string16> file_mime_types;
57 89
58 // Isolated filesystem ID for the files being dragged on the webview. 90 // Isolated filesystem ID for the files being dragged on the webview.
59 base::string16 filesystem_id; 91 base::string16 filesystem_id;
60 92
61 // User is dragging files specified with filesystem: URLs. 93 // User is dragging files specified with filesystem: URLs.
62 std::vector<FileSystemFileInfo> file_system_files; 94 std::vector<FileSystemFileInfo> file_system_files;
63 95
64 // User is dragging plain text into the webview. 96 // User is dragging plain text into the webview.
65 base::NullableString16 text; 97 base::NullableString16 text;
66 98
(...skipping 12 matching lines...) Expand all
79 // The key-modifiers present for this update, included here so BrowserPlugin 111 // The key-modifiers present for this update, included here so BrowserPlugin
80 // can forward them to the guest renderer. 112 // can forward them to the guest renderer.
81 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes 113 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes
82 // away, https://crbug.com/533069. 114 // away, https://crbug.com/533069.
83 int key_modifiers; 115 int key_modifiers;
84 }; 116 };
85 117
86 } // namespace content 118 } // namespace content
87 119
88 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 120 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698