| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ |
| 6 #define CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ | 6 #define CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/views/infobars/infobars.h" | 8 #include "chrome/browser/views/infobars/infobars.h" |
| 9 | 9 |
| 10 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 10 #include "chrome/browser/views/extensions/extension_view.h" | 11 #include "chrome/browser/views/extensions/extension_view.h" |
| 11 #include "views/controls/menu/view_menu_delegate.h" | 12 #include "views/controls/menu/view_menu_delegate.h" |
| 12 | 13 |
| 13 class ExtensionContextMenuModel; | 14 class ExtensionContextMenuModel; |
| 14 class ExtensionInfoBarDelegate; | 15 class ExtensionInfoBarDelegate; |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class MenuButton; | 18 class MenuButton; |
| 18 class Menu2; | 19 class Menu2; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // This class implements InfoBars for Extensions. | 22 // This class implements InfoBars for Extensions. |
| 22 class ExtensionInfoBar : public InfoBar, | 23 class ExtensionInfoBar : public InfoBar, |
| 23 public ExtensionView::Container, | 24 public ExtensionView::Container, |
| 25 public ImageLoadingTracker::Observer, |
| 24 public views::ViewMenuDelegate { | 26 public views::ViewMenuDelegate { |
| 25 public: | 27 public: |
| 26 explicit ExtensionInfoBar(ExtensionInfoBarDelegate* delegate); | 28 explicit ExtensionInfoBar(ExtensionInfoBarDelegate* delegate); |
| 27 virtual ~ExtensionInfoBar(); | 29 virtual ~ExtensionInfoBar(); |
| 28 | 30 |
| 29 // Overridden from ExtensionView::Container: | 31 // Overridden from ExtensionView::Container: |
| 30 virtual void OnExtensionMouseEvent(ExtensionView* view) {} | 32 virtual void OnExtensionMouseEvent(ExtensionView* view) {} |
| 31 virtual void OnExtensionMouseLeave(ExtensionView* view) {} | 33 virtual void OnExtensionMouseLeave(ExtensionView* view) {} |
| 32 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); | 34 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); |
| 33 | 35 |
| 34 // Overridden from views::View: | 36 // Overridden from views::View: |
| 35 virtual void Layout(); | 37 virtual void Layout(); |
| 36 | 38 |
| 39 // Overridden from ImageLoadingTracker::Observer: |
| 40 virtual void OnImageLoaded( |
| 41 SkBitmap* image, ExtensionResource resource, int index); |
| 42 |
| 37 // Overridden from views::ViewMenuDelegate: | 43 // Overridden from views::ViewMenuDelegate: |
| 38 virtual void RunMenu(View* source, const gfx::Point& pt); | 44 virtual void RunMenu(View* source, const gfx::Point& pt); |
| 39 | 45 |
| 40 private: | 46 private: |
| 41 // Setup the menu button showing the small extension icon and its dropdown | 47 // Setup the menu button showing the small extension icon and its dropdown |
| 42 // menu. | 48 // menu. |
| 43 void SetupIconAndMenu(); | 49 void SetupIconAndMenu(); |
| 44 | 50 |
| 45 NotificationRegistrar notification_registrar_; | 51 NotificationRegistrar notification_registrar_; |
| 46 | 52 |
| 47 ExtensionInfoBarDelegate* delegate_; | 53 ExtensionInfoBarDelegate* delegate_; |
| 48 | 54 |
| 49 // The dropdown menu for accessing the contextual extension actions. | 55 // The dropdown menu for accessing the contextual extension actions. |
| 50 scoped_ptr<ExtensionContextMenuModel> options_menu_contents_; | 56 scoped_ptr<ExtensionContextMenuModel> options_menu_contents_; |
| 51 scoped_ptr<views::Menu2> options_menu_menu_; | 57 scoped_ptr<views::Menu2> options_menu_menu_; |
| 52 views::MenuButton* menu_; | 58 views::MenuButton* menu_; |
| 53 | 59 |
| 60 // Keeps track of images being loaded on the File thread. |
| 61 ImageLoadingTracker tracker_; |
| 62 |
| 54 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); | 63 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); |
| 55 }; | 64 }; |
| 56 | 65 |
| 57 #endif // CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ | 66 #endif // CHROME_BROWSER_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ |
| OLD | NEW |