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