summaryrefslogtreecommitdiffstats
path: root/ui/base/dragdrop/drag_utils.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 05:37:26 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 05:37:26 +0000
commitf68e5d85edd4fb2e47ff01346d7138429c1ec5c4 (patch)
tree38191ef62fc83ad1a6c32015e29be187b5160e04 /ui/base/dragdrop/drag_utils.h
parentbd2fb568f441498d0cf542b9c8db9d718f9c6475 (diff)
downloadchromium_src-f68e5d85edd4fb2e47ff01346d7138429c1ec5c4.zip
chromium_src-f68e5d85edd4fb2e47ff01346d7138429c1ec5c4.tar.gz
chromium_src-f68e5d85edd4fb2e47ff01346d7138429c1ec5c4.tar.bz2
Move most of ui/views/drag_utils to ui/base/dragdrop so it can be used outside of views. I tried to move SetURLAndDragImage as well, but that would cause a lot of code duplication from Views' TextButton class that would make us worse off (things like mirroring and limiting size).
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9582041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/dragdrop/drag_utils.h')
-rw-r--r--ui/base/dragdrop/drag_utils.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/ui/base/dragdrop/drag_utils.h b/ui/base/dragdrop/drag_utils.h
new file mode 100644
index 0000000..b81511d
--- /dev/null
+++ b/ui/base/dragdrop/drag_utils.h
@@ -0,0 +1,56 @@
+// 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_BASE_DRAGDROP_DRAG_UTILS_H_
+#define UI_BASE_DRAGDROP_DRAG_UTILS_H_
+#pragma once
+
+#include <string>
+
+#include "base/file_path.h"
+#include "ui/base/ui_export.h"
+
+class GURL;
+class SkBitmap;
+
+namespace gfx {
+class Canvas;
+class Point;
+class Size;
+}
+
+namespace ui {
+class OSExchangeData;
+}
+using ui::OSExchangeData;
+
+namespace drag_utils {
+
+// Creates a dragging image to be displayed when the user drags a file from
+// Chrome (via the download manager, for example). The drag image is set into
+// the supplied data_object. 'file_name' can be a full path, but the directory
+// portion will be truncated in the drag image.
+UI_EXPORT void CreateDragImageForFile(const FilePath& file_name,
+ const SkBitmap* icon,
+ ui::OSExchangeData* data_object);
+
+// Sets the drag image on data_object from the supplied canvas. width/height
+// are the size of the image to use, and the offsets give the location of
+// the hotspot for the drag image.
+UI_EXPORT void SetDragImageOnDataObject(const gfx::Canvas& canvas,
+ const gfx::Size& size,
+ const gfx::Point& cursor_offset,
+ ui::OSExchangeData* data_object);
+
+// Sets the drag image on data_object from the supplied bitmap. width/height
+// are the size of the image to use, and the offsets give the location of
+// the hotspot for the drag image.
+UI_EXPORT void SetDragImageOnDataObject(const SkBitmap& bitmap,
+ const gfx::Size& size,
+ const gfx::Point& cursor_offset,
+ ui::OSExchangeData* data_object);
+
+} // namespace drag_utils
+
+#endif // UI_BASE_DRAGDROP_DRAG_UTILS_H_