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

Unified Diff: chrome/browser/gtk/download_item_drag.cc

Issue 1029004: GTK: implement extension bookmark manager drag api.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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/gtk/download_item_drag.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/download_item_drag.cc
===================================================================
--- chrome/browser/gtk/download_item_drag.cc (revision 41880)
+++ chrome/browser/gtk/download_item_drag.cc (working copy)
@@ -1,83 +0,0 @@
-// Copyright (c) 2010 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/gtk/download_item_drag.h"
-
-#include "app/gtk_dnd_util.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/download/download_manager.h"
-#include "gfx/gtk_util.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/net_util.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace {
-
-const int kCodeMask = gtk_dnd_util::TEXT_URI_LIST |
- gtk_dnd_util::CHROME_NAMED_URL;
-const GdkDragAction kDragAction = GDK_ACTION_COPY;
-
-void OnDragDataGet(GtkWidget* widget, GdkDragContext* context,
- GtkSelectionData* selection_data,
- guint target_type, guint time,
- DownloadItem* download_item) {
- GURL url = net::FilePathToFileURL(download_item->full_path());
- gtk_dnd_util::WriteURLWithName(selection_data, url,
- UTF8ToUTF16(download_item->GetFileName().value()), target_type);
-}
-
-} // namespace
-
-// static
-void DownloadItemDrag::SetSource(GtkWidget* widget, DownloadItem* item) {
- gtk_drag_source_set(widget, GDK_BUTTON1_MASK, NULL, 0,
- kDragAction);
- gtk_dnd_util::SetSourceTargetListFromCodeMask(widget, kCodeMask);
- g_signal_connect(widget, "drag-data-get",
- G_CALLBACK(OnDragDataGet), item);
-}
-
-// static
-void DownloadItemDrag::BeginDrag(const DownloadItem* item, SkBitmap* icon) {
- new DownloadItemDrag(item, icon);
-}
-
-DownloadItemDrag::DownloadItemDrag(const DownloadItem* item,
- SkBitmap* icon)
- : drag_widget_(gtk_invisible_new()),
- pixbuf_(gfx::GdkPixbufFromSkBitmap(icon)) {
- g_object_ref_sink(drag_widget_);
- g_signal_connect(drag_widget_, "drag-data-get",
- G_CALLBACK(OnDragDataGet), const_cast<DownloadItem*>(item));
- g_signal_connect(drag_widget_, "drag-begin",
- G_CALLBACK(OnDragBegin), this);
- g_signal_connect(drag_widget_, "drag-end",
- G_CALLBACK(OnDragEnd), this);
-
- GtkTargetList* list = gtk_dnd_util::GetTargetListFromCodeMask(kCodeMask);
- GdkEvent* event = gtk_get_current_event();
- gtk_drag_begin(drag_widget_, list, kDragAction, 1, event);
- if (event)
- gdk_event_free(event);
- gtk_target_list_unref(list);
-}
-
-DownloadItemDrag::~DownloadItemDrag() {
- g_object_unref(pixbuf_);
- g_object_unref(drag_widget_);
-}
-
-// static
-void DownloadItemDrag::OnDragBegin(GtkWidget* widget,
- GdkDragContext* drag_context,
- DownloadItemDrag* drag) {
- gtk_drag_set_icon_pixbuf(drag_context, drag->pixbuf_, 0, 0);
-}
-
-// static
-void DownloadItemDrag::OnDragEnd(GtkWidget* widget,
- GdkDragContext* drag_context,
- DownloadItemDrag* drag) {
- delete drag;
-}
« no previous file with comments | « chrome/browser/gtk/download_item_drag.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698