diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 22:04:41 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-21 22:04:41 +0000 |
commit | ca340e836e37e450e86a2a180e02c77af319e4d7 (patch) | |
tree | 47998c9106f3c428dfbeb10b9ac262282270974f | |
parent | d6b671d0968013c3205c50ebaf45f356e34a58c5 (diff) | |
download | chromium_src-ca340e836e37e450e86a2a180e02c77af319e4d7.zip chromium_src-ca340e836e37e450e86a2a180e02c77af319e4d7.tar.gz chromium_src-ca340e836e37e450e86a2a180e02c77af319e4d7.tar.bz2 |
Remove src/app's dependency on the WebKit api.
src/app shouldn't depend on webkit in anyway. DEPS allows this
because it allows paths pulled in by deps = {} (stuff pulled in
by gclient). Add a new rule to explicitly disallow this.
Review URL: http://codereview.chromium.org/3998004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63434 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/DEPS | 5 | ||||
-rw-r--r-- | app/gtk_dnd_util.cc | 29 | ||||
-rw-r--r-- | app/gtk_dnd_util.h | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/gtk_util.cc | 29 | ||||
-rw-r--r-- | chrome/browser/gtk/gtk_util.h | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/tab_contents_drag_source.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_drag_dest_gtk.cc | 6 |
7 files changed, 43 insertions, 42 deletions
@@ -1,5 +1,3 @@ -# Do NOT add chrome to the list below. We shouldn't be including files from -# src/chrome in src/app. include_rules = [ "+gfx", "+grit/app_locale_settings.h", @@ -7,4 +5,7 @@ include_rules = [ "+net", "+skia", "+third_party/mozilla", + + "-chrome", + "-third_party/WebKit", ] diff --git a/app/gtk_dnd_util.cc b/app/gtk_dnd_util.cc index 38d171b..8b5f01a 100644 --- a/app/gtk_dnd_util.cc +++ b/app/gtk_dnd_util.cc @@ -13,13 +13,6 @@ static const int kBitsPerByte = 8; -using WebKit::WebDragOperationsMask; -using WebKit::WebDragOperation; -using WebKit::WebDragOperationNone; -using WebKit::WebDragOperationCopy; -using WebKit::WebDragOperationLink; -using WebKit::WebDragOperationMove; - namespace { void AddTargetToList(GtkTargetList* targets, int target_code) { @@ -238,26 +231,4 @@ bool ExtractURIList(GtkSelectionData* selection_data, std::vector<GURL>* urls) { return true; } -GdkDragAction WebDragOpToGdkDragAction(WebDragOperationsMask op) { - GdkDragAction action = static_cast<GdkDragAction>(0); - if (op & WebDragOperationCopy) - action = static_cast<GdkDragAction>(action | GDK_ACTION_COPY); - if (op & WebDragOperationLink) - action = static_cast<GdkDragAction>(action | GDK_ACTION_LINK); - if (op & WebDragOperationMove) - action = static_cast<GdkDragAction>(action | GDK_ACTION_MOVE); - return action; -} - -WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action) { - WebDragOperationsMask op = WebDragOperationNone; - if (action & GDK_ACTION_COPY) - op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy); - if (action & GDK_ACTION_LINK) - op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink); - if (action & GDK_ACTION_MOVE) - op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove); - return op; -} - } // namespace gtk_dnd_util diff --git a/app/gtk_dnd_util.h b/app/gtk_dnd_util.h index 79ae2a5..32edf22 100644 --- a/app/gtk_dnd_util.h +++ b/app/gtk_dnd_util.h @@ -11,7 +11,6 @@ #include <vector> #include "base/string16.h" -#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" class GURL; @@ -79,11 +78,6 @@ bool ExtractNamedURL(GtkSelectionData* selection_data, bool ExtractURIList(GtkSelectionData* selection_data, std::vector<GURL>* urls); -// Convenience methods for converting between web drag operations and the GDK -// equivalent. -GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op); -WebKit::WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action); - } // namespace gtk_dnd_util #endif // APP_GTK_DND_UTIL_H_ diff --git a/chrome/browser/gtk/gtk_util.cc b/chrome/browser/gtk/gtk_util.cc index 57d4f4d..babed07 100644 --- a/chrome/browser/gtk/gtk_util.cc +++ b/chrome/browser/gtk/gtk_util.cc @@ -37,6 +37,13 @@ #include "views/window/window.h" #endif // defined(OS_CHROMEOS) +using WebKit::WebDragOperationsMask; +using WebKit::WebDragOperation; +using WebKit::WebDragOperationNone; +using WebKit::WebDragOperationCopy; +using WebKit::WebDragOperationLink; +using WebKit::WebDragOperationMove; + namespace { const char kBoldLabelMarkup[] = "<span weight='bold'>%s</span>"; @@ -1107,6 +1114,28 @@ void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label) { gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); } +GdkDragAction WebDragOpToGdkDragAction(WebDragOperationsMask op) { + GdkDragAction action = static_cast<GdkDragAction>(0); + if (op & WebDragOperationCopy) + action = static_cast<GdkDragAction>(action | GDK_ACTION_COPY); + if (op & WebDragOperationLink) + action = static_cast<GdkDragAction>(action | GDK_ACTION_LINK); + if (op & WebDragOperationMove) + action = static_cast<GdkDragAction>(action | GDK_ACTION_MOVE); + return action; +} + +WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action) { + WebDragOperationsMask op = WebDragOperationNone; + if (action & GDK_ACTION_COPY) + op = static_cast<WebDragOperationsMask>(op | WebDragOperationCopy); + if (action & GDK_ACTION_LINK) + op = static_cast<WebDragOperationsMask>(op | WebDragOperationLink); + if (action & GDK_ACTION_MOVE) + op = static_cast<WebDragOperationsMask>(op | WebDragOperationMove); + return op; +} + void DrawTopDropShadowForRenderView(cairo_t* cr, const gfx::Point& origin, const gfx::Rect& paint_rect) { gfx::Rect shadow_rect(paint_rect.x(), origin.y(), diff --git a/chrome/browser/gtk/gtk_util.h b/chrome/browser/gtk/gtk_util.h index 9c6e158..466ba7e 100644 --- a/chrome/browser/gtk/gtk_util.h +++ b/chrome/browser/gtk/gtk_util.h @@ -14,6 +14,7 @@ #include "base/string16.h" #include "gfx/point.h" #include "gfx/rect.h" +#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" #include "webkit/glue/window_open_disposition.h" typedef struct _cairo cairo_t; @@ -338,6 +339,11 @@ void SetLabelWidth(GtkWidget* label, int pixel_width); // to make sure the pango can get correct font information for the calculation. void InitLabelSizeRequestAndEllipsizeMode(GtkWidget* label); +// Convenience methods for converting between web drag operations and the GDK +// equivalent. +GdkDragAction WebDragOpToGdkDragAction(WebKit::WebDragOperationsMask op); +WebKit::WebDragOperationsMask GdkDragActionToWebDragOp(GdkDragAction action); + // Code to draw the drop shadow below an infobar (at the top of the render // view). void DrawTopDropShadowForRenderView(cairo_t* cr, const gfx::Point& origin, diff --git a/chrome/browser/gtk/tab_contents_drag_source.cc b/chrome/browser/gtk/tab_contents_drag_source.cc index e6da6ad..393fc99 100644 --- a/chrome/browser/gtk/tab_contents_drag_source.cc +++ b/chrome/browser/gtk/tab_contents_drag_source.cc @@ -126,7 +126,7 @@ void TabContentsDragSource::StartDragging(const WebDropData& drop_data, // initiating event from webkit. GdkDragContext* context = gtk_drag_begin( drag_widget_, list, - gtk_dnd_util::WebDragOpToGdkDragAction(allowed_ops), + gtk_util::WebDragOpToGdkDragAction(allowed_ops), 1, // Drags are always initiated by the left button. reinterpret_cast<GdkEvent*>(last_mouse_down)); // The drag adds a ref; let it own the list. @@ -356,7 +356,7 @@ void TabContentsDragSource::OnDragEnd(GtkWidget* sender, if (tab_contents()->render_view_host()) { tab_contents()->render_view_host()->DragSourceEndedAt( client.x(), client.y(), root.x(), root.y(), - gtk_dnd_util::GdkDragActionToWebDragOp(drag_context->action)); + gtk_util::GdkDragActionToWebDragOp(drag_context->action)); } } diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc index f4d2c3e..c0b3d9a 100644 --- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc +++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc @@ -74,7 +74,7 @@ WebDragDestGtk::~WebDragDestGtk() { void WebDragDestGtk::UpdateDragStatus(WebDragOperation operation) { if (context_) { is_drop_target_ = operation != WebDragOperationNone; - gdk_drag_status(context_, gtk_dnd_util::WebDragOpToGdkDragAction(operation), + gdk_drag_status(context_, gtk_util::WebDragOpToGdkDragAction(operation), drag_over_time_); } } @@ -125,7 +125,7 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender, DragTargetDragOver( gtk_util::ClientPoint(widget_), gtk_util::ScreenPoint(widget_), - gtk_dnd_util::GdkDragActionToWebDragOp(context->actions)); + gtk_util::GdkDragActionToWebDragOp(context->actions)); if (tab_contents_->GetBookmarkDragDelegate()) tab_contents_->GetBookmarkDragDelegate()->OnDragOver(bookmark_drag_data_); drag_over_time_ = time; @@ -233,7 +233,7 @@ void WebDragDestGtk::OnDragDataReceived( DragTargetDragEnter(*drop_data_.get(), gtk_util::ClientPoint(widget_), gtk_util::ScreenPoint(widget_), - gtk_dnd_util::GdkDragActionToWebDragOp(context->actions)); + gtk_util::GdkDragActionToWebDragOp(context->actions)); // This is non-null if tab_contents_ is showing an ExtensionDOMUI with // support for (at the moment experimental) drag and drop extensions. |