diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 18:53:06 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 18:53:06 +0000 |
commit | 43d42d8cf4da8b10d498d98f4c6120063c3df869 (patch) | |
tree | ed0a8f9d1880ac80995faa891e355c3d96c73849 /content/browser/web_contents/web_drag_source_win.h | |
parent | c7a424cb3fb0a037cda04c30d44606515aed829d (diff) | |
download | chromium_src-43d42d8cf4da8b10d498d98f4c6120063c3df869.zip chromium_src-43d42d8cf4da8b10d498d98f4c6120063c3df869.tar.gz chromium_src-43d42d8cf4da8b10d498d98f4c6120063c3df869.tar.bz2 |
TabContents -> WebContentsImpl, part 2.
BUG=105875
TEST=no change
Review URL: https://chromiumcodereview.appspot.com/10014024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131599 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/web_contents/web_drag_source_win.h')
-rw-r--r-- | content/browser/web_contents/web_drag_source_win.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/content/browser/web_contents/web_drag_source_win.h b/content/browser/web_contents/web_drag_source_win.h new file mode 100644 index 0000000..64a0c51 --- /dev/null +++ b/content/browser/web_contents/web_drag_source_win.h @@ -0,0 +1,69 @@ +// Copyright (c) 2011 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ +#define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ +#pragma once + +#include "base/basictypes.h" +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/notification_registrar.h" +#include "ui/base/dragdrop/drag_source.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/point.h" + +namespace content { +class RenderViewHost; +class WebContents; +} + +// An IDropSource implementation for a TabContents. 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 ui::DragSource, + public content::NotificationObserver { + public: + // Create a new DragSource for a given HWND and WebContents. + WebDragSource(gfx::NativeWindow source_wnd, + content::WebContents* web_contents); + virtual ~WebDragSource(); + + // content::NotificationObserver implementation. + virtual void Observe(int type, + const content::NotificationSource& source, + const content::NotificationDetails& details); + + void set_effect(DWORD effect) { effect_ = effect; } + + protected: + // ui::DragSource + virtual void OnDragSourceCancel(); + virtual void OnDragSourceDrop(); + virtual void OnDragSourceMove(); + + private: + // Cannot construct thusly. + WebDragSource(); + + // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop + // by posting a task to this function. + void DelayedOnDragSourceDrop(); + + // 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 + // initiated terminates). + content::RenderViewHost* render_view_host_; + + content::NotificationRegistrar registrar_; + + DWORD effect_; + + DISALLOW_COPY_AND_ASSIGN(WebDragSource); +}; + +#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ |