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