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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm

Issue 8430013: Split Mac WebDropTarget into two, content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/web_drop_target.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm
diff --git a/chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm b/chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm
index 13b1f57b7de87f4e6c63cdd71a39678ca18c1708..fa5043ef035c1b567d2064261d39925295a18ef4 100644
--- a/chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/web_drop_target.mm
@@ -5,13 +5,9 @@
#import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h"
#include "base/sys_string_conversions.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/browser/tab_contents/web_drag_dest_delegate.h"
#import "third_party/mozilla/NSPasteboard+Utils.h"
#import "ui/base/dragdrop/cocoa_dnd_util.h"
#include "webkit/glue/webdropdata.h"
@@ -31,6 +27,10 @@ using WebKit::WebDragOperationsMask;
return self;
}
+- (void)setDragDelegate:(content::WebDragDestDelegate*)delegate {
+ delegate_ = delegate;
+}
+
// Call to set whether or not we should allow the drop. Takes effect the
// next time |-draggingUpdated:| is called.
- (void)setCurrentOperation: (NSDragOperation)operation {
@@ -84,15 +84,10 @@ using WebKit::WebDragOperationsMask;
return NSDragOperationNone;
}
- if (!tab_)
- tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tabContents_);
-
- // If the tab is showing the bookmark manager, send BookmarkDrag events
- BookmarkTabHelper::BookmarkDrag* dragDelegate =
- tab_ ? tab_->bookmark_tab_helper()->GetBookmarkDragDelegate() : NULL;
- BookmarkNodeData dragData;
- if(dragDelegate && dragData.ReadFromDragClipboard())
- dragDelegate->OnDragEnter(dragData);
+ if (delegate_) {
+ delegate_->DragInitialize(tabContents_);
+ delegate_->OnDragEnter();
+ }
// Fill out a WebDropData from pasteboard.
WebDropData data;
@@ -122,6 +117,9 @@ using WebKit::WebDragOperationsMask;
// Nothing to do in the interstitial case.
+ if (delegate_)
+ delegate_->OnDragLeave();
+
tabContents_->render_view_host()->DragTargetDragLeave();
}
@@ -148,12 +146,9 @@ using WebKit::WebDragOperationsMask;
gfx::Point(screenPoint.x, screenPoint.y),
static_cast<WebDragOperationsMask>(mask));
- // If the tab is showing the bookmark manager, send BookmarkDrag events
- BookmarkTabHelper::BookmarkDrag* dragDelegate =
- tab_ ? tab_->bookmark_tab_helper()->GetBookmarkDragDelegate() : NULL;
- BookmarkNodeData dragData;
- if(dragDelegate && dragData.ReadFromDragClipboard())
- dragDelegate->OnDragOver(dragData);
+ if (delegate_)
+ delegate_->OnDragOver();
+
return current_operation_;
}
@@ -175,12 +170,8 @@ using WebKit::WebDragOperationsMask;
return NO;
}
- // If the tab is showing the bookmark manager, send BookmarkDrag events
- BookmarkTabHelper::BookmarkDrag* dragDelegate =
- tab_ ? tab_->bookmark_tab_helper()->GetBookmarkDragDelegate() : NULL;
- BookmarkNodeData dragData;
- if(dragDelegate && dragData.ReadFromDragClipboard())
- dragDelegate->OnDrop(dragData);
+ if (delegate_)
+ delegate_->OnDrop();
currentRVH_ = NULL;
@@ -193,12 +184,6 @@ using WebKit::WebDragOperationsMask;
gfx::Point(viewPoint.x, viewPoint.y),
gfx::Point(screenPoint.x, screenPoint.y));
- // Focus the target browser.
- Browser* browser = Browser::GetBrowserForController(
- &tabContents_->controller(), NULL);
- if (browser)
- browser->window()->Show();
-
return YES;
}
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/web_drop_target.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698