Broke ContentSettingBubbleModelTest.Plugins on Android.
[chromium-blink-merge.git] / content / browser / web_contents / web_drag_dest_mac.h
blob4358e2b2c66a7d7b60a29171df341410c7f2587f
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
7 #include "base/memory/scoped_ptr.h"
8 #include "base/string16.h"
9 #include "webkit/glue/webdropdata.h"
12 namespace content {
13 class RenderViewHost;
14 class WebContentsImpl;
15 class WebDragDestDelegate;
18 // A typedef for a RenderViewHost used for comparison purposes only.
19 typedef content::RenderViewHost* RenderViewHostIdentifier;
21 // A class that handles tracking and event processing for a drag and drop
22 // over the content area. Assumes something else initiates the drag, this is
23 // only for processing during a drag.
25 @interface WebDragDest : NSObject {
26 @private
27 // Our associated WebContentsImpl. Weak reference.
28 content::WebContentsImpl* webContents_;
30 // Delegate; weak.
31 content::WebDragDestDelegate* delegate_;
33 // Updated asynchronously during a drag to tell us whether or not we should
34 // allow the drop.
35 NSDragOperation currentOperation_;
37 // Keep track of the render view host we're dragging over. If it changes
38 // during a drag, we need to re-send the DragEnter message.
39 RenderViewHostIdentifier currentRVH_;
41 // The data for the current drag, or NULL if none is in progress.
42 scoped_ptr<WebDropData> dropData_;
45 // |contents| is the WebContentsImpl representing this tab, used to communicate
46 // drag&drop messages to WebCore and handle navigation on a successful drop
47 // (if necessary).
48 - (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents;
50 - (WebDropData*)currentDropData;
52 - (void)setDragDelegate:(content::WebDragDestDelegate*)delegate;
54 // Sets the current operation negotiated by the source and destination,
55 // which determines whether or not we should allow the drop. Takes effect the
56 // next time |-draggingUpdated:| is called.
57 - (void)setCurrentOperation:(NSDragOperation)operation;
59 // Messages to send during the tracking of a drag, ususally upon receiving
60 // calls from the view system. Communicates the drag messages to WebCore.
61 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info
62 view:(NSView*)view;
63 - (void)draggingExited:(id<NSDraggingInfo>)info;
64 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)info
65 view:(NSView*)view;
66 - (BOOL)performDragOperation:(id<NSDraggingInfo>)info
67 view:(NSView*)view;
69 @end
71 // Public use only for unit tests.
72 @interface WebDragDest(Testing)
73 // Given |data|, which should not be nil, fill it in using the contents of the
74 // given pasteboard.
75 - (void)populateWebDropData:(WebDropData*)data
76 fromPasteboard:(NSPasteboard*)pboard;
77 // Given a point in window coordinates and a view in that window, return a
78 // flipped point in the coordinate system of |view|.
79 - (NSPoint)flipWindowPointToView:(const NSPoint&)windowPoint
80 view:(NSView*)view;
81 // Given a point in window coordinates and a view in that window, return a
82 // flipped point in screen coordinates.
83 - (NSPoint)flipWindowPointToScreen:(const NSPoint&)windowPoint
84 view:(NSView*)view;
85 @end