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

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

Issue 99276: Improvements to Linux InfoBubble and BookmarkBubble. (Closed)
Patch Set: Review feedback. Created 11 years, 8 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 | « no previous file | chrome/browser/gtk/bookmark_bubble_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_bubble_gtk.h
diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.h b/chrome/browser/gtk/bookmark_bubble_gtk.h
index f456ba1ce60651a4dcf21636cb319de852c6af24..123ff81b85c773b60bea2a3e91e14f9485d9b439 100644
--- a/chrome/browser/gtk/bookmark_bubble_gtk.h
+++ b/chrome/browser/gtk/bookmark_bubble_gtk.h
@@ -2,25 +2,71 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// This is the GTK implementation of the bookmark bubble, the dialog box
+// presented to create or edit a bookmark. There can only ever be a single
+// bubble open, so the class presents only static methods, and handles the
+// singleton behavior for you. It also handles the object and widget
+// lifetimes, destroying everything and possibly committing any changes when
+// the bubble is closed.
+
#ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
#define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
+#include <gtk/gtk.h>
+
#include "base/basictypes.h"
+#include "chrome/browser/gtk/info_bubble_gtk.h"
#include "googleurl/src/gurl.h"
-typedef struct _GtkWidget GtkWidget;
-
class Profile;
namespace gfx {
class Rect;
}
-class BookmarkBubbleGtk {
+class BookmarkBubbleGtk : public InfoBubbleGtkDelegate {
public:
+ // Shows the bookmark bubble, pointing at |rect|.
static void Show(const gfx::Rect& rect,
Profile* profile,
const GURL& url,
bool newly_bookmarked);
+
+ // Implements the InfoBubbleGtkDelegate. We are notified when the bubble
+ // is about to be closed, so we have a chance to save any state / input in
+ // our widgets before they are destroyed.
+ virtual void InfoBubbleClosing(InfoBubbleGtk* info_bubble,
+ bool closed_by_escape);
+
+ private:
+ BookmarkBubbleGtk(const gfx::Rect& rect,
+ Profile* profile,
+ const GURL& url,
+ bool newly_bookmarked);
+ ~BookmarkBubbleGtk();
+
+ static gboolean HandleDestroyThunk(GtkWidget* widget,
+ gpointer userdata) {
+ return reinterpret_cast<BookmarkBubbleGtk*>(userdata)->
+ HandleDestroy();
+ }
+ // Notified when |content_| is destroyed so we can delete our instance.
+ gboolean HandleDestroy();
+
+ // The URL of the bookmark.
+ GURL url_;
+ // Our current profile (used to access the bookmark system).
+ Profile* profile_;
+ // Whether the bubble is creating or editing an existing bookmark.
+ bool newly_bookmarked_;
+
+ // We let the InfoBubble own our content, and then we delete ourself
+ // when the widget is destroyed (when the InfoBubble is destroyed).
+ GtkWidget* content_;
+
+ // The combo box for selecting the bookmark folder.
+ GtkWidget* combo_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleGtk);
};
#endif // CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698