NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / views / infobars / extension_infobar.h
blob8f8a42c839fe9be66a30dcf6f56add05ec6f353f
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/views/infobars/infobar_view.h"
10 #include "ui/views/controls/button/menu_button_listener.h"
12 class Browser;
13 class ExtensionInfoBarDelegate;
15 namespace views {
16 class ImageView;
17 class MenuButton;
20 class ExtensionInfoBar : public InfoBarView,
21 public views::MenuButtonListener {
22 public:
23 ExtensionInfoBar(scoped_ptr<ExtensionInfoBarDelegate> delegate,
24 Browser* browser);
26 private:
27 virtual ~ExtensionInfoBar();
29 // InfoBarView:
30 virtual void Layout() OVERRIDE;
31 virtual void ViewHierarchyChanged(
32 const ViewHierarchyChangedDetails& details) OVERRIDE;
33 virtual int ContentMinimumWidth() OVERRIDE;
35 // views::MenuButtonListener:
36 virtual void OnMenuButtonClicked(views::View* source,
37 const gfx::Point& point) OVERRIDE;
39 void OnImageLoaded(const gfx::Image& image);
40 ExtensionInfoBarDelegate* GetDelegate();
42 // Returns the width of all content other than the extension view. Layout()
43 // uses this to determine how much space the extension view can take.
44 int NonExtensionViewWidth() const;
46 Browser* browser_;
48 // The infobar icon used for the extension infobar. The icon can be either a
49 // plain image (in which case |icon_as_image_| is set) or a dropdown menu (in
50 // which case |icon_as_menu_| is set).
51 // The icon is a dropdown menu if the extension showing the infobar shows
52 // configure context menus.
53 views::View* infobar_icon_;
55 // The dropdown menu for accessing the contextual extension actions.
56 // It is non-NULL if the |infobar_icon_| is a menu button and in that case
57 // |icon_as_menu_ == infobar_icon_|.
58 views::MenuButton* icon_as_menu_;
60 // The image view for the icon.
61 // It is non-NULL if |infobar_icon_| is an image and in that case
62 // |icon_as_image_ == infobar_icon_|.
63 views::ImageView* icon_as_image_;
65 base::WeakPtrFactory<ExtensionInfoBar> weak_ptr_factory_;
67 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar);
70 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_