diff options
Diffstat (limited to 'chrome')
29 files changed, 188 insertions, 204 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 376c18e2463..bdc978f 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -13,8 +13,6 @@ #include "app/l10n_util.h" #include "app/l10n_util_win.h" -#include "app/win/drag_source.h" -#include "app/win/drop_target.h" #include "app/win/iat_patch_function.h" #include "app/win/win_util.h" #include "base/auto_reset.h" @@ -47,6 +45,8 @@ #include "skia/ext/skia_utils_win.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" +#include "ui/base/dragdrop/drag_source.h" +#include "ui/base/dragdrop/drop_target.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_win.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -68,7 +68,7 @@ namespace { // URL. A drop of plain text from the same edit either copies or moves the // selected text, and a drop of plain text from a source other than the edit // does a paste and go. -class EditDropTarget : public app::win::DropTarget { +class EditDropTarget : public ui::DropTarget { public: explicit EditDropTarget(AutocompleteEditViewWin* edit); @@ -119,7 +119,7 @@ DWORD CopyOrLinkDropEffect(DWORD effect) { } EditDropTarget::EditDropTarget(AutocompleteEditViewWin* edit) - : app::win::DropTarget(edit->m_hWnd), + : ui::DropTarget(edit->m_hWnd), edit_(edit), drag_has_url_(false), drag_has_string_(false) { @@ -2427,7 +2427,7 @@ void AutocompleteEditViewWin::StartDragIfNecessary(const CPoint& point) { data.SetString(text_to_write); - scoped_refptr<app::win::DragSource> drag_source(new app::win::DragSource); + scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); DWORD dropped_mode; AutoReset<bool> auto_reset_in_drag(&in_drag_, true); if (DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 8021f4e..d773d80 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -6,7 +6,6 @@ #include <utility> -#include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "base/basictypes.h" #include "base/file_path.h" @@ -34,8 +33,9 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/net_util.h" -#include "views/event.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/models/tree_node_iterator.h" +#include "views/event.h" #if defined(TOOLKIT_VIEWS) #include "ui/base/dragdrop/os_exchange_data.h" @@ -210,21 +210,21 @@ int PreferredDropOperation(int source_operations, int operations) { int common_ops = (source_operations & operations); if (!common_ops) return 0; - if (DragDropTypes::DRAG_COPY & common_ops) - return DragDropTypes::DRAG_COPY; - if (DragDropTypes::DRAG_LINK & common_ops) - return DragDropTypes::DRAG_LINK; - if (DragDropTypes::DRAG_MOVE & common_ops) - return DragDropTypes::DRAG_MOVE; - return DragDropTypes::DRAG_NONE; + if (ui::DragDropTypes::DRAG_COPY & common_ops) + return ui::DragDropTypes::DRAG_COPY; + if (ui::DragDropTypes::DRAG_LINK & common_ops) + return ui::DragDropTypes::DRAG_LINK; + if (ui::DragDropTypes::DRAG_MOVE & common_ops) + return ui::DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_NONE; } int BookmarkDragOperation(const BookmarkNode* node) { if (node->is_url()) { - return DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_MOVE | - DragDropTypes::DRAG_LINK; + return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE | + ui::DragDropTypes::DRAG_LINK; } - return DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE; } int BookmarkDropOperation(Profile* profile, @@ -234,18 +234,18 @@ int BookmarkDropOperation(Profile* profile, int index) { if (data.IsFromProfile(profile) && data.size() > 1) // Currently only accept one dragged node at a time. - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; if (!bookmark_utils::IsValidDropLocation(profile, data, parent, index)) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; if (data.GetFirstNode(profile)) { // User is dragging from this profile: move. - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } // User is dragging from another app, copy. return PreferredDropOperation(event.GetSourceOperations(), - DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK); + ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); } int PerformBookmarkDrop(Profile* profile, @@ -262,13 +262,13 @@ int PerformBookmarkDrop(Profile* profile, model->Move(dragged_nodes[i], parent_node, index); index = parent_node->IndexOfChild(dragged_nodes[i]) + 1; } - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } // Dropping a group from different profile. Always accept. bookmark_utils::CloneBookmarkNode(model, data.elements, parent_node, index); - return DragDropTypes::DRAG_COPY; + return ui::DragDropTypes::DRAG_COPY; } bool IsValidDropLocation(Profile* profile, @@ -337,8 +337,8 @@ void DragBookmarks(Profile* profile, MessageLoop::current()->SetNestableTasksAllowed(true); root_view->StartDragForViewFromMouseEvent(NULL, data, - DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_MOVE | - DragDropTypes::DRAG_LINK); + ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE | + ui::DragDropTypes::DRAG_LINK); MessageLoop::current()->SetNestableTasksAllowed(was_nested); #elif defined(OS_MACOSX) diff --git a/chrome/browser/chromeos/dom_ui/imageburner_ui.h b/chrome/browser/chromeos/dom_ui/imageburner_ui.h index 97624ac..c3d6d47 100644 --- a/chrome/browser/chromeos/dom_ui/imageburner_ui.h +++ b/chrome/browser/chromeos/dom_ui/imageburner_ui.h @@ -9,7 +9,6 @@ #include <string> #include <vector> -#include "app/download_file_interface.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/scoped_ptr.h" @@ -25,6 +24,7 @@ #include "chrome/browser/download/download_util.h" #include "googleurl/src/gurl.h" #include "net/base/file_stream.h" +#include "ui/base/dragdrop/download_file_interface.h" template <typename T> struct DefaultSingletonTraits; diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 5e3dbc4..25bfa85 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -62,7 +62,7 @@ #if defined(TOOLKIT_USES_GTK) #if defined(TOOLKIT_VIEWS) -#include "app/drag_drop_types.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "views/widget/widget_gtk.h" #elif defined(TOOLKIT_GTK) #include "chrome/browser/gtk/custom_drag.h" @@ -70,11 +70,11 @@ #endif // defined(TOOLKIT_USES_GTK) #if defined(OS_WIN) -#include "app/win/drag_source.h" #include "app/win/win_util.h" #include "base/win/scoped_comptr.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "ui/base/dragdrop/drag_source.h" #include "ui/base/dragdrop/os_exchange_data_provider_win.h" #endif @@ -490,7 +490,7 @@ void DragDownload(const DownloadItem* download, } #if defined(OS_WIN) - scoped_refptr<app::win::DragSource> drag_source(new app::win::DragSource); + scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); // Run the drag and drop loop DWORD effects; @@ -504,7 +504,8 @@ void DragDownload(const DownloadItem* download, if (!widget) return; - widget->DoDrag(data, DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK); + widget->DoDrag(data, + ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); #endif // OS_WIN } #elif defined(USE_X11) diff --git a/chrome/browser/download/drag_download_file.cc b/chrome/browser/download/drag_download_file.cc index 004e185..9d16105 100644 --- a/chrome/browser/download/drag_download_file.cc +++ b/chrome/browser/download/drag_download_file.cc @@ -57,7 +57,7 @@ DragDownloadFile::~DragDownloadFile() { download_manager_->RemoveObserver(this); } -bool DragDownloadFile::Start(DownloadFileObserver* observer) { +bool DragDownloadFile::Start(ui::DownloadFileObserver* observer) { AssertCurrentlyOnDragThread(); if (is_started_) diff --git a/chrome/browser/download/drag_download_file.h b/chrome/browser/download/drag_download_file.h index a6cb190..3bbe9c6 100644 --- a/chrome/browser/download/drag_download_file.h +++ b/chrome/browser/download/drag_download_file.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_FILE_H_ #pragma once -#include "app/download_file_interface.h" #include "base/file_path.h" #include "base/linked_ptr.h" #include "chrome/browser/download/download_file.h" #include "chrome/browser/download/download_item.h" #include "chrome/browser/download/download_manager.h" #include "googleurl/src/gurl.h" +#include "ui/base/dragdrop/download_file_interface.h" class TabContents; @@ -20,7 +20,7 @@ namespace net { class FileStream; } -class DragDownloadFile : public DownloadFileProvider, +class DragDownloadFile : public ui::DownloadFileProvider, public DownloadManager::Observer, public DownloadItem::Observer { public: @@ -43,7 +43,7 @@ class DragDownloadFile : public DownloadFileProvider, // DownloadFileProvider methods. // Called on drag-and-drop thread (Windows). // Called on UI thread (MacOSX). - virtual bool Start(DownloadFileObserver* observer); + virtual bool Start(ui::DownloadFileObserver* observer); virtual void Stop(); #if defined(OS_WIN) virtual IStream* GetStream() { return NULL; } @@ -96,7 +96,7 @@ class DragDownloadFile : public DownloadFileProvider, // Accessed on UI thread (MacOSX). bool is_started_; bool is_successful_; - scoped_refptr<DownloadFileObserver> observer_; + scoped_refptr<ui::DownloadFileObserver> observer_; // Accessed on drag-and-drop thread (Windows only). #if defined(OS_WIN) diff --git a/chrome/browser/download/drag_download_util.h b/chrome/browser/download/drag_download_util.h index 31bda47..f4d6b55 100644 --- a/chrome/browser/download/drag_download_util.h +++ b/chrome/browser/download/drag_download_util.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_DOWNLOAD_DRAG_DOWNLOAD_UTIL_H_ #pragma once -#include "app/download_file_interface.h" #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/string16.h" #include "chrome/browser/download/drag_download_file.h" +#include "ui/base/dragdrop/download_file_interface.h" class FilePath; class GURL; @@ -40,7 +40,7 @@ bool ParseDownloadMetadata(const string16& metadata, net::FileStream* CreateFileStreamForDrop(FilePath* file_path); // Implementation of DownloadFileObserver to finalize the download process. -class PromiseFileFinalizer : public DownloadFileObserver { +class PromiseFileFinalizer : public ui::DownloadFileObserver { public: explicit PromiseFileFinalizer(DragDownloadFile* drag_file_downloader); virtual ~PromiseFileFinalizer(); diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc index eaede71..840576d 100644 --- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc +++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc @@ -6,7 +6,6 @@ #include <string> -#include "app/gtk_dnd_util.h" #include "base/file_path.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" @@ -16,6 +15,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/url_constants.h" #include "net/base/net_util.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" using WebKit::WebDragOperation; using WebKit::WebDragOperationNone; @@ -25,8 +25,8 @@ namespace { // Returns the bookmark target atom, based on the underlying toolkit. // // For GTK, bookmark drag data is encoded as pickle and associated with -// gtk_dnd_util::CHROME_BOOKMARK_ITEM. See -// bookmark_utils::WriteBookmarksToSelection() for details. +// ui::CHROME_BOOKMARK_ITEM. See // bookmark_utils::WriteBookmarksToSelection() +// for details. // For Views, bookmark drag data is encoded in the same format, and // associated with a custom format. See BookmarkNodeData::Write() for // details. @@ -34,7 +34,7 @@ GdkAtom GetBookmarkTargetAtom() { #if defined(TOOLKIT_VIEWS) return BookmarkNodeData::GetBookmarkCustomFormat(); #else - return gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_BOOKMARK_ITEM); + return ui::GetAtomForTarget(ui::CHROME_BOOKMARK_ITEM); #endif } @@ -104,11 +104,11 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender, // text/uri-list after text/plain so that the plain text can be cleared if // it's a file drag. static int supported_targets[] = { - gtk_dnd_util::TEXT_PLAIN, - gtk_dnd_util::TEXT_URI_LIST, - gtk_dnd_util::TEXT_HTML, - gtk_dnd_util::NETSCAPE_URL, - gtk_dnd_util::CHROME_NAMED_URL, + ui::TEXT_PLAIN, + ui::TEXT_URI_LIST, + ui::TEXT_HTML, + ui::NETSCAPE_URL, + ui::CHROME_NAMED_URL, // TODO(estade): support image drags? }; @@ -116,7 +116,7 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender, data_requests_ = arraysize(supported_targets) + 1; for (size_t i = 0; i < arraysize(supported_targets); ++i) { gtk_drag_get_data(widget_, context, - gtk_dnd_util::GetAtomForTarget(supported_targets[i]), + ui::GetAtomForTarget(supported_targets[i]), time); } @@ -151,8 +151,7 @@ void WebDragDestGtk::OnDragDataReceived( if (data->data && data->length > 0) { // If the source can't provide us with valid data for a requested target, // data->data will be NULL. - if (data->target == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::TEXT_PLAIN)) { + if (data->target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { guchar* text = gtk_selection_data_get_text(data); if (text) { drop_data_->plain_text = @@ -160,8 +159,7 @@ void WebDragDestGtk::OnDragDataReceived( data->length)); g_free(text); } - } else if (data->target == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::TEXT_URI_LIST)) { + } else if (data->target == ui::GetAtomForTarget(ui::TEXT_URI_LIST)) { gchar** uris = gtk_selection_data_get_uris(data); if (uris) { drop_data_->url = GURL(); @@ -186,15 +184,13 @@ void WebDragDestGtk::OnDragDataReceived( } g_strfreev(uris); } - } else if (data->target == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::TEXT_HTML)) { + } else if (data->target == ui::GetAtomForTarget(ui::TEXT_HTML)) { // TODO(estade): Can the html have a non-UTF8 encoding? drop_data_->text_html = UTF8ToUTF16(std::string(reinterpret_cast<char*>(data->data), data->length)); // We leave the base URL empty. - } else if (data->target == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::NETSCAPE_URL)) { + } else if (data->target == ui::GetAtomForTarget(ui::NETSCAPE_URL)) { std::string netscape_url(reinterpret_cast<char*>(data->data), data->length); size_t split = netscape_url.find_first_of('\n'); @@ -203,10 +199,8 @@ void WebDragDestGtk::OnDragDataReceived( if (split < netscape_url.size() - 1) drop_data_->url_title = UTF8ToUTF16(netscape_url.substr(split + 1)); } - } else if (data->target == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_NAMED_URL)) { - gtk_dnd_util::ExtractNamedURL(data, - &drop_data_->url, &drop_data_->url_title); + } else if (data->target == ui::GetAtomForTarget(ui::CHROME_NAMED_URL)) { + ui::ExtractNamedURL(data, &drop_data_->url, &drop_data_->url_title); } } @@ -220,7 +214,7 @@ void WebDragDestGtk::OnDragDataReceived( bookmark_drag_data_.ReadFromVector( bookmark_utils::GetNodesFromSelection( NULL, data, - gtk_dnd_util::CHROME_BOOKMARK_ITEM, + ui::CHROME_BOOKMARK_ITEM, tab_contents_->profile(), NULL, NULL)); bookmark_drag_data_.SetOriginatingProfile(tab_contents_->profile()); } else { diff --git a/chrome/browser/tab_contents/web_drag_source_win.cc b/chrome/browser/tab_contents/web_drag_source_win.cc index c4e4ebd..ecad8fc 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.cc +++ b/chrome/browser/tab_contents/web_drag_source_win.cc @@ -32,7 +32,7 @@ static void GetCursorPositions(gfx::NativeWindow wnd, gfx::Point* client, WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, TabContents* tab_contents) - : app::win::DragSource(), + : ui::DragSource(), source_wnd_(source_wnd), render_view_host_(tab_contents->render_view_host()), effect_(DROPEFFECT_NONE) { diff --git a/chrome/browser/tab_contents/web_drag_source_win.h b/chrome/browser/tab_contents/web_drag_source_win.h index 4669f8a..72744e5 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.h +++ b/chrome/browser/tab_contents/web_drag_source_win.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_WIN_H_ #pragma once -#include "app/win/drag_source.h" #include "base/basictypes.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" #include "gfx/native_widget_types.h" #include "gfx/point.h" +#include "ui/base/dragdrop/drag_source.h" class RenderViewHost; class TabContents; @@ -20,7 +20,7 @@ class TabContents; // 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 app::win::DragSource, +class WebDragSource : public ui::DragSource, public NotificationObserver { public: // Create a new DragSource for a given HWND and TabContents. @@ -35,7 +35,7 @@ class WebDragSource : public app::win::DragSource, void set_effect(DWORD effect) { effect_ = effect; } protected: - // app::win::DragSource + // ui::DragSource virtual void OnDragSourceCancel(); virtual void OnDragSourceDrop(); virtual void OnDragSourceMove(); diff --git a/chrome/browser/tab_contents/web_drop_target_win.cc b/chrome/browser/tab_contents/web_drop_target_win.cc index d0b8525..d7ccf9b 100644 --- a/chrome/browser/tab_contents/web_drop_target_win.cc +++ b/chrome/browser/tab_contents/web_drop_target_win.cc @@ -82,7 +82,7 @@ class InterstitialDropTarget { }; WebDropTarget::WebDropTarget(HWND source_hwnd, TabContents* tab_contents) - : app::win::DropTarget(source_hwnd), + : ui::DropTarget(source_hwnd), tab_contents_(tab_contents), current_rvh_(NULL), drag_cursor_(WebDragOperationNone), diff --git a/chrome/browser/tab_contents/web_drop_target_win.h b/chrome/browser/tab_contents/web_drop_target_win.h index f2c9541..f93d5d0 100644 --- a/chrome/browser/tab_contents/web_drop_target_win.h +++ b/chrome/browser/tab_contents/web_drop_target_win.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ #pragma once -#include "app/win/drop_target.h" #include "base/scoped_ptr.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" +#include "ui/base/dragdrop/drop_target.h" class InterstitialDropTarget; class RenderViewHost; @@ -17,7 +17,7 @@ class TabContents; // A helper object that provides drop capabilities to a TabContents. The // DropTarget handles drags that enter the region of the TabContents by // passing on the events to the renderer. -class WebDropTarget : public app::win::DropTarget { +class WebDropTarget : public ui::DropTarget { public: // Create a new WebDropTarget associating it with the given HWND and // TabContents. diff --git a/chrome/browser/ui/gtk/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmark_bar_gtk.cc index 237b009..e74a873 100644 --- a/chrome/browser/ui/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmark_bar_gtk.cc @@ -6,7 +6,6 @@ #include <vector> -#include "app/gtk_dnd_util.h" #include "app/resource_bundle.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" @@ -46,6 +45,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/animation/slide_animation.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" namespace { @@ -76,11 +76,11 @@ const int kOtherBookmarksPaddingHorizontal = 2; const int kOtherBookmarksPaddingVertical = 1; // The targets accepted by the toolbar and folder buttons for DnD. -const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM, - gtk_dnd_util::CHROME_NAMED_URL, - gtk_dnd_util::TEXT_URI_LIST, - gtk_dnd_util::NETSCAPE_URL, - gtk_dnd_util::TEXT_PLAIN, -1 }; +const int kDestTargetList[] = { ui::CHROME_BOOKMARK_ITEM, + ui::CHROME_NAMED_URL, + ui::TEXT_URI_LIST, + ui::NETSCAPE_URL, + ui::TEXT_PLAIN, -1 }; // Acceptable drag actions for the bookmark bar drag destinations. const GdkDragAction kDragAction = @@ -212,7 +212,7 @@ void BookmarkBarGtk::Init(Profile* profile) { gtk_drag_dest_set(instructions_, GtkDestDefaults(GTK_DEST_DEFAULT_DROP | GTK_DEST_DEFAULT_MOTION), NULL, 0, kDragAction); - gtk_dnd_util::SetDestTargetList(instructions_, kDestTargetList); + ui::SetDestTargetList(instructions_, kDestTargetList); g_signal_connect(instructions_, "drag-data-received", G_CALLBACK(&OnDragReceivedThunk), this); @@ -239,7 +239,7 @@ void BookmarkBarGtk::Init(Profile* profile) { gtk_drag_dest_set(bookmark_toolbar_.get(), GTK_DEST_DEFAULT_DROP, NULL, 0, kDragAction); - gtk_dnd_util::SetDestTargetList(bookmark_toolbar_.get(), kDestTargetList); + ui::SetDestTargetList(bookmark_toolbar_.get(), kDestTargetList); g_signal_connect(bookmark_toolbar_.get(), "drag-motion", G_CALLBACK(&OnToolbarDragMotionThunk), this); g_signal_connect(bookmark_toolbar_.get(), "drag-leave", @@ -840,7 +840,7 @@ GtkWidget* BookmarkBarGtk::CreateBookmarkButton(const BookmarkNode* node) { gtk_drag_source_set(button, GDK_BUTTON1_MASK, NULL, 0, static_cast<GdkDragAction>(GDK_ACTION_MOVE | GDK_ACTION_COPY)); int target_mask = bookmark_utils::GetCodeMask(node->is_folder()); - gtk_dnd_util::SetSourceTargetListFromCodeMask(button, target_mask); + ui::SetSourceTargetListFromCodeMask(button, target_mask); g_signal_connect(button, "drag-begin", G_CALLBACK(&OnButtonDragBeginThunk), this); g_signal_connect(button, "drag-end", @@ -889,7 +889,7 @@ void BookmarkBarGtk::ConnectFolderButtonEvents(GtkWidget* widget, NULL, 0, kDragAction); - gtk_dnd_util::SetDestTargetList(widget, kDestTargetList); + ui::SetDestTargetList(widget, kDestTargetList); g_signal_connect(widget, "drag-data-received", G_CALLBACK(&OnDragReceivedThunk), this); if (is_tool_item) { @@ -1116,8 +1116,7 @@ gboolean BookmarkBarGtk::ItemDraggedOverToolbar(GdkDragContext* context, gtk_toolbar_set_drop_highlight_item(GTK_TOOLBAR(bookmark_toolbar_.get()), GTK_TOOL_ITEM(toolbar_drop_item_), index); - if (target_type == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_BOOKMARK_ITEM)) { + if (target_type == ui::GetAtomForTarget(ui::CHROME_BOOKMARK_ITEM)) { gdk_drag_status(context, GDK_ACTION_MOVE, time); } else { gdk_drag_status(context, GDK_ACTION_COPY, time); @@ -1163,8 +1162,7 @@ gboolean BookmarkBarGtk::OnFolderDragMotion(GtkWidget* button, // Drag is over middle of folder. gtk_drag_highlight(button); - if (target_type == - gtk_dnd_util::GetAtomForTarget(gtk_dnd_util::CHROME_BOOKMARK_ITEM)) { + if (target_type == ui::GetAtomForTarget(ui::CHROME_BOOKMARK_ITEM)) { gdk_drag_status(context, GDK_ACTION_MOVE, time); } else { gdk_drag_status(context, GDK_ACTION_COPY, time); @@ -1237,7 +1235,7 @@ void BookmarkBarGtk::OnDragReceived(GtkWidget* widget, } switch (target_type) { - case gtk_dnd_util::CHROME_BOOKMARK_ITEM: { + case ui::CHROME_BOOKMARK_ITEM: { std::vector<const BookmarkNode*> nodes = bookmark_utils::GetNodesFromSelection(context, selection_data, target_type, @@ -1253,25 +1251,25 @@ void BookmarkBarGtk::OnDragReceived(GtkWidget* widget, break; } - case gtk_dnd_util::CHROME_NAMED_URL: { + case ui::CHROME_NAMED_URL: { dnd_success = bookmark_utils::CreateNewBookmarkFromNamedUrl( selection_data, model_, dest_node, index); break; } - case gtk_dnd_util::TEXT_URI_LIST: { + case ui::TEXT_URI_LIST: { dnd_success = bookmark_utils::CreateNewBookmarksFromURIList( selection_data, model_, dest_node, index); break; } - case gtk_dnd_util::NETSCAPE_URL: { + case ui::NETSCAPE_URL: { dnd_success = bookmark_utils::CreateNewBookmarkFromNetscapeURL( selection_data, model_, dest_node, index); break; } - case gtk_dnd_util::TEXT_PLAIN: { + case ui::TEXT_PLAIN: { guchar* text = gtk_selection_data_get_text(selection_data); if (!text) break; diff --git a/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc index 6b5b687..b90cd17 100644 --- a/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc +++ b/chrome/browser/ui/gtk/bookmark_menu_controller_gtk.cc @@ -6,7 +6,6 @@ #include <gtk/gtk.h> -#include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -23,6 +22,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" #include "webkit/glue/window_open_disposition.h" namespace { @@ -178,10 +178,10 @@ void BookmarkMenuController::BuildMenu(const BookmarkNode* parent, gtk_drag_source_set(menu_item, GDK_BUTTON1_MASK, NULL, 0, static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_LINK)); - int target_mask = gtk_dnd_util::CHROME_BOOKMARK_ITEM; + int target_mask = ui::CHROME_BOOKMARK_ITEM; if (node->is_url()) - target_mask |= gtk_dnd_util::TEXT_URI_LIST | gtk_dnd_util::NETSCAPE_URL; - gtk_dnd_util::SetSourceTargetListFromCodeMask(menu_item, target_mask); + target_mask |= ui::TEXT_URI_LIST | ui::NETSCAPE_URL; + ui::SetSourceTargetListFromCodeMask(menu_item, target_mask); signals_.Connect(menu_item, "drag-begin", G_CALLBACK(OnMenuItemDragBeginThunk), this); signals_.Connect(menu_item, "drag-end", diff --git a/chrome/browser/ui/gtk/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmark_utils_gtk.cc index 15ad4ad..1c2bc1c 100644 --- a/chrome/browser/ui/gtk/bookmark_utils_gtk.cc +++ b/chrome/browser/ui/gtk/bookmark_utils_gtk.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/gtk/bookmark_utils_gtk.h" -#include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/pickle.h" @@ -21,6 +20,7 @@ #include "gfx/canvas_skia_paint.h" #include "gfx/font.h" #include "gfx/gtk_util.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" namespace { @@ -294,11 +294,11 @@ void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider) { // DnD-related ----------------------------------------------------------------- int GetCodeMask(bool folder) { - int rv = gtk_dnd_util::CHROME_BOOKMARK_ITEM; + int rv = ui::CHROME_BOOKMARK_ITEM; if (!folder) { - rv |= gtk_dnd_util::TEXT_URI_LIST | - gtk_dnd_util::TEXT_PLAIN | - gtk_dnd_util::NETSCAPE_URL; + rv |= ui::TEXT_URI_LIST | + ui::TEXT_PLAIN | + ui::NETSCAPE_URL; } return rv; } @@ -318,7 +318,7 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, guint target_type, Profile* profile) { switch (target_type) { - case gtk_dnd_util::CHROME_BOOKMARK_ITEM: { + case ui::CHROME_BOOKMARK_ITEM: { BookmarkNodeData data(nodes); Pickle pickle; data.WriteToPickle(profile, &pickle); @@ -329,7 +329,7 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, pickle.size()); break; } - case gtk_dnd_util::NETSCAPE_URL: { + case ui::NETSCAPE_URL: { // _NETSCAPE_URL format is URL + \n + title. std::string utf8_text = nodes[0]->GetURL().spec() + "\n" + UTF16ToUTF8(nodes[0]->GetTitle()); @@ -340,7 +340,7 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, utf8_text.length()); break; } - case gtk_dnd_util::TEXT_URI_LIST: { + case ui::TEXT_URI_LIST: { gchar** uris = reinterpret_cast<gchar**>(malloc(sizeof(gchar*) * (nodes.size() + 1))); for (size_t i = 0; i < nodes.size(); ++i) { @@ -358,7 +358,7 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, free(uris); break; } - case gtk_dnd_util::TEXT_PLAIN: { + case ui::TEXT_PLAIN: { gtk_selection_data_set_text(selection_data, nodes[0]->GetURL().spec().c_str(), -1); break; @@ -386,7 +386,7 @@ std::vector<const BookmarkNode*> GetNodesFromSelection( *delete_selection_data = TRUE; switch (target_type) { - case gtk_dnd_util::CHROME_BOOKMARK_ITEM: { + case ui::CHROME_BOOKMARK_ITEM: { if (dnd_success) *dnd_success = TRUE; Pickle pickle(reinterpret_cast<char*>(selection_data->data), @@ -408,7 +408,7 @@ bool CreateNewBookmarkFromNamedUrl(GtkSelectionData* selection_data, BookmarkModel* model, const BookmarkNode* parent, int idx) { GURL url; string16 title; - if (!gtk_dnd_util::ExtractNamedURL(selection_data, &url, &title)) + if (!ui::ExtractNamedURL(selection_data, &url, &title)) return false; model->AddURL(parent, idx, title, url); @@ -418,7 +418,7 @@ bool CreateNewBookmarkFromNamedUrl(GtkSelectionData* selection_data, bool CreateNewBookmarksFromURIList(GtkSelectionData* selection_data, BookmarkModel* model, const BookmarkNode* parent, int idx) { std::vector<GURL> urls; - gtk_dnd_util::ExtractURIList(selection_data, &urls); + ui::ExtractURIList(selection_data, &urls); for (size_t i = 0; i < urls.size(); ++i) { std::string title = GetNameForURL(urls[i]); model->AddURL(parent, idx++, UTF8ToUTF16(title), urls[i]); @@ -430,7 +430,7 @@ bool CreateNewBookmarkFromNetscapeURL(GtkSelectionData* selection_data, BookmarkModel* model, const BookmarkNode* parent, int idx) { GURL url; string16 title; - if (!gtk_dnd_util::ExtractNetscapeURL(selection_data, &url, &title)) + if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) return false; model->AddURL(parent, idx, title, url); diff --git a/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc index a5f0f17..ffef87c 100644 --- a/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc +++ b/chrome/browser/ui/gtk/bookmark_utils_gtk_unittest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gtk_dnd_util.h" #include "chrome/browser/ui/gtk/bookmark_utils_gtk.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" TEST(BookmarkUtilsGtkTest, GetNodesFromSelectionInvalid) { std::vector<const BookmarkNode*> nodes; @@ -20,19 +20,19 @@ TEST(BookmarkUtilsGtkTest, GetNodesFromSelectionInvalid) { EXPECT_EQ(0u, nodes.size()); nodes = bookmark_utils::GetNodesFromSelection(NULL, NULL, - gtk_dnd_util::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); + ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); EXPECT_EQ(0u, nodes.size()); data.data = NULL; data.length = 0; nodes = bookmark_utils::GetNodesFromSelection(NULL, &data, - gtk_dnd_util::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); + ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); EXPECT_EQ(0u, nodes.size()); guchar test_data[] = ""; data.data = test_data; data.length = 0; nodes = bookmark_utils::GetNodesFromSelection(NULL, &data, - gtk_dnd_util::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); + ui::CHROME_BOOKMARK_ITEM, NULL, NULL, NULL); EXPECT_EQ(0u, nodes.size()); } diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index 4943f84..49d8d3d 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -8,7 +8,6 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "base/base_paths.h" #include "base/command_line.h" @@ -52,6 +51,7 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/models/accelerator_gtk.h" namespace { @@ -421,9 +421,8 @@ void BrowserToolbarGtk::SetUpDragForHomeButton(bool enable) { if (enable) { gtk_drag_dest_set(home_->widget(), GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY); - static const int targets[] = { gtk_dnd_util::TEXT_PLAIN, - gtk_dnd_util::TEXT_URI_LIST, -1 }; - gtk_dnd_util::SetDestTargetList(home_->widget(), targets); + static const int targets[] = { ui::TEXT_PLAIN, ui::TEXT_URI_LIST, -1 }; + ui::SetDestTargetList(home_->widget(), targets); drop_handler_.reset(new GtkSignalRegistrar()); drop_handler_->Connect(home_->widget(), "drag-data-received", @@ -599,7 +598,7 @@ gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, GdkDragContext* drag_context, gint x, gint y, GtkSelectionData* data, guint info, guint time) { - if (info != gtk_dnd_util::TEXT_PLAIN) { + if (info != ui::TEXT_PLAIN) { NOTIMPLEMENTED() << "Only support plain text drops for now, sorry!"; return; } diff --git a/chrome/browser/ui/gtk/custom_drag.cc b/chrome/browser/ui/gtk/custom_drag.cc index ea1aa80..eb786b3 100644 --- a/chrome/browser/ui/gtk/custom_drag.cc +++ b/chrome/browser/ui/gtk/custom_drag.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/gtk/custom_drag.h" -#include "app/gtk_dnd_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/download/download_item.h" #include "chrome/browser/ui/gtk/bookmark_utils_gtk.h" @@ -12,11 +11,11 @@ #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" namespace { -const int kDownloadItemCodeMask = gtk_dnd_util::TEXT_URI_LIST | - gtk_dnd_util::CHROME_NAMED_URL; +const int kDownloadItemCodeMask = ui::TEXT_URI_LIST | ui::CHROME_NAMED_URL; const GdkDragAction kDownloadItemDragAction = GDK_ACTION_COPY; const GdkDragAction kBookmarkDragAction = static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE); @@ -25,7 +24,7 @@ void OnDragDataGetForDownloadItem(GtkSelectionData* selection_data, guint target_type, const DownloadItem* download_item) { GURL url = net::FilePathToFileURL(download_item->full_path()); - gtk_dnd_util::WriteURLWithName(selection_data, url, + ui::WriteURLWithName(selection_data, url, UTF8ToUTF16(download_item->GetFileNameToReportUser().value()), target_type); } @@ -51,7 +50,7 @@ CustomDrag::CustomDrag(SkBitmap* icon, int code_mask, GdkDragAction action) g_signal_connect(drag_widget_, "drag-end", G_CALLBACK(OnDragEndThunk), this); - GtkTargetList* list = gtk_dnd_util::GetTargetListFromCodeMask(code_mask); + GtkTargetList* list = ui::GetTargetListFromCodeMask(code_mask); GdkEvent* event = gtk_get_current_event(); gtk_drag_begin(drag_widget_, list, action, 1, event); if (event) @@ -98,7 +97,7 @@ void DownloadItemDrag::SetSource(GtkWidget* widget, SkBitmap* icon) { gtk_drag_source_set(widget, GDK_BUTTON1_MASK, NULL, 0, kDownloadItemDragAction); - gtk_dnd_util::SetSourceTargetListFromCodeMask(widget, kDownloadItemCodeMask); + ui::SetSourceTargetListFromCodeMask(widget, kDownloadItemCodeMask); // Disconnect previous signal handlers, if any. g_signal_handlers_disconnect_by_func( diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 84be94e..4489a5f 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/basictypes.h" @@ -61,6 +60,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "net/base/net_util.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" #include "webkit/glue/window_open_disposition.h" namespace { @@ -370,10 +370,10 @@ void LocationBarViewGtk::SetSiteTypeDragSource() { gtk_drag_source_set(site_type_event_box_, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY); - gtk_dnd_util::SetSourceTargetListFromCodeMask(site_type_event_box_, - gtk_dnd_util::TEXT_PLAIN | - gtk_dnd_util::TEXT_URI_LIST | - gtk_dnd_util::CHROME_NAMED_URL); + ui::SetSourceTargetListFromCodeMask(site_type_event_box_, + ui::TEXT_PLAIN | + ui::TEXT_URI_LIST | + ui::CHROME_NAMED_URL); } void LocationBarViewGtk::SetProfile(Profile* profile) { @@ -1124,7 +1124,7 @@ void LocationBarViewGtk::OnIconDragData(GtkWidget* sender, TabContents* tab = GetTabContents(); if (!tab) return; - gtk_dnd_util::WriteURLWithName(data, tab->GetURL(), tab->GetTitle(), info); + ui::WriteURLWithName(data, tab->GetURL(), tab->GetTitle(), info); } void LocationBarViewGtk::OnIconDragBegin(GtkWidget* sender, diff --git a/chrome/browser/ui/gtk/tab_contents_drag_source.cc b/chrome/browser/ui/gtk/tab_contents_drag_source.cc index 6413565..0739d34 100644 --- a/chrome/browser/ui/gtk/tab_contents_drag_source.cc +++ b/chrome/browser/ui/gtk/tab_contents_drag_source.cc @@ -6,7 +6,6 @@ #include <string> -#include "app/gtk_dnd_util.h" #include "base/file_util.h" #include "base/mime_util.h" #include "base/utf_string_conversions.h" @@ -21,6 +20,7 @@ #include "gfx/gtk_util.h" #include "net/base/file_stream.h" #include "net/base/net_util.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" #include "webkit/glue/webdropdata.h" using WebKit::WebDragOperation; @@ -82,22 +82,22 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data, int targets_mask = 0; if (!drop_data.plain_text.empty()) - targets_mask |= gtk_dnd_util::TEXT_PLAIN; + targets_mask |= ui::TEXT_PLAIN; if (drop_data.url.is_valid()) { - targets_mask |= gtk_dnd_util::TEXT_URI_LIST; - targets_mask |= gtk_dnd_util::CHROME_NAMED_URL; - targets_mask |= gtk_dnd_util::NETSCAPE_URL; + targets_mask |= ui::TEXT_URI_LIST; + targets_mask |= ui::CHROME_NAMED_URL; + targets_mask |= ui::NETSCAPE_URL; } if (!drop_data.text_html.empty()) - targets_mask |= gtk_dnd_util::TEXT_HTML; + targets_mask |= ui::TEXT_HTML; if (!drop_data.file_contents.empty()) - targets_mask |= gtk_dnd_util::CHROME_WEBDROP_FILE_CONTENTS; + targets_mask |= ui::CHROME_WEBDROP_FILE_CONTENTS; if (!drop_data.download_metadata.empty() && drag_download_util::ParseDownloadMetadata(drop_data.download_metadata, &wide_download_mime_type_, &download_file_name_, &download_url_)) { - targets_mask |= gtk_dnd_util::DIRECT_SAVE_FILE; + targets_mask |= ui::DIRECT_SAVE_FILE; } // NOTE: Begin a drag even if no targets present. Otherwise, things like @@ -111,12 +111,12 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data, drag_pixbuf_ = gfx::GdkPixbufFromSkBitmap(&image); image_offset_ = image_offset; - GtkTargetList* list = gtk_dnd_util::GetTargetListFromCodeMask(targets_mask); - if (targets_mask & gtk_dnd_util::CHROME_WEBDROP_FILE_CONTENTS) { + GtkTargetList* list = ui::GetTargetListFromCodeMask(targets_mask); + if (targets_mask & ui::CHROME_WEBDROP_FILE_CONTENTS) { drag_file_mime_type_ = gdk_atom_intern( mime_util::GetDataMimeType(drop_data.file_contents).c_str(), FALSE); gtk_target_list_add(list, drag_file_mime_type_, - 0, gtk_dnd_util::CHROME_WEBDROP_FILE_CONTENTS); + 0, ui::CHROME_WEBDROP_FILE_CONTENTS); } drag_failed_ = false; @@ -173,35 +173,34 @@ void TabContentsDragSource::OnDragDataGet(GtkWidget* sender, const int kBitsPerByte = 8; switch (target_type) { - case gtk_dnd_util::TEXT_PLAIN: { + case ui::TEXT_PLAIN: { std::string utf8_text = UTF16ToUTF8(drop_data_->plain_text); gtk_selection_data_set_text(selection_data, utf8_text.c_str(), utf8_text.length()); break; } - case gtk_dnd_util::TEXT_HTML: { + case ui::TEXT_HTML: { // TODO(estade): change relative links to be absolute using // |html_base_url|. std::string utf8_text = UTF16ToUTF8(drop_data_->text_html); gtk_selection_data_set(selection_data, - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::TEXT_HTML), + ui::GetAtomForTarget(ui::TEXT_HTML), kBitsPerByte, reinterpret_cast<const guchar*>(utf8_text.c_str()), utf8_text.length()); break; } - case gtk_dnd_util::TEXT_URI_LIST: - case gtk_dnd_util::CHROME_NAMED_URL: - case gtk_dnd_util::NETSCAPE_URL: { - gtk_dnd_util::WriteURLWithName(selection_data, drop_data_->url, - drop_data_->url_title, target_type); + case ui::TEXT_URI_LIST: + case ui::CHROME_NAMED_URL: + case ui::NETSCAPE_URL: { + ui::WriteURLWithName(selection_data, drop_data_->url, + drop_data_->url_title, target_type); break; } - case gtk_dnd_util::CHROME_WEBDROP_FILE_CONTENTS: { + case ui::CHROME_WEBDROP_FILE_CONTENTS: { gtk_selection_data_set( selection_data, drag_file_mime_type_, kBitsPerByte, @@ -210,7 +209,7 @@ void TabContentsDragSource::OnDragDataGet(GtkWidget* sender, break; } - case gtk_dnd_util::DIRECT_SAVE_FILE: { + case ui::DIRECT_SAVE_FILE: { char status_code = 'E'; // Retrieves the full file path (in file URL format) provided by the @@ -219,10 +218,8 @@ void TabContentsDragSource::OnDragDataGet(GtkWidget* sender, gint file_url_len = 0; guchar* file_url_value = NULL; if (gdk_property_get(context->source_window, - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::DIRECT_SAVE_FILE), - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::TEXT_PLAIN_NO_CHARSET), + ui::GetAtomForTarget(ui::DIRECT_SAVE_FILE), + ui::GetAtomForTarget(ui::TEXT_PLAIN_NO_CHARSET), 0, 1024, FALSE, @@ -309,10 +306,8 @@ void TabContentsDragSource::OnDragBegin(GtkWidget* sender, // Pass the file name to the drop target by setting the source window's // XdndDirectSave0 property. gdk_property_change(drag_context->source_window, - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::DIRECT_SAVE_FILE), - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::TEXT_PLAIN_NO_CHARSET), + ui::GetAtomForTarget(ui::DIRECT_SAVE_FILE), + ui::GetAtomForTarget(ui::TEXT_PLAIN_NO_CHARSET), 8, GDK_PROP_MODE_REPLACE, reinterpret_cast<const guchar*>( @@ -349,8 +344,7 @@ void TabContentsDragSource::OnDragEnd(GtkWidget* sender, if (!download_url_.is_empty()) { gdk_property_delete(drag_context->source_window, - gtk_dnd_util::GetAtomForTarget( - gtk_dnd_util::DIRECT_SAVE_FILE)); + ui::GetAtomForTarget(ui::DIRECT_SAVE_FILE)); } if (!drag_failed_) { diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_gtk.cc index 13f788c..b87c753 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.cc @@ -6,7 +6,6 @@ #include <gdk/gdkkeysyms.h> -#include "app/gtk_dnd_util.h" #include "base/singleton.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" @@ -16,6 +15,7 @@ #include "gfx/path.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/models/accelerator_gtk.h" namespace { @@ -365,8 +365,7 @@ void TabGtk::DestroyDragWidget() { void TabGtk::StartDragging(gfx::Point drag_offset) { CreateDragWidget(); - GtkTargetList* list = gtk_dnd_util::GetTargetListFromCodeMask( - gtk_dnd_util::CHROME_TAB); + GtkTargetList* list = ui::GetTargetListFromCodeMask(ui::CHROME_TAB); gtk_drag_begin(drag_widget_, list, GDK_ACTION_MOVE, 1, // Drags are always initiated by the left button. last_mouse_down_); diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index b366334..00e2f2c 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "app/gtk_dnd_util.h" #include "app/resource_bundle.h" #include "base/i18n/rtl.h" #include "base/string_util.h" @@ -34,6 +33,7 @@ #include "grit/theme_resources.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/slide_animation.h" +#include "ui/base/dragdrop/gtk_dnd_util.h" namespace { @@ -738,11 +738,11 @@ void TabStripGtk::Init() { NULL, 0, static_cast<GdkDragAction>( GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK)); - static const int targets[] = { gtk_dnd_util::TEXT_URI_LIST, - gtk_dnd_util::NETSCAPE_URL, - gtk_dnd_util::TEXT_PLAIN, + static const int targets[] = { ui::TEXT_URI_LIST, + ui::NETSCAPE_URL, + ui::TEXT_PLAIN, -1 }; - gtk_dnd_util::SetDestTargetList(tabstrip_.get(), targets); + ui::SetDestTargetList(tabstrip_.get(), targets); g_signal_connect(tabstrip_.get(), "expose-event", G_CALLBACK(OnExposeThunk), this); @@ -1976,10 +1976,10 @@ gboolean TabStripGtk::OnDragDataReceived(GtkWidget* widget, guint info, guint time) { bool success = false; - if (info == gtk_dnd_util::TEXT_URI_LIST || - info == gtk_dnd_util::NETSCAPE_URL || - info == gtk_dnd_util::TEXT_PLAIN) { - success = CompleteDrop(data->data, info == gtk_dnd_util::TEXT_PLAIN); + if (info == ui::TEXT_URI_LIST || + info == ui::NETSCAPE_URL || + info == ui::TEXT_PLAIN) { + success = CompleteDrop(data->data, info == ui::TEXT_PLAIN); } gtk_drag_finish(context, success, success, time); diff --git a/chrome/browser/ui/views/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmark_bar_view.cc index f672ceb..61a5971 100644 --- a/chrome/browser/ui/views/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmark_bar_view.cc @@ -674,7 +674,7 @@ int BookmarkBarView::OnPerformDrop(const DropTargetEvent& event) { bookmark_drop_menu_->Cancel(); if (!drop_info_.get() || !drop_info_->drag_operation) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; const BookmarkNode* root = drop_info_->is_over_other ? model_->other_node() : @@ -1134,7 +1134,7 @@ int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) { // the new tab page, on the new tab page size_animation_ is always 0). This // typically is only hit if the user does something to inadvertanty trigger // dnd, such as pressing the mouse and hitting control-b. - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } for (int i = 0; i < GetBookmarkButtonCount(); ++i) { @@ -1144,7 +1144,7 @@ int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) { } } NOTREACHED(); - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } bool BookmarkBarView::CanStartDrag(views::View* sender, @@ -1426,7 +1426,7 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, event.y() >= other_bookmarked_button_->y() + other_bookmarked_button_->height()) { // Mouse isn't over a button. - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } bool found = false; @@ -1441,8 +1441,8 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, // No bookmarks, accept the drop. *index = 0; int ops = data.GetFirstNode(profile_) - ? DragDropTypes::DRAG_MOVE - : DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK; + ? ui::DragDropTypes::DRAG_MOVE + : ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; return bookmark_utils::PreferredDropOperation(event.GetSourceOperations(), ops); @@ -1488,14 +1488,14 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, // use the last visible index. *index = GetFirstHiddenNodeIndex(); } else { - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } } else if (mirrored_x < other_bookmarked_button_->x()) { // Mouse is after the last visible button but before more recently // bookmarked; use the last visible index. *index = GetFirstHiddenNodeIndex(); } else { - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } } diff --git a/chrome/browser/ui/views/bookmark_bar_view.h b/chrome/browser/ui/views/bookmark_bar_view.h index 49cec21..c02ed48 100644 --- a/chrome/browser/ui/views/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmark_bar_view.h @@ -409,7 +409,7 @@ class BookmarkBarView : public DetachableToolbarView, void StartShowFolderDropMenuTimer(const BookmarkNode* node); // Returns the drop operation and index for the drop based on the event - // and data. Returns DragDropTypes::DRAG_NONE if not a valid location. + // and data. Returns ui::DragDropTypes::DRAG_NONE if not a valid location. int CalculateDropOperation(const views::DropTargetEvent& event, const BookmarkNodeData& data, int* index, diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 0e3f14c..7e3726d 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -634,7 +634,7 @@ int BrowserActionsContainer::OnDragUpdated( if (GetViewForPoint(event.location()) == chevron_) { if (show_menu_task_factory_.empty() && !overflow_menu_) StartShowFolderDropMenuTimer(); - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } StopShowFolderDropMenuTimer(); @@ -684,7 +684,7 @@ int BrowserActionsContainer::OnDragUpdated( SetDropIndicator(width_before_icons + (before_icon * IconWidth(true)) - (kItemSpacing / 2)); - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } void BrowserActionsContainer::OnDragExited() { @@ -697,7 +697,7 @@ int BrowserActionsContainer::OnPerformDrop( const views::DropTargetEvent& event) { BrowserActionDragData data; if (!data.Read(event.GetData())) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; // Make sure we have the same view as we started with. DCHECK_EQ(browser_action_views_[data.index()]->button()->extension()->id(), @@ -732,7 +732,7 @@ int BrowserActionsContainer::OnPerformDrop( browser_action_views_[data.index()]->button()->extension(), i); OnDragExited(); // Perform clean up after dragging. - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } void BrowserActionsContainer::OnThemeChanged() { @@ -777,7 +777,7 @@ void BrowserActionsContainer::WriteDragData(View* sender, int BrowserActionsContainer::GetDragOperations(View* sender, const gfx::Point& p) { - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } bool BrowserActionsContainer::CanStartDrag(View* sender, diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc index 29edcc0a..7972aa1 100644 --- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc +++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc @@ -145,13 +145,13 @@ int BrowserActionOverflowMenuController::GetDropOperation( if ((item->GetCommand() == 0) && (*position == DROP_BEFORE)) { BrowserActionDragData drop_data; if (!drop_data.Read(event.GetData())) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; if (drop_data.index() < owner_->VisibleBrowserActions()) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } int BrowserActionOverflowMenuController::OnPerformDrop( @@ -160,7 +160,7 @@ int BrowserActionOverflowMenuController::OnPerformDrop( const views::DropTargetEvent& event) { BrowserActionDragData drop_data; if (!drop_data.Read(event.GetData())) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; size_t drop_index; ViewForId(menu->GetCommand(), &drop_index); @@ -175,7 +175,7 @@ int BrowserActionOverflowMenuController::OnPerformDrop( if (for_drop_) delete this; - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } bool BrowserActionOverflowMenuController::CanDrag(views::MenuItemView* menu) { @@ -194,7 +194,7 @@ void BrowserActionOverflowMenuController::WriteDragData( int BrowserActionOverflowMenuController::GetDragOperations( views::MenuItemView* sender) { - return DragDropTypes::DRAG_MOVE; + return ui::DragDropTypes::DRAG_MOVE; } BrowserActionView* BrowserActionOverflowMenuController::ViewForId( diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc index 32ed64b..720ca3b 100644 --- a/chrome/browser/ui/views/frame/browser_root_view.cc +++ b/chrome/browser/ui/views/frame/browser_root_view.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/frame/browser_root_view.h" -#include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" @@ -16,6 +15,7 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "grit/chromium_strings.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "ui/base/dragdrop/os_exchange_data.h" BrowserRootView::BrowserRootView(BrowserView* browser_view, @@ -74,7 +74,7 @@ int BrowserRootView::OnDragUpdated(const views::DropTargetEvent& event) { forwarding_to_tab_strip_ = false; tabstrip()->OnDragExited(); } - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; } void BrowserRootView::OnDragExited() { @@ -86,7 +86,7 @@ void BrowserRootView::OnDragExited() { int BrowserRootView::OnPerformDrop(const views::DropTargetEvent& event) { if (!forwarding_to_tab_strip_) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; // Extract the URL and create a new ui::OSExchangeData containing the URL. We // do this as the TabStrip doesn't know about the autocomplete edit and needs diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 4d2723b..ff40ad8 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -8,7 +8,6 @@ #include <gtk/gtk.h> #endif -#include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" @@ -44,6 +43,7 @@ #include "gfx/skia_util.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "views/controls/label.h" #include "views/drag_utils.h" @@ -1085,7 +1085,7 @@ AccessibilityTypes::Role LocationBarView::GetAccessibleRole() { void LocationBarView::WriteDragData(views::View* sender, const gfx::Point& press_pt, OSExchangeData* data) { - DCHECK(GetDragOperations(sender, press_pt) != DragDropTypes::DRAG_NONE); + DCHECK(GetDragOperations(sender, press_pt) != ui::DragDropTypes::DRAG_NONE); TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); DCHECK(tab_contents); @@ -1100,8 +1100,8 @@ int LocationBarView::GetDragOperations(views::View* sender, TabContents* tab_contents = GetTabContentsFromDelegate(delegate_); return (tab_contents && tab_contents->GetURL().is_valid() && !location_entry()->IsEditingOrEmpty()) ? - (DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK) : - DragDropTypes::DRAG_NONE; + (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) : + ui::DragDropTypes::DRAG_NONE; } bool LocationBarView::CanStartDrag(View* sender, diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 7bc49de..7145017 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/compiler_specific.h" @@ -23,6 +22,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/animation/animation_container.h" +#include "ui/base/dragdrop/drag_drop_types.h" #include "views/controls/image_view.h" #include "views/widget/default_theme_provider.h" #include "views/window/non_client_view.h" @@ -349,7 +349,7 @@ void TabStrip::OnDragExited() { int TabStrip::OnPerformDrop(const DropTargetEvent& event) { if (!drop_info_.get()) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; const int drop_index = drop_info_->drop_index; const bool drop_before = drop_info_->drop_before; @@ -360,7 +360,7 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) { GURL url; std::wstring title; if (!event.GetData().GetURLAndTitle(&url, &title) || !url.is_valid()) - return DragDropTypes::DRAG_NONE; + return ui::DragDropTypes::DRAG_NONE; controller()->PerformDrop(drop_before, drop_index, url); @@ -770,11 +770,11 @@ void TabStrip::SetDropIndex(int tab_data_index, bool drop_before) { int TabStrip::GetDropEffect(const views::DropTargetEvent& event) { const int source_ops = event.GetSourceOperations(); - if (source_ops & DragDropTypes::DRAG_COPY) - return DragDropTypes::DRAG_COPY; - if (source_ops & DragDropTypes::DRAG_LINK) - return DragDropTypes::DRAG_LINK; - return DragDropTypes::DRAG_MOVE; + if (source_ops & ui::DragDropTypes::DRAG_COPY) + return ui::DragDropTypes::DRAG_COPY; + if (source_ops & ui::DragDropTypes::DRAG_LINK) + return ui::DragDropTypes::DRAG_LINK; + return ui::DragDropTypes::DRAG_MOVE; } // static |