summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 02:49:32 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-26 02:49:32 +0000
commitb37d187ce927c6987b3562e019842e9bad3cdcbb (patch)
tree9475c572c7c2bb2c9eb4fa8b44def21af16c4542 /chrome
parentfceaeae013de84077051f04940a97193497793db (diff)
downloadchromium_src-b37d187ce927c6987b3562e019842e9bad3cdcbb.zip
chromium_src-b37d187ce927c6987b3562e019842e9bad3cdcbb.tar.gz
chromium_src-b37d187ce927c6987b3562e019842e9bad3cdcbb.tar.bz2
Make web_drag_source.cc compile on Posix.
Review URL: http://codereview.chromium.org/27192 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.scons1
-rw-r--r--chrome/browser/tab_contents/web_drag_source.cc40
-rw-r--r--chrome/browser/tab_contents/web_drag_source.h16
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj2
-rw-r--r--chrome/common/temp_scaffolding_stubs.h3
5 files changed, 43 insertions, 19 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index bb29c42..349dc4e 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -714,7 +714,6 @@ if not env.Bit('windows'):
'tab_contents/native_ui_contents.cc',
'tab_contents/render_view_context_menu.cc',
'tab_contents/view_source_contents.cc',
- 'tab_contents/web_drag_source.cc',
'tab_contents/web_drop_target.cc',
'task_manager.cc',
'task_manager_resource_providers.cc',
diff --git a/chrome/browser/tab_contents/web_drag_source.cc b/chrome/browser/tab_contents/web_drag_source.cc
index c1061ee..979adef 100644
--- a/chrome/browser/tab_contents/web_drag_source.cc
+++ b/chrome/browser/tab_contents/web_drag_source.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#if defined(OS_WIN)
#include <atlbase.h>
#include <atlapp.h>
#include <atlmisc.h>
+#endif
#include "chrome/browser/tab_contents/web_drag_source.h"
@@ -12,34 +14,44 @@
namespace {
-static void GetCursorPositions(HWND hwnd, CPoint* client, CPoint* screen) {
- GetCursorPos(screen);
- *client = *screen;
- ScreenToClient(hwnd, client);
+static void GetCursorPositions(gfx::NativeWindow wnd, gfx::Point* client,
+ gfx::Point* screen) {
+#if defined(OS_WIN)
+ POINT cursor_pos;
+ GetCursorPos(&cursor_pos);
+ screen->SetPoint(cursor_pos.x, cursor_pos.y);
+ ScreenToClient(wnd, &cursor_pos);
+ client->SetPoint(cursor_pos.x, cursor_pos.y);
+#else
+ // TODO(port): Get the cursor positions.
+ NOTIMPLEMENTED();
+#endif
}
} // namespace
///////////////////////////////////////////////////////////////////////////////
// WebDragSource, public:
-WebDragSource::WebDragSource(HWND source_hwnd,
+WebDragSource::WebDragSource(gfx::NativeWindow source_wnd,
RenderViewHost* render_view_host)
: BaseDragSource(),
- source_hwnd_(source_hwnd),
+ source_wnd_(source_wnd),
render_view_host_(render_view_host) {
}
void WebDragSource::OnDragSourceDrop() {
- CPoint client;
- CPoint screen;
- GetCursorPositions(source_hwnd_, &client, &screen);
- render_view_host_->DragSourceEndedAt(client.x, client.y, screen.x, screen.y);
+ gfx::Point client;
+ gfx::Point screen;
+ GetCursorPositions(source_wnd_, &client, &screen);
+ render_view_host_->DragSourceEndedAt(client.x(), client.y(),
+ screen.x(), screen.y());
}
void WebDragSource::OnDragSourceMove() {
- CPoint client;
- CPoint screen;
- GetCursorPositions(source_hwnd_, &client, &screen);
- render_view_host_->DragSourceMovedTo(client.x, client.y, screen.x, screen.y);
+ gfx::Point client;
+ gfx::Point screen;
+ GetCursorPositions(source_wnd_, &client, &screen);
+ render_view_host_->DragSourceMovedTo(client.x(), client.y(),
+ screen.x(), screen.y());
}
diff --git a/chrome/browser/tab_contents/web_drag_source.h b/chrome/browser/tab_contents/web_drag_source.h
index de9fd75..aa6141a 100644
--- a/chrome/browser/tab_contents/web_drag_source.h
+++ b/chrome/browser/tab_contents/web_drag_source.h
@@ -5,8 +5,16 @@
#ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_
#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_
-#include "base/base_drag_source.h"
#include "base/basictypes.h"
+#include "base/gfx/native_widget_types.h"
+#include "base/gfx/point.h"
+
+// TODO(port): Port this file.
+#if defined(OS_WIN)
+#include "base/base_drag_source.h"
+#else
+#include "chrome/common/temp_scaffolding_stubs.h"
+#endif
class RenderViewHost;
@@ -22,7 +30,7 @@ class RenderViewHost;
class WebDragSource : public BaseDragSource {
public:
// Create a new DragSource for a given HWND and RenderViewHost.
- WebDragSource(HWND source_hwnd, RenderViewHost* render_view_host);
+ WebDragSource(gfx::NativeWindow source_wnd, RenderViewHost* render_view_host);
virtual ~WebDragSource() { }
protected:
@@ -34,8 +42,8 @@ class WebDragSource : public BaseDragSource {
// Cannot construct thusly.
WebDragSource();
- // Keep a reference to the HWND so we can translate the cursor position.
- HWND source_hwnd_;
+ // Keep a reference to the window so we can translate the cursor position.
+ gfx::NativeWindow source_wnd_;
// We use this as a channel to the renderer to tell it about various drag
// drop events that it needs to know about (such as when a drag operation it
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 4e0c5b7..2f2af3d 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -363,6 +363,7 @@
A54612DC0EE9958600A8EE5D /* extensions_service_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = A54612DB0EE9958600A8EE5D /* extensions_service_unittest.cc */; };
A54612E20EE995F600A8EE5D /* extensions_service.cc in Sources */ = {isa = PBXBuildFile; fileRef = A54612D90EE9957000A8EE5D /* extensions_service.cc */; };
A572828F0F31156100384E1B /* unzip_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = E45076E80F153B06003BE099 /* unzip_unittest.cc */; };
+ A6F9C682F0F4934CED7A446C /* web_drag_source.cc in Sources */ = {isa = PBXBuildFile; fileRef = B6CCB9F60F1EC32700106F0D /* web_drag_source.cc */; };
A76E43A40F29039C009A7E88 /* browser_render_process_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = A76E43A30F29039C009A7E88 /* browser_render_process_host.cc */; };
A7A20BF20F3A16DC00F62B4D /* render_widget.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CD50EAE868600EBCFC0 /* render_widget.cc */; };
A7A20E650F3A1E1C00F62B4D /* render_view.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D640CD30EAE868600EBCFC0 /* render_view.cc */; };
@@ -5840,6 +5841,7 @@
82FA32760F3A537C00271C5A /* web_contents_view_mac.mm in Sources */,
E48B6C3C0F27844F002E47EC /* web_data_service.cc in Sources */,
E45076200F150E0C003BE099 /* web_database.cc in Sources */,
+ A6F9C682F0F4934CED7A446C /* web_drag_source.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index c2e5ea4..db5926df 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -738,4 +738,7 @@ class OSExchangeData {
void SetURL(const GURL& url, const std::wstring& title) { NOTIMPLEMENTED(); }
};
+class BaseDragSource {
+};
+
#endif // CHROME_COMMON_TEMP_SCAFFOLDING_STUBS_H_