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

Unified Diff: chrome/browser/gtk/browser_actions_toolbar_gtk.h

Issue 463056: GTK: hook up drag and drop of browser actions (for reordering).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_actions_toolbar_gtk.h
===================================================================
--- chrome/browser/gtk/browser_actions_toolbar_gtk.h (revision 34134)
+++ chrome/browser/gtk/browser_actions_toolbar_gtk.h (working copy)
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
#define CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_
+#include <gtk/gtk.h>
+
#include <map>
#include <string>
@@ -39,15 +41,18 @@
void Update();
private:
+ friend class BrowserActionButton;
+
+ // Initialize drag and drop.
+ void SetupDrags();
+
// Query the extensions service for all extensions with browser actions,
// and create the UI for them.
void CreateAllButtons();
// Create the UI for a single browser action. This will stick the button
// at the end of the toolbar.
- // TODO(estade): is this OK, or does it need to place it in a specific
- // location on the toolbar?
- void CreateButtonForExtension(Extension* extension);
+ void CreateButtonForExtension(Extension* extension, int index);
// Delete resources associated with UI for a browser action.
void RemoveButtonForExtension(Extension* extension);
@@ -59,7 +64,28 @@
// ExtensionToolbarModel::Observer implementation.
virtual void BrowserActionAdded(Extension* extension, int index);
virtual void BrowserActionRemoved(Extension* extension);
+ virtual void BrowserActionMoved(Extension* extension, int index);
+ // Called by the BrowserActionButton in response to drag-begin.
+ void DragStarted(BrowserActionButton* button, GdkDragContext* drag_context);
+
+ static gboolean OnDragMotionThunk(GtkWidget* widget,
+ GdkDragContext* drag_context,
+ gint x, gint y, guint time,
+ BrowserActionsToolbarGtk* toolbar) {
+ return toolbar->OnDragMotion(widget, drag_context, x, y, time);
+ }
+ gboolean OnDragMotion(GtkWidget* widget,
+ GdkDragContext* drag_context,
+ gint x, gint y, guint time);
+
+ static void OnDragEndThunk(GtkWidget* button,
+ GdkDragContext* drag_context,
+ BrowserActionsToolbarGtk* toolbar) {
+ toolbar->OnDragEnd(button, drag_context);
+ }
+ void OnDragEnd(GtkWidget* button, GdkDragContext* drag_context);
+
Browser* browser_;
Profile* profile_;
@@ -68,6 +94,12 @@
OwnedWidgetGtk hbox_;
+ // The button that is currently being dragged, or NULL.
+ BrowserActionButton* drag_button_;
+
+ // The new position of the button in the drag, or -1.
+ int drop_index_;
+
// Map from extension ID to BrowserActionButton, which is a wrapper for
// a chrome button and related functionality. There should be one entry
// for every extension that has a browser action.
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.cc ('k') | chrome/browser/gtk/browser_actions_toolbar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698