summaryrefslogtreecommitdiffstats
path: root/chrome/browser/web_drag_source.h
blob: f8aa628cda096317a0ece42bd8e850cc3a658d52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2006-2008 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 CHROME_BROWSER_WEB_DRAG_SOURCE_H__
#define CHROME_BROWSER_WEB_DRAG_SOURCE_H__

#include "base/base_drag_source.h"
#include "base/basictypes.h"

class RenderViewHost;

///////////////////////////////////////////////////////////////////////////////
//
// WebDragSource
//
//  An IDropSource implementation for a WebContents. Handles notifications sent
//  by an active drag-drop operation as the user mouses over other drop targets
//  on their system. This object tells Windows whether or not the drag should
//  continue, and supplies the appropriate cursors.
//
class WebDragSource : public BaseDragSource {
 public:
  // Create a new DragSource for a given HWND and RenderViewHost.
  WebDragSource(HWND source_hwnd, RenderViewHost* render_view_host);
  virtual ~WebDragSource() { }

 protected:
  // BaseDragSource
  virtual void OnDragSourceDrop();
  virtual void OnDragSourceMove();

 private:
  // Cannot construct thusly.
  WebDragSource();

  // Keep a reference to the HWND so we can translate the cursor position.
  HWND source_hwnd_;

  // 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
  // initiated terminates).
  RenderViewHost* render_view_host_;

  DISALLOW_EVIL_CONSTRUCTORS(WebDragSource);
};

#endif  // #ifndef CHROME_BROWSER_WEB_DRAG_SOURCE_H__