summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 22:24:16 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-17 22:24:16 +0000
commit30e9ade55fc1d09e77151c7813d16647d062d8f6 (patch)
tree5df211493a2d542ff78ae26bd56dbbd86b065f66 /chrome/browser/tab_contents
parent3767534a5cd1bbea08c89fa91b1ca6ec6b864d59 (diff)
downloadchromium_src-30e9ade55fc1d09e77151c7813d16647d062d8f6.zip
chromium_src-30e9ade55fc1d09e77151c7813d16647d062d8f6.tar.gz
chromium_src-30e9ade55fc1d09e77151c7813d16647d062d8f6.tar.bz2
tab_contents: Move platform-specific web_drag_bookmark_handler_* files into their ui/ directories.
Code under c/b/ui/ may depend on c/b/ and any component, but not vice-versa. So this one step further towards this goal. BUG=138280 R=avi@chromium.org TBR=darin@chromium.org Review URL: https://chromiumcodereview.appspot.com/11956015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc88
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h50
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc97
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h51
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h47
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm65
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc117
-rw-r--r--chrome/browser/tab_contents/web_drag_bookmark_handler_win.h45
8 files changed, 0 insertions, 560 deletions
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc
deleted file mode 100644
index 0fa5f92..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h"
-
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
-#include "webkit/glue/webdropdata.h"
-
-using content::WebContents;
-
-WebDragBookmarkHandlerAura::WebDragBookmarkHandlerAura()
- : bookmark_tab_helper_(NULL),
- web_contents_(NULL) {
-}
-
-WebDragBookmarkHandlerAura::~WebDragBookmarkHandlerAura() {
-}
-
-void WebDragBookmarkHandlerAura::DragInitialize(WebContents* contents) {
- // Ideally we would want to initialize the the BookmarkTabHelper member in
- // the constructor. We cannot do that as the WebDragDest object is
- // created during the construction of the WebContents object. The
- // BookmarkTabHelper is created much later.
- web_contents_ = contents;
- if (!bookmark_tab_helper_)
- bookmark_tab_helper_ = BookmarkTabHelper::FromWebContents(contents);
-}
-
-void WebDragBookmarkHandlerAura::OnDragOver() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- if (bookmark_drag_data_.is_valid())
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragOver(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerAura::OnReceiveDragData(
- const ui::OSExchangeData& data) {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- // Read the bookmark drag data and save it for use in later events in this
- // drag.
- bookmark_drag_data_.Read(data);
- }
-}
-
-void WebDragBookmarkHandlerAura::OnDragEnter() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- if (bookmark_drag_data_.is_valid())
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragEnter(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerAura::OnDrop() {
- if (bookmark_tab_helper_) {
- if (bookmark_tab_helper_->bookmark_drag_delegate()) {
- if (bookmark_drag_data_.is_valid()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDrop(
- bookmark_drag_data_);
- }
- }
-
- // Focus the target browser.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
- if (browser)
- browser->window()->Show();
- }
-
- bookmark_drag_data_.Clear();
-}
-
-void WebDragBookmarkHandlerAura::OnDragLeave() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- if (bookmark_drag_data_.is_valid())
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragLeave(
- bookmark_drag_data_);
- }
-
- bookmark_drag_data_.Clear();
-}
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h b/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h
deleted file mode 100644
index e628e51..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2012 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_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_AURA_H_
-#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_AURA_H_
-
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_drag_dest_delegate.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-
-class BookmarkTabHelper;
-
-namespace content {
-class WebContents;
-}
-
-// Chrome needs to intercept content drag events so it can dispatch them to the
-// bookmarks and extensions system.
-// Note that unlike the other platforms, Aura doesn't use all of the
-// WebDragDest infrastructure, just the WebDragDestDelegate.
-class WebDragBookmarkHandlerAura : public content::WebDragDestDelegate {
- public:
- WebDragBookmarkHandlerAura();
- virtual ~WebDragBookmarkHandlerAura();
-
- // Overridden from content::WebDragDestDelegate:
- virtual void DragInitialize(content::WebContents* contents) OVERRIDE;
- virtual void OnDragOver() OVERRIDE;
- virtual void OnDragEnter() OVERRIDE;
- virtual void OnDrop() OVERRIDE;
- virtual void OnDragLeave() OVERRIDE;
-
- virtual void OnReceiveDragData(const ui::OSExchangeData& data) OVERRIDE;
-
- private:
- // The BookmarkTabHelper.
- // Weak reference; may be NULL if the contents don't have a
- // BookmarkTabHelper (e.g. WebUI dialogs).
- BookmarkTabHelper* bookmark_tab_helper_;
-
- content::WebContents* web_contents_;
-
- // The bookmark data for the active drag. Empty when there is no active drag.
- BookmarkNodeData bookmark_drag_data_;
-
- DISALLOW_COPY_AND_ASSIGN(WebDragBookmarkHandlerAura);
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_AURA_H_
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc
deleted file mode 100644
index 3496e04..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h"
-
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/base/dragdrop/gtk_dnd_util.h"
-
-using content::WebContents;
-
-WebDragBookmarkHandlerGtk::WebDragBookmarkHandlerGtk()
- : bookmark_tab_helper_(NULL),
- web_contents_(NULL) {
-}
-
-WebDragBookmarkHandlerGtk::~WebDragBookmarkHandlerGtk() {}
-
-void WebDragBookmarkHandlerGtk::DragInitialize(WebContents* contents) {
- bookmark_drag_data_.Clear();
-
- // Ideally we would want to initialize the the BookmarkTabHelper member in
- // the constructor. We cannot do that as the WebDragDestGtk object is
- // created during the construction of the WebContents object. The
- // BookmarkTabHelper is created much later.
- web_contents_ = contents;
- if (!bookmark_tab_helper_)
- bookmark_tab_helper_ = BookmarkTabHelper::FromWebContents(contents);
-}
-
-GdkAtom WebDragBookmarkHandlerGtk::GetBookmarkTargetAtom() const {
- // For GTK, bookmark drag data is encoded as pickle and associated with
- // ui::CHROME_BOOKMARK_ITEM. See bookmark_utils::WriteBookmarksToSelection()
- // for details.
- return ui::GetAtomForTarget(ui::CHROME_BOOKMARK_ITEM);
-}
-
-void WebDragBookmarkHandlerGtk::OnReceiveDataFromGtk(GtkSelectionData* data) {
- Profile* profile =
- Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- bookmark_drag_data_.ReadFromVector(
- bookmark_utils::GetNodesFromSelection(
- NULL, data,
- ui::CHROME_BOOKMARK_ITEM,
- profile, NULL, NULL));
- bookmark_drag_data_.SetOriginatingProfile(profile);
-}
-
-void WebDragBookmarkHandlerGtk::OnReceiveProcessedData(const GURL& url,
- const string16& title) {
- bookmark_drag_data_.ReadFromTuple(url, title);
-}
-
-void WebDragBookmarkHandlerGtk::OnDragOver() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragOver(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerGtk::OnDragEnter() {
- // This is non-null if the web_contents_ is showing an ExtensionWebUI with
- // support for (at the moment experimental) drag and drop extensions.
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragEnter(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerGtk::OnDrop() {
- // This is non-null if web_contents_ is showing an ExtensionWebUI with
- // support for (at the moment experimental) drag and drop extensions.
- if (bookmark_tab_helper_) {
- if (bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDrop(
- bookmark_drag_data_);
- }
-
- // Focus the target browser.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
- if (browser)
- browser->window()->Show();
- }
-}
-
-void WebDragBookmarkHandlerGtk::OnDragLeave() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragLeave(
- bookmark_drag_data_);
- }
-}
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h b/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h
deleted file mode 100644
index f144340..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 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_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_GTK_H_
-#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_GTK_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "content/public/browser/web_drag_dest_delegate.h"
-
-class BookmarkTabHelper;
-
-namespace content {
-class WebContents;
-}
-
-// Chrome needs to intercept content drag events so it can dispatch them to the
-// bookmarks and extensions system.
-class WebDragBookmarkHandlerGtk : public content::WebDragDestDelegate {
- public:
- WebDragBookmarkHandlerGtk();
- virtual ~WebDragBookmarkHandlerGtk();
-
- // Overridden from content::WebDragDestDelegate:
- virtual void DragInitialize(content::WebContents* contents) OVERRIDE;
- virtual GdkAtom GetBookmarkTargetAtom() const OVERRIDE;
- virtual void OnReceiveDataFromGtk(GtkSelectionData* data) OVERRIDE;
- virtual void OnReceiveProcessedData(const GURL& url,
- const string16& title) OVERRIDE;
- virtual void OnDragOver() OVERRIDE;
- virtual void OnDragEnter() OVERRIDE;
- virtual void OnDrop() OVERRIDE;
- virtual void OnDragLeave() OVERRIDE;
-
- private:
- // The BookmarkTabHelper.
- // Weak reference; may be NULL if the contents don't have a
- // BookmarkTabHelper (e.g. WebUI dialogs).
- BookmarkTabHelper* bookmark_tab_helper_;
-
- content::WebContents* web_contents_;
-
- // The bookmark data for the current tab. This will be empty if there is not
- // a native bookmark drag (or we haven't gotten the data from the source yet).
- BookmarkNodeData bookmark_drag_data_;
-
- DISALLOW_COPY_AND_ASSIGN(WebDragBookmarkHandlerGtk);
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_GTK_H_
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h
deleted file mode 100644
index 2dbd8a8..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012 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_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_MAC_H_
-#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_MAC_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "content/public/browser/web_drag_dest_delegate.h"
-
-class BookmarkTabHelper;
-
-namespace content {
-class WebContents;
-}
-
-// Chrome needs to intercept content drag events so it can dispatch them to the
-// bookmarks and extensions system.
-class WebDragBookmarkHandlerMac : public content::WebDragDestDelegate {
- public:
- WebDragBookmarkHandlerMac();
- virtual ~WebDragBookmarkHandlerMac();
-
- // Overridden from content::WebDragDestDelegate:
- virtual void DragInitialize(content::WebContents* contents) OVERRIDE;
- virtual void OnDragOver() OVERRIDE;
- virtual void OnDragEnter() OVERRIDE;
- virtual void OnDrop() OVERRIDE;
- virtual void OnDragLeave() OVERRIDE;
-
- private:
- // The BookmarkTabHelper.
- // Weak reference; may be NULL if the contents don't have a
- // BookmarkTabHelper (e.g. WebUI dialogs).
- BookmarkTabHelper* bookmark_tab_helper_;
-
- content::WebContents* web_contents_;
-
- // The bookmark data for the current tab. This will be empty if there is not
- // a native bookmark drag.
- BookmarkNodeData bookmark_drag_data_;
-
- DISALLOW_COPY_AND_ASSIGN(WebDragBookmarkHandlerMac);
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_MAC_H_
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm b/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm
deleted file mode 100644
index d1c7d91..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_mac.mm
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "chrome/browser/tab_contents/web_drag_bookmark_handler_mac.h"
-
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "content/public/browser/web_contents.h"
-
-using content::WebContents;
-
-WebDragBookmarkHandlerMac::WebDragBookmarkHandlerMac()
- : bookmark_tab_helper_(NULL),
- web_contents_(NULL) {
-}
-
-WebDragBookmarkHandlerMac::~WebDragBookmarkHandlerMac() {}
-
-void WebDragBookmarkHandlerMac::DragInitialize(WebContents* contents) {
- web_contents_ = contents;
- if (!bookmark_tab_helper_)
- bookmark_tab_helper_ = BookmarkTabHelper::FromWebContents(contents);
-
- bookmark_drag_data_.ReadFromDragClipboard();
-}
-
-void WebDragBookmarkHandlerMac::OnDragOver() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragOver(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerMac::OnDragEnter() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragEnter(
- bookmark_drag_data_);
- }
-}
-
-void WebDragBookmarkHandlerMac::OnDrop() {
- // This is non-null if the web_contents_ is showing an ExtensionWebUI with
- // support for (at the moment experimental) drag and drop extensions.
- if (bookmark_tab_helper_) {
- if (bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDrop(
- bookmark_drag_data_);
- }
-
- // Focus the target browser.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
- if (browser)
- browser->window()->Show();
- }
-}
-
-void WebDragBookmarkHandlerMac::OnDragLeave() {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragLeave(
- bookmark_drag_data_);
- }
-}
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc b/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc
deleted file mode 100644
index fe9a018..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.h"
-
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_contents.h"
-#include "ui/base/dragdrop/os_exchange_data.h"
-#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
-#include "webkit/glue/webdropdata.h"
-
-using content::WebContents;
-
-WebDragBookmarkHandlerWin::WebDragBookmarkHandlerWin()
- : bookmark_tab_helper_(NULL),
- web_contents_(NULL) {
-}
-
-WebDragBookmarkHandlerWin::~WebDragBookmarkHandlerWin() {
-}
-
-void WebDragBookmarkHandlerWin::DragInitialize(WebContents* contents) {
- // Ideally we would want to initialize the the BookmarkTabHelper member in
- // the constructor. We cannot do that as the WebDragTargetWin object is
- // created during the construction of the WebContents object. The
- // BookmarkTabHelper is created much later.
- web_contents_ = contents;
- if (!bookmark_tab_helper_)
- bookmark_tab_helper_ = BookmarkTabHelper::FromWebContents(contents);
-}
-
-void WebDragBookmarkHandlerWin::OnDragOver(IDataObject* data_object) {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- ui::OSExchangeData os_exchange_data(
- new ui::OSExchangeDataProviderWin(data_object));
- BookmarkNodeData bookmark_drag_data;
- if (bookmark_drag_data.Read(os_exchange_data))
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragOver(
- bookmark_drag_data);
- }
-}
-
-void WebDragBookmarkHandlerWin::OnDragEnter(IDataObject* data_object) {
- // This is non-null if the web_contents_ is showing an ExtensionWebUI with
- // support for (at the moment experimental) drag and drop extensions.
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- ui::OSExchangeData os_exchange_data(
- new ui::OSExchangeDataProviderWin(data_object));
- BookmarkNodeData bookmark_drag_data;
- if (bookmark_drag_data.Read(os_exchange_data))
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragEnter(
- bookmark_drag_data);
- }
-}
-
-void WebDragBookmarkHandlerWin::OnDrop(IDataObject* data_object) {
- // This is non-null if the web_contents_ is showing an ExtensionWebUI with
- // support for (at the moment experimental) drag and drop extensions.
- if (bookmark_tab_helper_) {
- if (bookmark_tab_helper_->bookmark_drag_delegate()) {
- ui::OSExchangeData os_exchange_data(
- new ui::OSExchangeDataProviderWin(data_object));
- BookmarkNodeData bookmark_drag_data;
- if (bookmark_drag_data.Read(os_exchange_data)) {
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDrop(
- bookmark_drag_data);
- }
- }
-
- // Focus the target browser.
- Browser* browser = chrome::FindBrowserWithWebContents(web_contents_);
- if (browser)
- browser->window()->Show();
- }
-}
-
-void WebDragBookmarkHandlerWin::OnDragLeave(IDataObject* data_object) {
- if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
- ui::OSExchangeData os_exchange_data(
- new ui::OSExchangeDataProviderWin(data_object));
- BookmarkNodeData bookmark_drag_data;
- if (bookmark_drag_data.Read(os_exchange_data))
- bookmark_tab_helper_->bookmark_drag_delegate()->OnDragLeave(
- bookmark_drag_data);
- }
-}
-
-bool WebDragBookmarkHandlerWin::AddDragData(const WebDropData& drop_data,
- ui::OSExchangeData* data) {
- if (!drop_data.url.SchemeIs(chrome::kJavaScriptScheme))
- return false;
-
- // We don't want to allow javascript URLs to be dragged to the desktop,
- // but we do want to allow them to be added to the bookmarks bar
- // (bookmarklets). So we create a fake bookmark entry (BookmarkNodeData
- // object) which explorer.exe cannot handle, and write the entry to data.
- BookmarkNodeData::Element bm_elt;
- bm_elt.is_url = true;
- bm_elt.url = drop_data.url;
- bm_elt.title = drop_data.url_title;
-
- BookmarkNodeData bm_drag_data;
- bm_drag_data.elements.push_back(bm_elt);
-
- // Pass in NULL as the profile so that the bookmark always adds the url
- // rather than trying to move an existing url.
- bm_drag_data.Write(NULL, data);
-
- return true;
-}
diff --git a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.h b/chrome/browser/tab_contents/web_drag_bookmark_handler_win.h
deleted file mode 100644
index 8b30188..0000000
--- a/chrome/browser/tab_contents/web_drag_bookmark_handler_win.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012 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_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_WIN_H_
-#define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_WIN_H_
-
-#include "base/compiler_specific.h"
-#include "chrome/browser/bookmarks/bookmark_node_data.h"
-#include "content/public/browser/web_drag_dest_delegate.h"
-
-class BookmarkTabHelper;
-
-namespace content {
-class WebContents;
-}
-
-// Chrome needs to intercept content drag events so it can dispatch them to the
-// bookmarks and extensions system.
-class WebDragBookmarkHandlerWin : public content::WebDragDestDelegate {
- public:
- WebDragBookmarkHandlerWin();
- virtual ~WebDragBookmarkHandlerWin();
-
- // Overridden from content::WebDragDestDelegate:
- virtual void DragInitialize(content::WebContents* contents) OVERRIDE;
- virtual void OnDragOver(IDataObject* data_object) OVERRIDE;
- virtual void OnDragEnter(IDataObject* data_object) OVERRIDE;
- virtual void OnDrop(IDataObject* data_object) OVERRIDE;
- virtual void OnDragLeave(IDataObject* data_object) OVERRIDE;
- virtual bool AddDragData(const WebDropData& drop_data,
- ui::OSExchangeData* data) OVERRIDE;
-
- private:
- // The BookmarkTabHelper.
- // Weak reference; may be NULL if the contents don't have a
- // BookmarkTabHelper (e.g. WebUI dialogs).
- BookmarkTabHelper* bookmark_tab_helper_;
-
- content::WebContents* web_contents_;
-
- DISALLOW_COPY_AND_ASSIGN(WebDragBookmarkHandlerWin);
-};
-
-#endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_BOOKMARK_HANDLER_WIN_H_