summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-09 03:15:05 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-09 03:15:05 +0000
commit62054bb3bbe80a503a2d5bf407161c9417ff9228 (patch)
tree6b027f74a7b722b4d9594cac0367a6d7407849fb /app
parenta1bcae9b0b78248089b81d26bccdf0acd542cd4c (diff)
downloadchromium_src-62054bb3bbe80a503a2d5bf407161c9417ff9228.zip
chromium_src-62054bb3bbe80a503a2d5bf407161c9417ff9228.tar.gz
chromium_src-62054bb3bbe80a503a2d5bf407161c9417ff9228.tar.bz2
Provides implementation of DragDropTypes for GTK.
BUG=none TEST=none Review URL: http://codereview.chromium.org/164178 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app.gyp25
-rw-r--r--app/drag_drop_types.h9
-rw-r--r--app/drag_drop_types_gtk.cc31
-rw-r--r--app/drag_drop_types_win.cc (renamed from app/drag_drop_types.cc)0
4 files changed, 52 insertions, 13 deletions
diff --git a/app/app.gyp b/app/app.gyp
index e63ff82..77e3a3d 100644
--- a/app/app.gyp
+++ b/app/app.gyp
@@ -63,7 +63,8 @@
'app_paths.cc',
'app_switches.h',
'app_switches.cc',
- 'drag_drop_types.cc',
+ 'drag_drop_types_gtk.cc',
+ 'drag_drop_types_win.cc',
'drag_drop_types.h',
'gfx/canvas.cc',
'gfx/canvas.h',
@@ -125,6 +126,17 @@
'../build/linux/system.gyp:fontconfig',
'../build/linux/system.gyp:gtk',
],
+ 'conditions': [
+ ['toolkit_views==0 and chromeos==0', {
+ # Note: because of gyp predence rules this has to be defined as
+ # 'sources/' rather than 'sources!'.
+ 'sources/': [
+ ['exclude', '^os_exchange_data_gtk.cc'],
+ ['exclude', '^os_exchange_data.h'],
+ ['exclude', '^drag_drop_types_gtk.cc'],
+ ],
+ }],
+ ],
}],
['OS=="win"', {
'sources': [
@@ -134,22 +146,11 @@
}],
['OS!="win"', {
'sources!': [
- 'drag_drop_types.cc',
'drag_drop_types.h',
'gfx/icon_util.cc',
'gfx/icon_util.h',
'os_exchange_data.cc',
],
- 'conditions': [
- ['toolkit_views==0', {
- # Note: because of gyp predence rules this has to be defined as
- # 'sources/' rather than 'sources!'.
- 'sources/': [
- ['exclude', '^os_exchange_data_gtk.cc'],
- ['exclude', '^os_exchange_data.h'],
- ],
- }],
- ],
}],
],
},
diff --git a/app/drag_drop_types.h b/app/drag_drop_types.h
index 52f35c9..011d386 100644
--- a/app/drag_drop_types.h
+++ b/app/drag_drop_types.h
@@ -1,10 +1,12 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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 APP_DRAG_DROP_TYPES_H_
#define APP_DRAG_DROP_TYPES_H_
+#include "build/build_config.h"
+
#include "base/basictypes.h"
class DragDropTypes {
@@ -16,8 +18,13 @@ class DragDropTypes {
DRAG_LINK = 1 << 2
};
+#if defined(OS_WIN)
static uint32 DragOperationToDropEffect(int drag_operation);
static int DropEffectToDragOperation(uint32 effect);
+#elif defined(OS_LINUX)
+ static int DragOperationToGdkDragAction(int drag_operation);
+ static int GdkDragActionToDragOperation(int gdk_drag_action);
+#endif
};
#endif // APP_DRAG_DROP_TYPES_H_
diff --git a/app/drag_drop_types_gtk.cc b/app/drag_drop_types_gtk.cc
new file mode 100644
index 0000000..1cab322
--- /dev/null
+++ b/app/drag_drop_types_gtk.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2009 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.
+
+#include "app/drag_drop_types.h"
+
+#include <gtk/gtk.h>
+
+// static
+int DragDropTypes::DragOperationToGdkDragAction(int drag_operation) {
+ int gdk_drag_action = 0;
+ if (drag_operation & DRAG_MOVE)
+ gdk_drag_action |= GDK_ACTION_MOVE;
+ if (drag_operation & DRAG_COPY)
+ gdk_drag_action |= GDK_ACTION_COPY;
+ if (drag_operation & DRAG_LINK)
+ gdk_drag_action |= GDK_ACTION_LINK;
+ return gdk_drag_action;
+}
+
+// static
+int DragDropTypes::GdkDragActionToDragOperation(int gdk_drag_action) {
+ int drag_operation = DRAG_NONE;
+ if (gdk_drag_action & GDK_ACTION_COPY)
+ drag_operation |= DRAG_COPY;
+ if (gdk_drag_action & GDK_ACTION_MOVE)
+ drag_operation |= DRAG_MOVE;
+ if (gdk_drag_action & GDK_ACTION_LINK)
+ drag_operation |= DRAG_LINK;
+ return drag_operation;
+}
diff --git a/app/drag_drop_types.cc b/app/drag_drop_types_win.cc
index 5944868..5944868 100644
--- a/app/drag_drop_types.cc
+++ b/app/drag_drop_types_win.cc