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_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 10 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 | 13 |
14 class Browser; | 14 class Browser; |
15 class Extension; | |
16 class ExtensionHost; | 15 class ExtensionHost; |
17 class GURL; | 16 class GURL; |
18 | 17 |
| 18 namespace extensions { |
| 19 class Extension; |
| 20 } |
| 21 |
19 // The InfobarDelegate for creating and managing state for the ExtensionInfobar | 22 // The InfobarDelegate for creating and managing state for the ExtensionInfobar |
20 // plus monitor when the extension goes away. | 23 // plus monitor when the extension goes away. |
21 class ExtensionInfoBarDelegate : public InfoBarDelegate, | 24 class ExtensionInfoBarDelegate : public InfoBarDelegate, |
22 public content::NotificationObserver { | 25 public content::NotificationObserver { |
23 public: | 26 public: |
24 // The observer for when the delegate dies. | 27 // The observer for when the delegate dies. |
25 class DelegateObserver { | 28 class DelegateObserver { |
26 public: | 29 public: |
27 virtual void OnDelegateDeleted() = 0; | 30 virtual void OnDelegateDeleted() = 0; |
28 | 31 |
29 protected: | 32 protected: |
30 virtual ~DelegateObserver() {} | 33 virtual ~DelegateObserver() {} |
31 }; | 34 }; |
32 | 35 |
33 ExtensionInfoBarDelegate(Browser* browser, | 36 ExtensionInfoBarDelegate(Browser* browser, |
34 InfoBarTabHelper* infobar_helper, | 37 InfoBarTabHelper* infobar_helper, |
35 const Extension* extension, | 38 const extensions::Extension* extension, |
36 const GURL& url, | 39 const GURL& url, |
37 int height); | 40 int height); |
38 | 41 |
39 const Extension* extension() { return extension_; } | 42 const extensions::Extension* extension() { return extension_; } |
40 ExtensionHost* extension_host() { return extension_host_.get(); } | 43 ExtensionHost* extension_host() { return extension_host_.get(); } |
41 int height() { return height_; } | 44 int height() { return height_; } |
42 | 45 |
43 void set_observer(DelegateObserver* observer) { observer_ = observer; } | 46 void set_observer(DelegateObserver* observer) { observer_ = observer; } |
44 | 47 |
45 bool closing() const { return closing_; } | 48 bool closing() const { return closing_; } |
46 | 49 |
47 private: | 50 private: |
48 virtual ~ExtensionInfoBarDelegate(); | 51 virtual ~ExtensionInfoBarDelegate(); |
49 | 52 |
(...skipping 13 matching lines...) Expand all Loading... |
63 | 66 |
64 // The extension host we are showing the InfoBar for. The delegate needs to | 67 // The extension host we are showing the InfoBar for. The delegate needs to |
65 // own this since the InfoBar gets deleted and recreated when you switch tabs | 68 // own this since the InfoBar gets deleted and recreated when you switch tabs |
66 // and come back (and we don't want the user's interaction with the InfoBar to | 69 // and come back (and we don't want the user's interaction with the InfoBar to |
67 // get lost at that point). | 70 // get lost at that point). |
68 scoped_ptr<ExtensionHost> extension_host_; | 71 scoped_ptr<ExtensionHost> extension_host_; |
69 | 72 |
70 // The observer monitoring when the delegate dies. | 73 // The observer monitoring when the delegate dies. |
71 DelegateObserver* observer_; | 74 DelegateObserver* observer_; |
72 | 75 |
73 const Extension* extension_; | 76 const extensions::Extension* extension_; |
74 content::NotificationRegistrar registrar_; | 77 content::NotificationRegistrar registrar_; |
75 | 78 |
76 // The requested height of the infobar (in pixels). | 79 // The requested height of the infobar (in pixels). |
77 int height_; | 80 int height_; |
78 | 81 |
79 // Whether we are currently animating to close. This is used to ignore | 82 // Whether we are currently animating to close. This is used to ignore |
80 // ExtensionView::PreferredSizeChanged notifications. | 83 // ExtensionView::PreferredSizeChanged notifications. |
81 bool closing_; | 84 bool closing_; |
82 | 85 |
83 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 86 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |
84 }; | 87 }; |
85 | 88 |
86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |