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

Side by Side Diff: trunk/src/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" 9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" 10 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
11 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" 11 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
12 #include "chrome/browser/ui/gtk/menu_gtk.h" 12 #include "chrome/browser/ui/gtk/menu_gtk.h"
13 #include "ui/gfx/gtk_util.h" 13 #include "ui/gfx/gtk_util.h"
14 14
15 class ExtensionContextMenuModel; 15 class ExtensionContextMenuModel;
16 class ExtensionViewGtk; 16 class ExtensionViewGtk;
17 class MenuGtk; 17 class MenuGtk;
18 18
19 class ExtensionInfoBarGtk : public InfoBarGtk, public MenuGtk::Delegate { 19 class ExtensionInfoBarGtk : public InfoBarGtk,
20 public MenuGtk::Delegate,
21 public ExtensionInfoBarDelegate::DelegateObserver {
20 public: 22 public:
21 explicit ExtensionInfoBarGtk(scoped_ptr<ExtensionInfoBarDelegate> delegate); 23 ExtensionInfoBarGtk(InfoBarService* owner,
24 ExtensionInfoBarDelegate* delegate);
22 25
23 private: 26 private:
24 virtual ~ExtensionInfoBarGtk(); 27 virtual ~ExtensionInfoBarGtk();
25 28
26 // InfoBarGtk: 29 // InfoBarGtk:
27 virtual void PlatformSpecificSetOwner() OVERRIDE;
28 virtual void PlatformSpecificHide(bool animate) OVERRIDE; 30 virtual void PlatformSpecificHide(bool animate) OVERRIDE;
29 virtual void GetTopColor(InfoBarDelegate::Type type, 31 virtual void GetTopColor(InfoBarDelegate::Type type,
30 double* r, double* g, double* b) OVERRIDE; 32 double* r, double* g, double* b) OVERRIDE;
31 virtual void GetBottomColor(InfoBarDelegate::Type type, 33 virtual void GetBottomColor(InfoBarDelegate::Type type,
32 double* r, double* g, double* b) OVERRIDE; 34 double* r, double* g, double* b) OVERRIDE;
35 virtual void InitWidgets() OVERRIDE;
33 36
34 // MenuGtk::Delegate: 37 // MenuGtk::Delegate:
35 virtual void StoppedShowing() OVERRIDE; 38 virtual void StoppedShowing() OVERRIDE;
36 39
40 // ExtensionInfoBarDelegate::DelegateObserver:
41 virtual void OnDelegateDeleted() OVERRIDE;
42
37 void OnImageLoaded(const gfx::Image& image); 43 void OnImageLoaded(const gfx::Image& image);
38 44
39 ExtensionInfoBarDelegate* GetDelegate(); 45 ExtensionInfoBarDelegate* GetDelegate();
40 46
41 // Looks at the window the infobar is in and gets the browser. Can return 47 // Looks at the window the infobar is in and gets the browser. Can return
42 // NULL if we aren't attached. 48 // NULL if we aren't attached.
43 Browser* GetBrowser(); 49 Browser* GetBrowser();
44 50
45 // Returns the context menu model for this extension. Can be NULL if 51 // Returns the context menu model for this extension. Can be NULL if
46 // extension context menus are disabled. 52 // extension context menus are disabled.
47 ExtensionContextMenuModel* BuildMenuModel(); 53 ExtensionContextMenuModel* BuildMenuModel();
48 54
49 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate, 55 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate,
50 GtkAllocation*); 56 GtkAllocation*);
51 57
52 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnButtonPress, 58 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnButtonPress,
53 GdkEventButton*); 59 GdkEventButton*);
54 60
55 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnExpose, 61 CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnExpose,
56 GdkEventExpose*); 62 GdkEventExpose*);
57 63
64 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once
65 // InfoBars own their delegates (and thus we don't need the DelegateObserver
66 // functionality). For now, almost everyone should use GetDelegate() instead.
67 InfoBarDelegate* delegate_;
68
58 ExtensionViewGtk* view_; 69 ExtensionViewGtk* view_;
59 70
60 // The button that activates the extension popup menu. Non-NULL if the 71 // The button that activates the extension popup menu. Non-NULL if the
61 // extension shows configure context menus and a dropdown menu should be used 72 // extension shows configure context menus and a dropdown menu should be used
62 // in place of the icon. If set, parents |icon_|. 73 // in place of the icon. If set, parents |icon_|.
63 GtkWidget* button_; 74 GtkWidget* button_;
64 75
65 // The GtkImage that shows the extension icon. If a dropdown menu should be 76 // The GtkImage that shows the extension icon. If a dropdown menu should be
66 // used, it's put inside |button_|, otherwise it's put directly in the hbox 77 // used, it's put inside |button_|, otherwise it's put directly in the hbox
67 // containing the infobar element. Composed in OnImageLoaded(). 78 // containing the infobar element. Composed in OnImageLoaded().
68 GtkWidget* icon_; 79 GtkWidget* icon_;
69 80
70 // An alignment with one pixel of bottom padding. This is set so the |view_| 81 // An alignment with one pixel of bottom padding. This is set so the |view_|
71 // doesn't overlap the bottom separator. This also makes it more convenient 82 // doesn't overlap the bottom separator. This also makes it more convenient
72 // to reattach the view since the alignment_ will have the |hbox_| packing 83 // to reattach the view since the alignment_ will have the |hbox_| packing
73 // child properties. Reparenting becomes easier too. 84 // child properties. Reparenting becomes easier too.
74 GtkWidget* alignment_; 85 GtkWidget* alignment_;
75 86
76 // The model for the current menu displayed. 87 // The model for the current menu displayed.
77 scoped_refptr<ExtensionContextMenuModel> context_menu_model_; 88 scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
78 89
79 base::WeakPtrFactory<ExtensionInfoBarGtk> weak_ptr_factory_; 90 base::WeakPtrFactory<ExtensionInfoBarGtk> weak_ptr_factory_;
80 91
81 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk); 92 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk);
82 }; 93 };
83 94
84 #endif // CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_ 95 #endif // CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698