| 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/files/file_path.h" |
| 19 #include "base/optional.h" |
| 18 #include "base/strings/nullable_string16.h" | 20 #include "base/strings/nullable_string16.h" |
| 19 #include "content/common/content_export.h" | 21 #include "content/common/content_export.h" |
| 20 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 21 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 23 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 22 #include "ui/base/dragdrop/file_info.h" | 24 #include "ui/base/dragdrop/file_info.h" |
| 23 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 24 | 26 |
| 25 namespace content { | 27 namespace content { |
| 26 | 28 |
| 27 struct CONTENT_EXPORT DropData { | 29 struct CONTENT_EXPORT DropData { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 53 Kind kind; | 55 Kind kind; |
| 54 base::string16 mime_type; | 56 base::string16 mime_type; |
| 55 base::FilePath filename; | 57 base::FilePath filename; |
| 56 GURL file_system_url; | 58 GURL file_system_url; |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 DropData(); | 61 DropData(); |
| 60 DropData(const DropData& other); | 62 DropData(const DropData& other); |
| 61 ~DropData(); | 63 ~DropData(); |
| 62 | 64 |
| 65 // Returns a sanitized filename to use for the dragged image, or base::nullopt |
| 66 // if no sanitized name could be synthesized. |
| 67 base::Optional<base::FilePath> GetSafeFilenameForImageFileContents() const; |
| 68 |
| 63 int view_id = MSG_ROUTING_NONE; | 69 int view_id = MSG_ROUTING_NONE; |
| 64 | 70 |
| 65 // Whether this drag originated from a renderer. | 71 // Whether this drag originated from a renderer. |
| 66 bool did_originate_from_renderer; | 72 bool did_originate_from_renderer; |
| 67 | 73 |
| 68 // User is dragging a link into the webview. | 74 // User is dragging a link or image. |
| 69 GURL url; | 75 GURL url; |
| 70 base::string16 url_title; // The title associated with |url|. | 76 base::string16 url_title; // The title associated with |url|. |
| 71 | 77 |
| 72 // User is dragging a link out-of the webview. | 78 // User is dragging a link out-of the webview. |
| 73 base::string16 download_metadata; | 79 base::string16 download_metadata; |
| 74 | 80 |
| 75 // Referrer policy to use when dragging a link out of the webview results in | 81 // Referrer policy to use when dragging a link out of the webview results in |
| 76 // a download. | 82 // a download. |
| 77 blink::WebReferrerPolicy referrer_policy; | 83 blink::WebReferrerPolicy referrer_policy; |
| 78 | 84 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 | 97 |
| 92 // User is dragging plain text into the webview. | 98 // User is dragging plain text into the webview. |
| 93 base::NullableString16 text; | 99 base::NullableString16 text; |
| 94 | 100 |
| 95 // User is dragging text/html into the webview (e.g., out of Firefox). | 101 // User is dragging text/html into the webview (e.g., out of Firefox). |
| 96 // |html_base_url| is the URL that the html fragment is taken from (used to | 102 // |html_base_url| is the URL that the html fragment is taken from (used to |
| 97 // resolve relative links). It's ok for |html_base_url| to be empty. | 103 // resolve relative links). It's ok for |html_base_url| to be empty. |
| 98 base::NullableString16 html; | 104 base::NullableString16 html; |
| 99 GURL html_base_url; | 105 GURL html_base_url; |
| 100 | 106 |
| 101 // User is dragging data from the webview (e.g., an image). | 107 // User is dragging an image out of the WebView. |
| 102 base::string16 file_description_filename; | |
| 103 std::string file_contents; | 108 std::string file_contents; |
| 109 GURL file_contents_source_url; |
| 110 base::FilePath::StringType file_contents_filename_extension; |
| 111 std::string file_contents_content_disposition; |
| 104 | 112 |
| 105 std::map<base::string16, base::string16> custom_data; | 113 std::map<base::string16, base::string16> custom_data; |
| 106 | 114 |
| 107 // The key-modifiers present for this update, included here so BrowserPlugin | 115 // The key-modifiers present for this update, included here so BrowserPlugin |
| 108 // can forward them to the guest renderer. | 116 // can forward them to the guest renderer. |
| 109 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes | 117 // TODO(wjmaclean): This can probably be removed when BrowserPlugin goes |
| 110 // away, https://crbug.com/533069. | 118 // away, https://crbug.com/533069. |
| 111 int key_modifiers; | 119 int key_modifiers; |
| 112 }; | 120 }; |
| 113 | 121 |
| 114 } // namespace content | 122 } // namespace content |
| 115 | 123 |
| 116 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ | 124 #endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ |
| OLD | NEW |