summaryrefslogtreecommitdiffstats
path: root/ui/aura/client
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-17 05:18:16 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-17 05:18:16 +0000
commit084b6bb674002dddd9839248c3cc6b7d6c6dc4c7 (patch)
tree8ee9a95ca4e37a038f7f41468d16d18ea0b87850 /ui/aura/client
parent211921f6b78bd093aa181c57c09095c8732f567c (diff)
downloadchromium_src-084b6bb674002dddd9839248c3cc6b7d6c6dc4c7.zip
chromium_src-084b6bb674002dddd9839248c3cc6b7d6c6dc4c7.tar.gz
chromium_src-084b6bb674002dddd9839248c3cc6b7d6c6dc4c7.tar.bz2
First shot at implementing drag&drop for Aura
BUG=97845 TEST=none Review URL: http://codereview.chromium.org/8450018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110437 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/client')
-rw-r--r--ui/aura/client/aura_constants.cc2
-rw-r--r--ui/aura/client/aura_constants.h7
-rw-r--r--ui/aura/client/drag_drop_client.h41
-rw-r--r--ui/aura/client/window_drag_drop_delegate.h48
4 files changed, 98 insertions, 0 deletions
diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc
index 31c0566..32c8284 100644
--- a/ui/aura/client/aura_constants.cc
+++ b/ui/aura/client/aura_constants.cc
@@ -11,5 +11,7 @@ const char kRestoreBoundsKey[] = "RestoreBoundsKey";
const char kShowStateKey[] = "ShowStateKey";
const char kTooltipTextKey[] = "TooltipTextKey";
const char kModalKey[] = "ModalKey";
+const char kDesktopDragDropClientKey[] = "DesktopDragDropClientKey";
+const char kDragDropDelegateKey[] = "DragDropDelegateKey";
} // namespace aura
diff --git a/ui/aura/client/aura_constants.h b/ui/aura/client/aura_constants.h
index 4f13103..180d0e8 100644
--- a/ui/aura/client/aura_constants.h
+++ b/ui/aura/client/aura_constants.h
@@ -29,6 +29,13 @@ AURA_EXPORT extern const char kTooltipTextKey[];
// A property key to store the boolean property of window modality.
AURA_EXPORT extern const char kModalKey[];
+// A property key to store the drag and drop client for the desktop. The type of
+// the value is |aura::DragDropClient*|.
+AURA_EXPORT extern const char kDesktopDragDropClientKey[];
+
+// A property key to store the drag and drop delegate for a window. The type of
+// the value is |aura::WindowDragDropDelegate*|.
+AURA_EXPORT extern const char kDragDropDelegateKey[];
} // namespace aura
#endif // UI_AURA_CLIENT_AURA_CONSTANTS_H_
diff --git a/ui/aura/client/drag_drop_client.h b/ui/aura/client/drag_drop_client.h
new file mode 100644
index 0000000..68ed6ea
--- /dev/null
+++ b/ui/aura/client/drag_drop_client.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_
+#define UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_
+#pragma once
+
+#include "ui/aura/aura_export.h"
+#include "ui/aura/event.h"
+
+namespace ui {
+class OSExchangeData;
+}
+
+namespace aura {
+
+class Window;
+
+// An interface implemented by an object that controls a drag and drop session.
+class AURA_EXPORT DragDropClient {
+ public:
+ virtual ~DragDropClient() {}
+
+ // Initiates a drag and drop session
+ virtual void StartDragAndDrop(const ui::OSExchangeData& data,
+ int operation) = 0;
+
+ // Called when mouse is dragged during a drag and drop.
+ virtual void DragUpdate(aura::Window* target, const MouseEvent& event) = 0;
+
+ // Called when mouse is released during a drag and drop.
+ virtual void Drop(aura::Window* target, const MouseEvent& event) = 0;
+
+ // Called when a drag and drop session is cancelled.
+ virtual void DragCancel() = 0;
+};
+
+} // namespace aura
+
+#endif // UI_AURA_CLIENT_DRAG_DROP_CLIENT_H_
diff --git a/ui/aura/client/window_drag_drop_delegate.h b/ui/aura/client/window_drag_drop_delegate.h
new file mode 100644
index 0000000..866035b
--- /dev/null
+++ b/ui/aura/client/window_drag_drop_delegate.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_
+#define UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_
+#pragma once
+
+#include "ui/aura/aura_export.h"
+
+namespace aura {
+
+class DropTargetEvent;
+
+// Delegate interface for drag and drop actions on aura::Window.
+class AURA_EXPORT WindowDragDropDelegate {
+ public:
+ // A window that supports drag and drop must override this and return true if
+ // data contains a type that may be dropped on this window.
+ virtual bool CanDrop(const DropTargetEvent& event) = 0;
+
+ // OnDragEntered is invoked when the mouse enters this window during a drag &
+ // drop session and CanDrop returns true. This is immediately
+ // followed by an invocation of OnDragUpdated, and eventually one of
+ // OnDragExited or OnPerformDrop.
+ virtual void OnDragEntered(const DropTargetEvent& event) = 0;
+
+ // Invoked during a drag and drop session while the mouse is over the window.
+ // This should return a bitmask of the DragDropTypes::DragOperation supported
+ // based on the location of the event. Return 0 to indicate the drop should
+ // not be accepted.
+ virtual int OnDragUpdated(const DropTargetEvent& event) = 0;
+
+ // Invoked during a drag and drop session when the mouse exits the window, or
+ // when the drag session was canceled and the mouse was over the window.
+ virtual void OnDragExited() = 0;
+
+ // Invoked during a drag and drop session when OnDragUpdated returns a valid
+ // operation and the user release the mouse.
+ virtual int OnPerformDrop(const DropTargetEvent& event) = 0;
+
+ protected:
+ virtual ~WindowDragDropDelegate() {}
+};
+
+} // namespace aura
+
+#endif // UI_AURA_CLIENT_WINDOW_DRAG_DROP_DELEGATE_H_