Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/tab_contents/web_drag_source.cc

Issue 27192: Make web_drag_source.cc compile on Posix. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/web_drag_source.h ('k') | chrome/chrome.xcodeproj/project.pbxproj » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(OS_WIN)
5 #include <atlbase.h> 6 #include <atlbase.h>
6 #include <atlapp.h> 7 #include <atlapp.h>
7 #include <atlmisc.h> 8 #include <atlmisc.h>
9 #endif
8 10
9 #include "chrome/browser/tab_contents/web_drag_source.h" 11 #include "chrome/browser/tab_contents/web_drag_source.h"
10 12
11 #include "chrome/browser/renderer_host/render_view_host.h" 13 #include "chrome/browser/renderer_host/render_view_host.h"
12 14
13 namespace { 15 namespace {
14 16
15 static void GetCursorPositions(HWND hwnd, CPoint* client, CPoint* screen) { 17 static void GetCursorPositions(gfx::NativeWindow wnd, gfx::Point* client,
16 GetCursorPos(screen); 18 gfx::Point* screen) {
17 *client = *screen; 19 #if defined(OS_WIN)
18 ScreenToClient(hwnd, client); 20 POINT cursor_pos;
21 GetCursorPos(&cursor_pos);
22 screen->SetPoint(cursor_pos.x, cursor_pos.y);
23 ScreenToClient(wnd, &cursor_pos);
24 client->SetPoint(cursor_pos.x, cursor_pos.y);
25 #else
26 // TODO(port): Get the cursor positions.
27 NOTIMPLEMENTED();
28 #endif
19 } 29 }
20 30
21 } // namespace 31 } // namespace
22 /////////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////////
23 // WebDragSource, public: 33 // WebDragSource, public:
24 34
25 WebDragSource::WebDragSource(HWND source_hwnd, 35 WebDragSource::WebDragSource(gfx::NativeWindow source_wnd,
26 RenderViewHost* render_view_host) 36 RenderViewHost* render_view_host)
27 : BaseDragSource(), 37 : BaseDragSource(),
28 source_hwnd_(source_hwnd), 38 source_wnd_(source_wnd),
29 render_view_host_(render_view_host) { 39 render_view_host_(render_view_host) {
30 } 40 }
31 41
32 void WebDragSource::OnDragSourceDrop() { 42 void WebDragSource::OnDragSourceDrop() {
33 CPoint client; 43 gfx::Point client;
34 CPoint screen; 44 gfx::Point screen;
35 GetCursorPositions(source_hwnd_, &client, &screen); 45 GetCursorPositions(source_wnd_, &client, &screen);
36 render_view_host_->DragSourceEndedAt(client.x, client.y, screen.x, screen.y); 46 render_view_host_->DragSourceEndedAt(client.x(), client.y(),
47 screen.x(), screen.y());
37 } 48 }
38 49
39 void WebDragSource::OnDragSourceMove() { 50 void WebDragSource::OnDragSourceMove() {
40 CPoint client; 51 gfx::Point client;
41 CPoint screen; 52 gfx::Point screen;
42 GetCursorPositions(source_hwnd_, &client, &screen); 53 GetCursorPositions(source_wnd_, &client, &screen);
43 render_view_host_->DragSourceMovedTo(client.x, client.y, screen.x, screen.y); 54 render_view_host_->DragSourceMovedTo(client.x(), client.y(),
55 screen.x(), screen.y());
44 } 56 }
45 57
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_drag_source.h ('k') | chrome/chrome.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698