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

Side by Side Diff: chrome/browser/ui/views/infobars/extension_infobar.h

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/extensions/extension_infobar_delegate.h"
10 #include "chrome/browser/ui/views/infobars/infobar_view.h" 9 #include "chrome/browser/ui/views/infobars/infobar_view.h"
11 #include "ui/views/controls/button/menu_button_listener.h" 10 #include "ui/views/controls/button/menu_button_listener.h"
12 11
13 class Browser; 12 class Browser;
13 class ExtensionInfoBarDelegate;
14 namespace views { 14 namespace views {
15 class ImageView; 15 class ImageView;
16 class MenuButton; 16 class MenuButton;
17 } 17 }
18 18
19 class ExtensionInfoBar : public InfoBarView, 19 class ExtensionInfoBar : public InfoBarView,
20 public ExtensionInfoBarDelegate::DelegateObserver,
21 public views::MenuButtonListener { 20 public views::MenuButtonListener {
22 public: 21 public:
23 ExtensionInfoBar(InfoBarService* owner, 22 ExtensionInfoBar(scoped_ptr<ExtensionInfoBarDelegate> delegate,
24 ExtensionInfoBarDelegate* delegate,
25 Browser* browser); 23 Browser* browser);
26 24
27 private: 25 private:
28 virtual ~ExtensionInfoBar(); 26 virtual ~ExtensionInfoBar();
29 27
30 // InfoBarView: 28 // InfoBarView:
31 virtual void Layout() OVERRIDE; 29 virtual void Layout() OVERRIDE;
32 virtual void ViewHierarchyChanged( 30 virtual void ViewHierarchyChanged(
33 const ViewHierarchyChangedDetails& details) OVERRIDE; 31 const ViewHierarchyChangedDetails& details) OVERRIDE;
34 virtual int ContentMinimumWidth() const OVERRIDE; 32 virtual int ContentMinimumWidth() const OVERRIDE;
35 33
36 // ExtensionInfoBarDelegate::DelegateObserver:
37 virtual void OnDelegateDeleted() OVERRIDE;
38
39 // views::MenuButtonListener: 34 // views::MenuButtonListener:
40 virtual void OnMenuButtonClicked(views::View* source, 35 virtual void OnMenuButtonClicked(views::View* source,
41 const gfx::Point& point) OVERRIDE; 36 const gfx::Point& point) OVERRIDE;
42 37
43 void OnImageLoaded(const gfx::Image& image); 38 void OnImageLoaded(const gfx::Image& image);
44 39
45 ExtensionInfoBarDelegate* GetDelegate(); 40 ExtensionInfoBarDelegate* GetDelegate();
46 41
47 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once
48 // InfoBars own their delegates (and thus we don't need the DelegateObserver
49 // functionality). For now, almost everyone should use GetDelegate() instead.
50 InfoBarDelegate* delegate_;
51
52 Browser* browser_; 42 Browser* browser_;
53 43
54 // The infobar icon used for the extension infobar. The icon can be either a 44 // The infobar icon used for the extension infobar. The icon can be either a
55 // plain image (in which case |icon_as_image_| is set) or a dropdown menu (in 45 // plain image (in which case |icon_as_image_| is set) or a dropdown menu (in
56 // which case |icon_as_menu_| is set). 46 // which case |icon_as_menu_| is set).
57 // The icon is a dropdown menu if the extension showing the infobar shows 47 // The icon is a dropdown menu if the extension showing the infobar shows
58 // configure context menus. 48 // configure context menus.
59 views::View* infobar_icon_; 49 views::View* infobar_icon_;
60 50
61 // The dropdown menu for accessing the contextual extension actions. 51 // The dropdown menu for accessing the contextual extension actions.
62 // It is non-NULL if the |infobar_icon_| is a menu button and in that case 52 // It is non-NULL if the |infobar_icon_| is a menu button and in that case
63 // |icon_as_menu_ == infobar_icon_|. 53 // |icon_as_menu_ == infobar_icon_|.
64 views::MenuButton* icon_as_menu_; 54 views::MenuButton* icon_as_menu_;
65 55
66 // The image view for the icon. 56 // The image view for the icon.
67 // It is non-NULL if |infobar_icon_| is an image and in that case 57 // It is non-NULL if |infobar_icon_| is an image and in that case
68 // |icon_as_image_ == infobar_icon_|. 58 // |icon_as_image_ == infobar_icon_|.
69 views::ImageView* icon_as_image_; 59 views::ImageView* icon_as_image_;
70 60
71 base::WeakPtrFactory<ExtensionInfoBar> weak_ptr_factory_; 61 base::WeakPtrFactory<ExtensionInfoBar> weak_ptr_factory_;
72 62
73 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); 63 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar);
74 }; 64 };
75 65
76 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ 66 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698