diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 02:49:32 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 02:49:32 +0000 |
commit | b37d187ce927c6987b3562e019842e9bad3cdcbb (patch) | |
tree | 9475c572c7c2bb2c9eb4fa8b44def21af16c4542 /chrome/browser/tab_contents/web_drag_source.cc | |
parent | fceaeae013de84077051f04940a97193497793db (diff) | |
download | chromium_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/browser/tab_contents/web_drag_source.cc')
-rw-r--r-- | chrome/browser/tab_contents/web_drag_source.cc | 40 |
1 files changed, 26 insertions, 14 deletions
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()); } |