Mac: Add support for disabling HTML5 drag&drop by setting CefBrowserSettings.drag_drop_disabled to true (issue #140).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@270 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-08-02 17:30:11 +00:00
parent 7d006a8dd6
commit 0f414c8ac8
4 changed files with 20 additions and 7 deletions

View File

@ -94,6 +94,9 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
browserView.browser = this;
window_info_.m_View = browserView;
if (!settings_.drag_drop_disabled)
[browserView registerDragDrop];
Unlock();
if (newWnd != nil && !window_info_.m_bHidden) {

View File

@ -125,6 +125,11 @@ void BrowserWebViewDelegate::startDragging(const WebDragData& data,
WebDragOperationsMask mask,
const WebImage& image,
const WebPoint& image_offset) {
if (browser_->settings().drag_drop_disabled) {
browser_->UIT_GetWebView()->dragSourceSystemDragEnded();
return;
}
WebWidgetHost* host = GetWidgetHost();
if (!host)
return;

View File

@ -40,6 +40,9 @@ struct WebDropData;
- (BOOL)isOpaque;
- (void)setFrame:(NSRect)frameRect;
// Register this WebView as a drag/drop target.
- (void)registerDragDrop;
// Called from BrowserWebViewDelegate::startDragging() to initiate dragging.
- (void)startDragWithDropData:(const WebDropData&)dropData
dragOperationMask:(NSDragOperation)operationMask

View File

@ -25,13 +25,6 @@
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
dropTarget_.reset([[WebDropTarget alloc] initWithWebView:self]);
// Register the view to handle the appropriate drag types.
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType,
NSHTMLPboardType, NSURLPboardType, nil];
[self registerForDraggedTypes:types];
trackingArea_ =
[[NSTrackingArea alloc] initWithRect:frame
options:NSTrackingMouseMoved |
@ -187,6 +180,15 @@
[self setNeedsDisplay:YES];
}
- (void)registerDragDrop {
dropTarget_.reset([[WebDropTarget alloc] initWithWebView:self]);
// Register the view to handle the appropriate drag types.
NSArray* types = [NSArray arrayWithObjects:NSStringPboardType,
NSHTMLPboardType, NSURLPboardType, nil];
[self registerForDraggedTypes:types];
}
- (void)startDragWithDropData:(const WebDropData&)dropData
dragOperationMask:(NSDragOperation)operationMask
image:(NSImage*)image