| OLD | NEW |
| 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/ui/views/infobars/infobar_view.h" | 9 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 10 #include "ui/views/controls/button/menu_button_listener.h" | 10 #include "ui/views/controls/button/menu_button_listener.h" |
| 11 | 11 |
| 12 class Browser; | 12 class Browser; |
| 13 class ExtensionInfoBarDelegate; | 13 class ExtensionInfoBarDelegate; |
| 14 class ExtensionViewViews; |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 class ImageView; | 17 class ImageView; |
| 17 class MenuButton; | 18 class MenuButton; |
| 18 } | 19 } |
| 19 | 20 |
| 20 class ExtensionInfoBar : public InfoBarView, | 21 class ExtensionInfoBar : public InfoBarView, |
| 21 public views::MenuButtonListener { | 22 public views::MenuButtonListener { |
| 22 public: | 23 public: |
| 23 ExtensionInfoBar(scoped_ptr<ExtensionInfoBarDelegate> delegate, | 24 ExtensionInfoBar(scoped_ptr<ExtensionInfoBarDelegate> delegate, |
| 24 Browser* browser); | 25 Browser* browser); |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 virtual ~ExtensionInfoBar(); | 28 virtual ~ExtensionInfoBar(); |
| 28 | 29 |
| 29 // InfoBarView: | 30 // InfoBarView: |
| 30 virtual void Layout() OVERRIDE; | 31 virtual void Layout() OVERRIDE; |
| 31 virtual void ViewHierarchyChanged( | 32 virtual void ViewHierarchyChanged( |
| 32 const ViewHierarchyChangedDetails& details) OVERRIDE; | 33 const ViewHierarchyChangedDetails& details) OVERRIDE; |
| 33 virtual int ContentMinimumWidth() const OVERRIDE; | 34 virtual int ContentMinimumWidth() const OVERRIDE; |
| 34 | 35 |
| 35 // views::MenuButtonListener: | 36 // views::MenuButtonListener: |
| 36 virtual void OnMenuButtonClicked(views::View* source, | 37 virtual void OnMenuButtonClicked(views::View* source, |
| 37 const gfx::Point& point) OVERRIDE; | 38 const gfx::Point& point) OVERRIDE; |
| 38 | 39 |
| 39 void OnImageLoaded(const gfx::Image& image); | 40 void OnImageLoaded(const gfx::Image& image); |
| 40 ExtensionInfoBarDelegate* GetDelegate(); | 41 ExtensionInfoBarDelegate* GetDelegate(); |
| 41 const ExtensionInfoBarDelegate* GetDelegate() const; | 42 const ExtensionInfoBarDelegate* GetDelegate() const; |
| 43 ExtensionViewViews* GetExtensionView(); |
| 42 | 44 |
| 43 // Returns the width of all content other than the extension view. Layout() | 45 // Returns the width of all content other than the extension view. Layout() |
| 44 // uses this to determine how much space the extension view can take. | 46 // uses this to determine how much space the extension view can take. |
| 45 int NonExtensionViewWidth() const; | 47 int NonExtensionViewWidth() const; |
| 46 | 48 |
| 47 Browser* browser_; | 49 Browser* browser_; |
| 48 | 50 |
| 49 // The infobar icon used for the extension infobar. The icon can be either a | 51 // The infobar icon used for the extension infobar. The icon can be either a |
| 50 // plain image (in which case |icon_as_image_| is set) or a dropdown menu (in | 52 // plain image (in which case |icon_as_image_| is set) or a dropdown menu (in |
| 51 // which case |icon_as_menu_| is set). | 53 // which case |icon_as_menu_| is set). |
| (...skipping 10 matching lines...) Expand all Loading... |
| 62 // It is non-NULL if |infobar_icon_| is an image and in that case | 64 // It is non-NULL if |infobar_icon_| is an image and in that case |
| 63 // |icon_as_image_ == infobar_icon_|. | 65 // |icon_as_image_ == infobar_icon_|. |
| 64 views::ImageView* icon_as_image_; | 66 views::ImageView* icon_as_image_; |
| 65 | 67 |
| 66 base::WeakPtrFactory<ExtensionInfoBar> weak_ptr_factory_; | 68 base::WeakPtrFactory<ExtensionInfoBar> weak_ptr_factory_; |
| 67 | 69 |
| 68 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); | 70 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ | 73 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ |
| OLD | NEW |