drop_data.h revision effb81e5f8246d0db0270817048dc992db66e9fb
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 3// found in the LICENSE file. 4 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 7// way. 8 9#ifndef CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 10#define CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 11 12#include <map> 13#include <string> 14#include <vector> 15 16#include "base/strings/nullable_string16.h" 17#include "content/common/content_export.h" 18#include "third_party/WebKit/public/platform/WebReferrerPolicy.h" 19#include "ui/base/dragdrop/file_info.h" 20#include "url/gurl.h" 21 22namespace content { 23 24struct CONTENT_EXPORT DropData { 25 DropData(); 26 ~DropData(); 27 28 // Whether this drag originated from a renderer. 29 bool did_originate_from_renderer; 30 31 // User is dragging a link into the webview. 32 GURL url; 33 base::string16 url_title; // The title associated with |url|. 34 35 // User is dragging a link out-of the webview. 36 base::string16 download_metadata; 37 38 // Referrer policy to use when dragging a link out of the webview results in 39 // a download. 40 blink::WebReferrerPolicy referrer_policy; 41 42 // User is dropping one or more files on the webview. This field is only 43 // populated if the drag is not renderer tainted, as this allows File access 44 // from web content. 45 std::vector<ui::FileInfo> filenames; 46 47 // Isolated filesystem ID for the files being dragged on the webview. 48 base::string16 filesystem_id; 49 50 // User is dragging plain text into the webview. 51 base::NullableString16 text; 52 53 // User is dragging text/html into the webview (e.g., out of Firefox). 54 // |html_base_url| is the URL that the html fragment is taken from (used to 55 // resolve relative links). It's ok for |html_base_url| to be empty. 56 base::NullableString16 html; 57 GURL html_base_url; 58 59 // User is dragging data from the webview (e.g., an image). 60 base::string16 file_description_filename; 61 std::string file_contents; 62 63 std::map<base::string16, base::string16> custom_data; 64}; 65 66} // namespace content 67 68#endif // CONTENT_PUBLIC_COMMON_DROP_DATA_H_ 69