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

Unified Diff: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h

Issue 7809007: GTK: Clean up the gtk extension infobar implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 9 years, 4 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
Index: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h
diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h
index 311f4caf9d7e183b7815d50664166619bfcb9493..3e088871374a57b339e14ce68676648b4ee63e4b 100644
--- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h
+++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h
@@ -10,36 +10,84 @@
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
#include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
+#include "chrome/browser/ui/gtk/menu_gtk.h"
+#include "ui/base/gtk/gtk_signal_registrar.h"
#include "ui/gfx/gtk_util.h"
+class ExtensionContextMenuModel;
class ExtensionInfobarDelegate;
class ExtensionResource;
class ExtensionViewGtk;
+class MenuGtk;
class ExtensionInfoBarGtk : public InfoBarGtk,
- public ImageLoadingTracker::Observer {
+ public ImageLoadingTracker::Observer,
+ public MenuGtk::Delegate {
public:
ExtensionInfoBarGtk(TabContentsWrapper* owner,
ExtensionInfoBarDelegate* delegate);
virtual ~ExtensionInfoBarGtk();
+ // Overridden from InfoBar (through InfoBarGtk):
+ virtual void PlatformSpecificHide(bool animate);
+
+ // Overridden from InfoBarGtk:
+ virtual void GetTopColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+ virtual void GetBottomColor(InfoBarDelegate::Type type,
+ double* r, double* g, double *b);
+
// Overridden from ImageLoadingTracker::Observer:
virtual void OnImageLoaded(
SkBitmap* image, const ExtensionResource& resource, int index);
+ // Overridden from MenuGtk::Delegate:
+ virtual void StoppedShowing();
+
private:
// Build the widgets of the Infobar.
void BuildWidgets();
+ // Looks at the window the infobar is in and gets the browser. Can return
+ // NULL if we aren't attached.
+ Browser* GetBrowser();
+
+ // Returns the context menu for this extension. Can be NULL if extension
+ // context menus are disabled.
+ MenuGtk* BuildContextMenu();
+
CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate,
GtkAllocation*);
+ CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnButtonPress,
+ GdkEventButton*);
+
ImageLoadingTracker tracker_;
ExtensionInfoBarDelegate* delegate_;
ExtensionViewGtk* view_;
+ // The button that activates the extension popup menu. Parent of |icon_|.
+ GtkWidget* button_;
+
+ // The GtkImage that is inside of |button_|, composed in OnImageLoaded().
+ GtkWidget* icon_;
+
+ // An alignment with one pixel of bottom padding. This is set so the |view_|
+ // doesn't overlap the bottom separator. This also makes it more convenient
+ // to reattach the view since the alignment_ will have the |hbox_| packing
+ // child properties. Reparenting becomes easier too.
+ GtkWidget* alignment_;
+
+ // We connect to signals on a gtk object that we only hold a weak reference
+ // to which outlives us.
+ ui::GtkSignalRegistrar signals_;
+
+ // The context menu view and model for this extension action.
Evan Stade 2011/08/31 20:00:12 I don't think it's technically a context menu unle
+ scoped_ptr<MenuGtk> context_menu_;
+ scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk);
};

Powered by Google App Engine
This is Rietveld 408576698