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_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 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 // The observer for when the delegate dies. | 27 // The observer for when the delegate dies. |
28 class DelegateObserver { | 28 class DelegateObserver { |
29 public: | 29 public: |
30 virtual void OnDelegateDeleted() = 0; | 30 virtual void OnDelegateDeleted() = 0; |
31 | 31 |
32 protected: | 32 protected: |
33 virtual ~DelegateObserver() {} | 33 virtual ~DelegateObserver() {} |
34 }; | 34 }; |
35 | 35 |
36 ExtensionInfoBarDelegate(Browser* browser, | 36 virtual ~ExtensionInfoBarDelegate(); |
37 InfoBarService* infobar_service, | 37 |
38 const extensions::Extension* extension, | 38 // Creates an extension delegate and adds it to |infobar_service|. |
39 const GURL& url, | 39 static void Create(InfoBarService* infobar_service, |
40 int height); | 40 Browser* browser, |
| 41 const extensions::Extension* extension, |
| 42 const GURL& url, |
| 43 int height); |
41 | 44 |
42 const extensions::Extension* extension() { return extension_; } | 45 const extensions::Extension* extension() { return extension_; } |
43 extensions::ExtensionHost* extension_host() { return extension_host_.get(); } | 46 extensions::ExtensionHost* extension_host() { return extension_host_.get(); } |
44 int height() { return height_; } | 47 int height() { return height_; } |
45 | 48 |
46 void set_observer(DelegateObserver* observer) { observer_ = observer; } | 49 void set_observer(DelegateObserver* observer) { observer_ = observer; } |
47 | 50 |
48 bool closing() const { return closing_; } | 51 bool closing() const { return closing_; } |
49 | 52 |
50 private: | 53 private: |
51 virtual ~ExtensionInfoBarDelegate(); | 54 ExtensionInfoBarDelegate(Browser* browser, |
| 55 InfoBarService* infobar_service, |
| 56 const extensions::Extension* extension, |
| 57 const GURL& url, |
| 58 int height); |
52 | 59 |
53 // InfoBarDelegate: | 60 // InfoBarDelegate: |
54 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; | 61 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; |
55 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; | 62 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; |
56 virtual void InfoBarDismissed() OVERRIDE; | 63 virtual void InfoBarDismissed() OVERRIDE; |
57 virtual Type GetInfoBarType() const OVERRIDE; | 64 virtual Type GetInfoBarType() const OVERRIDE; |
58 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; | 65 virtual ExtensionInfoBarDelegate* AsExtensionInfoBarDelegate() OVERRIDE; |
59 | 66 |
60 // content::NotificationObserver: | 67 // content::NotificationObserver: |
61 virtual void Observe(int type, | 68 virtual void Observe(int type, |
(...skipping 18 matching lines...) Expand all Loading... |
80 int height_; | 87 int height_; |
81 | 88 |
82 // Whether we are currently animating to close. This is used to ignore | 89 // Whether we are currently animating to close. This is used to ignore |
83 // ExtensionView::PreferredSizeChanged notifications. | 90 // ExtensionView::PreferredSizeChanged notifications. |
84 bool closing_; | 91 bool closing_; |
85 | 92 |
86 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); | 93 DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarDelegate); |
87 }; | 94 }; |
88 | 95 |
89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ | 96 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFOBAR_DELEGATE_H_ |
OLD | NEW |