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