| 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 <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. |
| 68 bool has_url; |
| 43 GURL url; | 69 GURL url; |
| 44 base::string16 url_title; // The title associated with |url|. | 70 base::string16 url_title; // The title associated with |url|. |
| 45 | 71 |
| 46 // User is dragging a link out-of the webview. | 72 // User is dragging a link out-of the webview. |
| 47 base::string16 download_metadata; | 73 base::string16 download_metadata; |
| 48 | 74 |
| 49 // Referrer policy to use when dragging a link out of the webview results in | 75 // Referrer policy to use when dragging a link out of the webview results in |
| 50 // a download. | 76 // a download. |
| 51 blink::WebReferrerPolicy referrer_policy; | 77 blink::WebReferrerPolicy referrer_policy; |
| 52 | 78 |
| 53 // User is dropping one or more files on the webview. This field is only | 79 // 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 | 80 // populated if the drag is not renderer tainted, as this allows File access |
| 55 // from web content. | 81 // from web content. |
| 56 std::vector<ui::FileInfo> filenames; | 82 std::vector<ui::FileInfo> filenames; |
| 83 // The mime types of dragged files. |
| 84 std::vector<base::string16> file_mime_types; |
| 57 | 85 |
| 58 // Isolated filesystem ID for the files being dragged on the webview. | 86 // Isolated filesystem ID for the files being dragged on the webview. |
| 59 base::string16 filesystem_id; | 87 base::string16 filesystem_id; |
| 60 | 88 |
| 61 // User is dragging files specified with filesystem: URLs. | 89 // User is dragging files specified with filesystem: URLs. |
| 62 std::vector<FileSystemFileInfo> file_system_files; | 90 std::vector<FileSystemFileInfo> file_system_files; |
| 63 | 91 |
| 64 // User is dragging plain text into the webview. | 92 // User is dragging plain text into the webview. |
| 65 base::NullableString16 text; | 93 base::NullableString16 text; |
| 66 | 94 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 // The key-modifiers present for this update, included here so BrowserPlugin | 107 // The key-modifiers present for this update, included here so BrowserPlugin |
| 80 // can forward them to the guest renderer. | 108 // can forward them to the guest renderer. |
| 81 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes | 109 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes |
| 82 // away, https://crbug.com/533069. | 110 // away, https://crbug.com/533069. |
| 83 int key_modifiers; | 111 int key_modifiers; |
| 84 }; | 112 }; |
| 85 | 113 |
| 86 } // namespace content | 114 } // namespace content |
| 87 | 115 |
| 88 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ | 116 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ |
| OLD | NEW |