Home | History | Annotate | Download | only in glue
      1 // Copyright (c) 2006-2008 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 webview.  This represents a
      6 // union of all the types of data that can be dropped in a platform neutral
      7 // way.
      8 
      9 #ifndef WEBKIT_GLUE_WEBDROPDATA_H_
     10 #define WEBKIT_GLUE_WEBDROPDATA_H_
     11 
     12 #include <string>
     13 #include <vector>
     14 
     15 #include "base/string16.h"
     16 #include "googleurl/src/gurl.h"
     17 
     18 struct IDataObject;
     19 
     20 namespace WebKit {
     21 class WebDragData;
     22 }
     23 
     24 struct WebDropData {
     25   // Construct from a WebDragData object.
     26   explicit WebDropData(const WebKit::WebDragData&);
     27 
     28   WebDropData();
     29 
     30   ~WebDropData();
     31 
     32   // User is dragging a link into the webview.
     33   GURL url;
     34   string16 url_title;  // The title associated with |url|.
     35 
     36   // User is dragging a link out-of the webview.
     37   string16 download_metadata;
     38 
     39   // File extension for dragging images from a webview to the desktop.
     40   string16 file_extension;
     41 
     42   // User is dropping one or more files on the webview.
     43   std::vector<string16> filenames;
     44 
     45   // User is dragging plain text into the webview.
     46   string16 plain_text;
     47 
     48   // User is dragging text/html into the webview (e.g., out of Firefox).
     49   // |html_base_url| is the URL that the html fragment is taken from (used to
     50   // resolve relative links).  It's ok for |html_base_url| to be empty.
     51   string16 text_html;
     52   GURL html_base_url;
     53 
     54   // User is dragging data from the webview (e.g., an image).
     55   string16 file_description_filename;
     56   std::string file_contents;
     57 
     58   // Convert to a WebDragData object.
     59   WebKit::WebDragData ToDragData() const;
     60 
     61   // Helper method for converting Window's specific IDataObject to a WebDropData
     62   // object.  TODO(tc): Move this to the browser side since it's Windows
     63   // specific and no longer used in webkit.
     64   static void PopulateWebDropData(IDataObject* data_object,
     65                                   WebDropData* drop_data);
     66 };
     67 
     68 #endif  // WEBKIT_GLUE_WEBDROPDATA_H_
     69