| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 webview. This represents a | 5 // A struct for managing data being dropped on a webview. This represents a |
| 6 // union of all the types of data that can be dropped in a platform neutral | 6 // union of all the types of data that can be dropped in a platform neutral |
| 7 // way. | 7 // way. |
| 8 | 8 |
| 9 #ifndef WEBKIT_GLUE_WEBDROPDATA_H_ | 9 #ifndef WEBKIT_GLUE_WEBDROPDATA_H_ |
| 10 #define WEBKIT_GLUE_WEBDROPDATA_H_ | 10 #define WEBKIT_GLUE_WEBDROPDATA_H_ |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/nullable_string16.h" | 16 #include "base/nullable_base::string16.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" | 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| 20 #include "webkit/glue/webkit_glue_export.h" | 20 #include "webkit/glue/webkit_glue_export.h" |
| 21 | 21 |
| 22 struct IDataObject; | 22 struct IDataObject; |
| 23 | 23 |
| 24 namespace WebKit { | 24 namespace WebKit { |
| 25 class WebDragData; | 25 class WebDragData; |
| 26 } | 26 } |
| 27 | 27 |
| 28 struct WEBKIT_GLUE_EXPORT WebDropData { | 28 struct WEBKIT_GLUE_EXPORT WebDropData { |
| 29 // The struct is used to represent a file in the drop data. | 29 // The struct is used to represent a file in the drop data. |
| 30 struct WEBKIT_GLUE_EXPORT FileInfo { | 30 struct WEBKIT_GLUE_EXPORT FileInfo { |
| 31 FileInfo(); | 31 FileInfo(); |
| 32 FileInfo(const string16& path, const string16& display_name); | 32 FileInfo(const base::string16& path, const base::string16& display_name); |
| 33 | 33 |
| 34 // The path of the file. | 34 // The path of the file. |
| 35 string16 path; | 35 base::string16 path; |
| 36 // The display name of the file. This field is optional. | 36 // The display name of the file. This field is optional. |
| 37 string16 display_name; | 37 base::string16 display_name; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // Construct from a WebDragData object. | 40 // Construct from a WebDragData object. |
| 41 explicit WebDropData(const WebKit::WebDragData&); | 41 explicit WebDropData(const WebKit::WebDragData&); |
| 42 | 42 |
| 43 WebDropData(); | 43 WebDropData(); |
| 44 | 44 |
| 45 ~WebDropData(); | 45 ~WebDropData(); |
| 46 | 46 |
| 47 // User is dragging a link into the webview. | 47 // User is dragging a link into the webview. |
| 48 GURL url; | 48 GURL url; |
| 49 string16 url_title; // The title associated with |url|. | 49 base::string16 url_title; // The title associated with |url|. |
| 50 | 50 |
| 51 // User is dragging a link out-of the webview. | 51 // User is dragging a link out-of the webview. |
| 52 string16 download_metadata; | 52 base::string16 download_metadata; |
| 53 | 53 |
| 54 // Referrer policy to use when dragging a link out of the webview results in | 54 // Referrer policy to use when dragging a link out of the webview results in |
| 55 // a download. | 55 // a download. |
| 56 WebKit::WebReferrerPolicy referrer_policy; | 56 WebKit::WebReferrerPolicy referrer_policy; |
| 57 | 57 |
| 58 // User is dropping one or more files on the webview. | 58 // User is dropping one or more files on the webview. |
| 59 std::vector<FileInfo> filenames; | 59 std::vector<FileInfo> filenames; |
| 60 | 60 |
| 61 // Isolated filesystem ID for the files being dragged on the webview. | 61 // Isolated filesystem ID for the files being dragged on the webview. |
| 62 string16 filesystem_id; | 62 base::string16 filesystem_id; |
| 63 | 63 |
| 64 // User is dragging plain text into the webview. | 64 // User is dragging plain text into the webview. |
| 65 NullableString16 text; | 65 NullableString16 text; |
| 66 | 66 |
| 67 // User is dragging text/html into the webview (e.g., out of Firefox). | 67 // User is dragging text/html into the webview (e.g., out of Firefox). |
| 68 // |html_base_url| is the URL that the html fragment is taken from (used to | 68 // |html_base_url| is the URL that the html fragment is taken from (used to |
| 69 // resolve relative links). It's ok for |html_base_url| to be empty. | 69 // resolve relative links). It's ok for |html_base_url| to be empty. |
| 70 NullableString16 html; | 70 NullableString16 html; |
| 71 GURL html_base_url; | 71 GURL html_base_url; |
| 72 | 72 |
| 73 // User is dragging data from the webview (e.g., an image). | 73 // User is dragging data from the webview (e.g., an image). |
| 74 string16 file_description_filename; | 74 base::string16 file_description_filename; |
| 75 std::string file_contents; | 75 std::string file_contents; |
| 76 | 76 |
| 77 std::map<string16, string16> custom_data; | 77 std::map<base::string16, base::string16> custom_data; |
| 78 | 78 |
| 79 // Convert to a WebDragData object. | 79 // Convert to a WebDragData object. |
| 80 WebKit::WebDragData ToDragData() const; | 80 WebKit::WebDragData ToDragData() const; |
| 81 | 81 |
| 82 // Helper method for converting Window's specific IDataObject to a WebDropData | 82 // Helper method for converting Window's specific IDataObject to a WebDropData |
| 83 // object. TODO(tc): Move this to the browser side since it's Windows | 83 // object. TODO(tc): Move this to the browser side since it's Windows |
| 84 // specific and no longer used in webkit. | 84 // specific and no longer used in webkit. |
| 85 static void PopulateWebDropData(IDataObject* data_object, | 85 static void PopulateWebDropData(IDataObject* data_object, |
| 86 WebDropData* drop_data); | 86 WebDropData* drop_data); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #endif // WEBKIT_GLUE_WEBDROPDATA_H_ | 89 #endif // WEBKIT_GLUE_WEBDROPDATA_H_ |
| OLD | NEW |