| OLD | NEW |
| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 10 #include "chrome/browser/extensions/image_loading_tracker.h" | 10 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 11 #include "chrome/browser/ui/views/extensions/extension_view.h" | |
| 12 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 11 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
| 13 #include "views/controls/menu/view_menu_delegate.h" | 12 #include "views/controls/menu/view_menu_delegate.h" |
| 14 | 13 |
| 15 class TabContentsWrapper; | 14 class TabContentsWrapper; |
| 16 namespace views { | 15 namespace views { |
| 17 class MenuButton; | 16 class MenuButton; |
| 18 } | 17 } |
| 19 | 18 |
| 20 class ExtensionInfoBar : public InfoBarView, | 19 class ExtensionInfoBar : public InfoBarView, |
| 21 public ExtensionView::Container, | |
| 22 public ImageLoadingTracker::Observer, | 20 public ImageLoadingTracker::Observer, |
| 23 public ExtensionInfoBarDelegate::DelegateObserver, | 21 public ExtensionInfoBarDelegate::DelegateObserver, |
| 24 public views::ViewMenuDelegate { | 22 public views::ViewMenuDelegate { |
| 25 public: | 23 public: |
| 26 ExtensionInfoBar(TabContentsWrapper* owner, | 24 ExtensionInfoBar(TabContentsWrapper* owner, |
| 27 ExtensionInfoBarDelegate* delegate); | 25 ExtensionInfoBarDelegate* delegate); |
| 28 | 26 |
| 29 private: | 27 private: |
| 30 virtual ~ExtensionInfoBar(); | 28 virtual ~ExtensionInfoBar(); |
| 31 | 29 |
| 32 // InfoBarView: | 30 // InfoBarView: |
| 33 virtual void Layout(); | 31 virtual void Layout(); |
| 34 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); | 32 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); |
| 35 virtual int ContentMinimumWidth() const; | 33 virtual int ContentMinimumWidth() const; |
| 36 | 34 |
| 37 // ExtensionView::Container: | |
| 38 virtual void OnExtensionMouseMove(ExtensionView* view); | |
| 39 virtual void OnExtensionMouseLeave(ExtensionView* view); | |
| 40 virtual void OnExtensionPreferredSizeChanged(ExtensionView* view); | |
| 41 | |
| 42 // ImageLoadingTracker::Observer: | 35 // ImageLoadingTracker::Observer: |
| 43 virtual void OnImageLoaded(SkBitmap* image, | 36 virtual void OnImageLoaded(SkBitmap* image, |
| 44 const ExtensionResource& resource, | 37 const ExtensionResource& resource, |
| 45 int index); | 38 int index); |
| 46 | 39 |
| 47 // ExtensionInfoBarDelegate::DelegateObserver: | 40 // ExtensionInfoBarDelegate::DelegateObserver: |
| 48 virtual void OnDelegateDeleted(); | 41 virtual void OnDelegateDeleted(); |
| 49 | 42 |
| 50 // views::ViewMenuDelegate: | 43 // views::ViewMenuDelegate: |
| 51 virtual void RunMenu(View* source, const gfx::Point& pt); | 44 virtual void RunMenu(View* source, const gfx::Point& pt); |
| 52 | 45 |
| 53 ExtensionInfoBarDelegate* GetDelegate(); | 46 ExtensionInfoBarDelegate* GetDelegate(); |
| 54 | 47 |
| 55 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once | 48 // TODO(pkasting): This shadows InfoBarView::delegate_. Get rid of this once |
| 56 // InfoBars own their delegates (and thus we don't need the DelegateObserver | 49 // InfoBars own their delegates (and thus we don't need the DelegateObserver |
| 57 // functionality). For now, almost everyone should use GetDelegate() instead. | 50 // functionality). For now, almost everyone should use GetDelegate() instead. |
| 58 InfoBarDelegate* delegate_; | 51 InfoBarDelegate* delegate_; |
| 59 | 52 |
| 60 // The dropdown menu for accessing the contextual extension actions. | 53 // The dropdown menu for accessing the contextual extension actions. |
| 61 views::MenuButton* menu_; | 54 views::MenuButton* menu_; |
| 62 | 55 |
| 63 // Keeps track of images being loaded on the File thread. | 56 // Keeps track of images being loaded on the File thread. |
| 64 ImageLoadingTracker tracker_; | 57 ImageLoadingTracker tracker_; |
| 65 | 58 |
| 66 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); | 59 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBar); |
| 67 }; | 60 }; |
| 68 | 61 |
| 69 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_EXTENSION_INFOBAR_H_ |
| OLD | NEW |