Relands drop support:

Adds drop support for views on gtk. As X lazily provides drop data I
needed to tweak the views API a bit.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/173025

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23690 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/views/view.h b/views/view.h
index ba892c1..66ef76f 100644
--- a/views/view.h
+++ b/views/view.h
@@ -9,9 +9,11 @@
 
 #include <algorithm>
 #include <map>
+#include <set>
 #include <string>
 #include <vector>
 
+#include "app/os_exchange_data.h"
 #include "base/gfx/native_widget_types.h"
 #include "base/gfx/rect.h"
 #include "base/scoped_ptr.h"
@@ -20,17 +22,12 @@
 #include "views/background.h"
 #include "views/border.h"
 
-#if defined(OS_WIN)
-struct IDataObject;
-#endif  // defined(OS_WIN)
-
 namespace gfx {
 class Canvas;
 class Insets;
 class Path;
 }
 
-class OSExchangeData;
 class ViewAccessibilityWrapper;
 class ThemeProvider;
 
@@ -742,9 +739,12 @@
   DragController* GetDragController();
 
   // During a drag and drop session when the mouse moves the view under the
-  // mouse is queried to see if it should be a target for the drag and drop
-  // session. A view indicates it is a valid target by returning true from
-  // CanDrop. If a view returns true from CanDrop,
+  // mouse is queried for the drop types it supports by way of the
+  // GetDropFormats methods. If the view returns true and the drag site can
+  // provide data in one of the formats, the view is asked if the drop data
+  // is required before any other drop events are sent. Once the
+  // data is available the view is asked if it supports the drop (by way of
+  // the CanDrop method). If a view returns true from CanDrop,
   // OnDragEntered is sent to the view when the mouse first enters the view,
   // as the mouse moves around within the view OnDragUpdated is invoked.
   // If the user releases the mouse over the view and OnDragUpdated returns a
@@ -756,6 +756,18 @@
   // the mouse does not support the drop, the ancestors are walked until one
   // is found that supports the drop.
 
+  // Override and return the set of formats that can be dropped on this view.
+  // |formats| is a bitmask of the formats defined bye OSExchangeData::Format.
+  // The default implementation returns false, which means the view doesn't
+  // support dropping.
+  virtual bool GetDropFormats(
+      int* formats,
+      std::set<OSExchangeData::CustomFormat>* custom_formats);
+
+  // Override and return true if the data must be available before any drop
+  // methods should be invoked. The default is false.
+  virtual bool AreDropTypesRequired();
+
   // A view that supports drag and drop must override this and return true if
   // data contains a type that may be dropped on this view.
   virtual bool CanDrop(const OSExchangeData& data);